Skip to main content
0
C

Codeinterpreter Api

πŸ‘Ύ Open source implementation of the ChatGPT Code Interpreter

Rating

0.0

Votes

0

score

Downloads

0

total

Price

Free

API key required

Works With

Claude CodeCursorWindsurfVS CodeDeveloper tool

About

πŸ‘Ύ Code Interpreter API

[](https://badge.fury.io/py/codeinterpreterapi)

A LangChain implementation of the ChatGPT Code Interpreter. Using CodeBoxes as backend for sandboxed python code execution. CodeBox is the simplest cloud infrastructure for your LLM Apps. You can run everything local except the LLM using your own OpenAI API Key.

Features

  • Dataset Analysis, Stock Charting, Image Manipulation, ....
  • Internet access and auto Python package installation
  • Input text + files -> Receive text + files
  • Conversation Memory: respond based on previous inputs
  • Run everything local except the OpenAI API (OpenOrca or others maybe soon)
  • Use CodeBox API for easy scaling in production

Docs

Checkout the documentation for more information.

Installation

Get your OpenAI API Key here and install the package.

bash
pip install "codeinterpreterapi[all]"

Everything for local experiments are installed with the all extra. For deployments, you can use pip install codeinterpreterapi instead which does not install the additional dependencies.

Usage

To configure OpenAI and Azure OpenAI, ensure that you set the appropriate environment variables (or use a .env file):

For OpenAI, set the OPENAI_API_KEY environment variable:

bash
export OPENAI_API_KEY=sk-**********
python
from codeinterpreterapi import CodeInterpreterSession, settings


# create a session and close it automatically
with CodeInterpreterSession() as session:
    # generate a response based on user input
    response = session.generate_response(
        "Plot the bitcoin chart of year 2023"
    )
    # output the response
    response.show()

Bitcoin YTD Chart Output

Dataset Analysis

python
from codeinterpreterapi import CodeInterpreterSession, File

# this example uses async but normal sync like above works too
async def main():
    # context manager for auto start/stop of the session
    async with CodeInterpreterSession() as session:
        # define the user request
        user_request = "Analyze this dataset and plot something interesting about it."
        files = [
            # attach files to the request
            File.from_path("examples/assets/iris.csv"),
        ]

        # 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:
            # iterate over the files (display if image)
            file.show_image()


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

Iris Dataset Analysis Output

Production

In case you want to deploy to production, you can utilize the CodeBox API for seamless scalability.

Don't lose this

Three weeks from now, you'll want Codeinterpreter Api again. Will you remember where to find it?

Save it to your library and the next time you need Codeinterpreter Api, it’s one tap away β€” from any AI app you use. Group it into a bench with the rest of the team for that kind of task and you can pull the whole stack at once.

⚑ Pro tip for geeks: add a-gnt πŸ€΅πŸ»β€β™‚οΈ as a custom connector in Claude or a custom GPT in ChatGPT β€” one click and your library is right there in the chat. Or, if you’re in an editor, install the a-gnt MCP server and say β€œuse my [bench name]” in Claude Code, Cursor, VS Code, or Windsurf.

πŸ€΅πŸ»β€β™‚οΈ

a-gnt's Take

Our honest review

πŸ‘Ύ Open source implementation of the ChatGPT Code Interpreter. Best for anyone looking to make their AI assistant more capable in communication. It's completely free and works across most major AI apps. This one just landed in the catalog β€” worth trying while it's fresh.

Tips for getting started

1

Tap "Get" above, pick your AI app, and follow the steps. Most installs take under 30 seconds.

2

Heads up: this needs an API key to work. You'll get one from the service's website (usually free). The setup guide tells you exactly where.

What's New

Version 1.0.06 days ago

Imported from GitHub

Ratings & Reviews

0.0

out of 5

0 ratings

No reviews yet. Be the first to share your experience.