Attractive CSS Block

Earning Opportunity for You

Do you have an old Reddit account with good karma? Earn money from it!

Start your Journey Today!

How To Use ChatGPT Code Interpreter For Free?

Use ChatGPT Code Interpreter For Free

Let’s see how you can use ChatGPT code interpreter for free. Analysis and coding have become easier since the advent of AI and with OpenAI releasing its Code Interpreter for ChatGPT, things have become even more stress-free. The hitch here is that this Code Interpreter has been made available in ChatGPT only for paying users. The fee for this Interpreter is $20 per month, which may not be possible for everyone to spend on analysis. If you have been looking for a way to avoid having to pay this fee and still be able to use the Interpreter, then like every problem has its solution, here’s a way for you to use ChatGPT’s Code Interpreter without having to pay for it.

A developer known as Shroominic has made this possible by developing an open-source implementation of ChatGPT’s Code Interpreter. Especially for a small dataset, this solution works beautifully and in a manner close to ChatGPT. Using this solution for large datasets will cause the imposition of OpenAI’s rate limits that they have in place for their free users. Hence, remember to work with smaller datasets if you apply this solution to use the Code Interpreter for free.

Steps to use the ChatGPT Code Interpreter for free:

Step 1:  Code Interpreter Setup

  • On your computer, begin by installing Python and Pip.
Install Python And Pip
  • During the installation process, do not forget to check the box for the option to ‘Add python.exe to PATH’.
  • After the completion of the installation process, check whether the setup has been done correctly. For this, open Terminal and enter the following commands:
python --version
pip --version
Open The Terminal - ChatGPT Code Interpreter

The output for these commands should be the versions of Python and Pip that have been installed on your device.

  • Next, you are ready to install the Code Interpreter API with this command:
pip install "codeinterpreterapi[all]"
Install Code Interpreter API
  •  After this, you can acquire a key for the API from the website of OpenAI. Look for the option to ‘Create new secret key’ and copy the key generated after clicking on it.
Create New Secret Key OpenAI

Step 2:  Run Code Interpreter

  • Bring up your code editor. You can use Notepad++ or Sublime Text depending on your preference.
Open Notepad
  • Copy the following code and paste it onto the code editor.
import os

from codeinterpreterapi import CodeInterpreterSession

async def main():
    # create a session
    session = CodeInterpreterSession(model="gpt-3.5-turbo")
    await session.astart()

    # generate a response based on user input
    response = await session.generate_response(
        "Plot the Apple stock price chart from 2007 to 2023 june"

    # output the response (text + image)
    print("AI: ", response.content)
    for file in response.files:

    # terminate the session
    await session.astop()

if __name__ == "__main__":
    import asyncio
    # run the async function

Make the following changes to the text marked in yellow:

  • In Line 2, enter the API Key generated and copied from OpenAI.
  • In Line 9, edit the version of the ChatGPT as per the one you have access to. For instance, if you have access to the GPT-4 API, define the model as “gpt-4” in the 9th line. Do not forget to make the necessary changes here.
Paste OpenAI API Key In Second Line
  • Lastly, the 14th Line is where you can type in your query.
  • Once the necessary edits have been made, you can save this file on the Desktop of your device. Do not forget to add the extension “.py” to the file name while saving. For instance, if you are saving the file under the name “chart” then save it as “”
Desktop Chart PY
  • You can now head to the Terminal and carry out the following commands to run this file saved on the Desktop of your device:
cd Desktop
  • Upon execution, the Code Interpreter API will give you a chart as the output.
Chart Generated
  • In case you are interested in seeing everything that is being used to come up with the output, you can edit the code & include the following:
os.environ["VERBOSE"] = "True"
Command To See Everything Happening 1
Command To See Everything Happening 3
Command To See Everything Happening 2
  • You can now simply make necessary changes in the query of the code and run your file again for new charts.
Change Query In The Code

Step 3:  Data Analysis

In case you have your own dataset, an analysis can be done using that as well. Simply create a folder named “Analysis” on the Desktop of your device and follow these steps ahead:

  • Save a copy of your dataset in this folder on the Desktop. This file could be in any one of the CSV, XSL, or XLSX formats. Consider for instance that we are using the “globaltemperatures.csv” file in the “Analysis” folder.
Create Folder Named Analysis
  • Once you have your dataset saved in the right place, you can then go ahead with the coding process. Copy the following code and paste it onto the editor of your preference:
import os

from codeinterpreterapi import CodeInterpreterSession, File

async def main():
    # context manager for auto start/stop of the session
    async with CodeInterpreterSession(model="gpt-3.5-turbo") as session:
        # define the user request
        user_request = "Analyze this dataset and plot global temperature from the year 1950 to 2016. Consider the GCAG system."
        files = [

        # generate the response
        response = await session.generate_response(
            user_request, files=files

        # output to the user
        print("AI: ", response.content)
        for file in response.files:

if __name__ == "__main__":
    import asyncio

Just like before, make the required changes in the text marked in yellow:

  • Enter your OpenAI API key in the second line and the version of ChatGPT API you have access to in the eighth line.
Paste OpenAI API Key
  • Edit the file name in the code as per the file name of your dataset.
  • Do note that you can easily edit the query as well as the model used for analysis based on what you hope to find in your dataset.
Global Temperature
  • In the “Analysis” folder on the Desktop of your device, save this file as “”
Data PY Inside Analysis Folder
  • You can now bring up the Terminal and run this file as we did earlier:
cd Desktop/analysis
Terminal - Python PY
  • The chart generated now after these steps will be based on your local dataset.
Get Chart Based On Your Local Dataset

For larger datasets that cannot be analyzed in the ways described above, you might just have to become a paying user of ChatGPT for flawless and quick operations. On the other hand, smaller datasets can freely be used through this open-sourced alternative to the Code Interpreter of ChatGPT. Two important things to remember to edit in the code would be the key from OpenAI and the version of your ChatGPT API. Once these two are set, you can go about with your analysis. Now you know how to use ChatGPT code interpreter for free.

By Vishal

Meet Vishal Negal, a digital marketer and tech enthusiast with over 8 years of experience. Specializing in creating comprehensive how-to guides, in-depth reviews, and engaging tech-related content.