AI Tools

How you can Use ChatGPT Code Interpreter for Free

Lately, OpenAI launched Code Interpreter in ChatGPT for all paying customers. Nonetheless, it prices $20 monthly, which isn’t reasonably priced for everybody. So if you wish to use ChatGPT Code Interpreter at no cost, this tutorial is for you. A developer who goes by the identify of Shroominic has developed an open-source implementation of ChatGPT’s Code Interpreter. It permits you to carry out dataset evaluation and visualize information just like ChatGPT. On that notice, let’s go forward and learn to use Code Interpreter at no cost.

Issues to Hold in Thoughts Earlier than You Proceed Additional

1. We’re utilizing the free and open-source Code Interpreter API venture on GitHub (visit). It makes use of CodeBoxes, OpenAI’s API, LangChain Brokers, and a number of Python packages to behave like ChatGPT’s Code Interpreter.

2. For a small dataset, it really works fairly effectively and with none cost. Nonetheless, if you throw a big dataset for evaluation, OpenAI’s price restrict at no cost customers prevents the operation. So in the event you plan to make use of it for giant quantities of information, take into account including a fee technique to your OpenAI account.

3. When you’ve got entry to the GPT-4 API, the venture works effectively. Nonetheless, I’ve personalized the code to make it appropriate with the GPT-3.5-turbo mannequin as effectively.

Step 1: Set Up Code Interpreter API

1. First, it is advisable set up Python and Pip in your laptop, for which you’ll comply with our linked tutorial. Be certain so as to add python.exe to PATH throughout set up.

install python with pip

2. Upon getting put in Python together with Pip, open the Terminal and run the under instructions to verify if they’re arrange correctly. The instructions ought to return output with their model numbers.

python -version
pip -version
check python and pip version

3. Now, run the under command to set up the Code Interpreter API.

pip set up codeinterpreterapi
install codeinterpreterapi

4. After that, go forward and get an API key from OpenAI’s website. Click on on “Create new secret key” and replica the important thing.

get api key from openai

Step 2: Run ChatGPT Code Interpreter for Free

1. When you try this, it’s time to run the Code Interpreter API at no cost.

2. Open a code editor like Elegant Textual content or Notepad++ (Download).

Notepad++ UI

3. Now, copy the under code and paste it into the code editor. The code is from the GitHub web page of the Code Interpreter API, however I’ve made some adjustments to keep away from some errors.

import os

from codeinterpreterapi import CodeInterpreterSession

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

    # generate a response based mostly on person enter
    response = await session.generate_response(
        "Plot the Apple inventory value chart from 2007 to 2023 june"

    # output the response (textual content + picture)
    print("AI: ", response.content material)
    for file in response.information:

    # terminate the session
    await session.astop()

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

4. I’ve highlighted the code in purple the place some adjustments are wanted. First, paste the OpenAI API key within the second line.

5. After that, you probably have entry to the GPT-4 API, you’ll be able to outline the “gpt-4” mannequin within the ninth line. Lastly, within the 14th line, you’ll be able to enter your question and outline what you wish to create.

paste the OpenAI API key

6. Now, save the file as “” to the Desktop. Be certain so as to add .py extension on the finish.

save the file as .py

7. Now, go forward and open Terminal and run the under instructions one after the other. The primary command will transfer to the Desktop location and the second will execute the “” file utilizing Python.

cd Desktop
move to desktop from cmd and run python file

8. Give it a number of seconds and Code Interpreter API will generate the chart for you.

chart generated by code interpreter api

9. It makes use of various providers within the background to realize this end result, together with LangChain Brokers, Yahoo Finance information from the web, Matplotlib to plot the graph, and extra. You may add the under line to the code to see all the things occurring within the background.

os.environ["VERBOSE"] = "True"

10. Now onwards, you’ll be able to merely change the question within the code and execute the “” file once more to generate new charts.

change the user query

Step 3: Carry out Information Evaluation Utilizing Code Interpreter API

1. You may also use your native information to carry out information evaluation at no cost. For that, create a folder named “evaluation” on the Desktop.

2. Now, transfer your dataset to the “evaluation” folder. The dataset might be in CSV, XSL, or XSLX format. For instance, we’re going to use a “globaltemperature.csv” file contained in the “evaluation” folder.

a csv file inside a folder

3. Subsequent, open the code editor and paste the under code.

import os

from codeinterpreterapi import CodeInterpreterSession, File

async def principal():
    # context supervisor for auto begin/cease of the session
    async with CodeInterpreterSession(mannequin="gpt-3.5-turbo") as session:
        # outline the person request
        user_request = "Analyze this dataset and plot international temperature from the yr 1950 to 2016. Think about the GCAG system."
        information = [

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

        # output to the person
        print("AI: ", response.content material)
        for file in response.information:

if __name__ == "__main__":
    import asyncio

4. Right here, you first must paste the OpenAI API key.

paste the OpenAI API key

5. Now, change “globaltemperature.csv” with your individual dataset identify. By the best way, you can too change the mannequin and person question relying on what you need from the information.

change the csv file name

6. Put it aside as “” contained in the “evaluation” folder in your Desktop.

save a .py file

7. Launch the Terminal and run the file in a similar way.

cd Desktop/evaluation
move to desktop and run a python file

8. You’ll now get the chart based mostly in your native dataset. And that is how you need to use the Code Interpreter API for dataset evaluation with out paying any payment.

chart generated by code interpreter api

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button