Code Interpreter API

Code Interpreter API

โ˜… 3.8 ๐Ÿ”– 1200 saves ๐Ÿ’ฐ Free GitHub

Code Interpreter API is an open-source implementation of ChatGPT’s Code Interpreter, built on top of LangChain. It gives LLM applications the ability to write and execute Python code in a sandboxed session, analyse uploaded files and answer questions about data, instead of merely describing what code would do. The project, maintained by shroominic on GitHub, has gathered around 3,800 stars and is released under the MIT license.

Overview

The library wraps a code-execution agent in a simple API: you open a session, optionally upload files such as CSVs or images, and then chat with the agent about them. Behind the scenes it uses LangChain agents together with a hosted sandbox (Codebox) to actually run the generated Python, inspect the output, fix errors and iterate until it can answer. Sessions keep their state, so follow-up questions can build on earlier computations and plots. It supports OpenAI models such as GPT-4 and GPT-3.5, and because it is a LangChain component it slots into existing LangChain applications with only a few lines of code.

Key Features

  • Open-source re-implementation of the ChatGPT Code Interpreter experience
  • Executes generated Python code in a sandboxed environment and iterates on errors
  • File uploads for data analysis: CSVs, spreadsheets, images and more
  • Stateful sessions that remember files, variables and previous results
  • Built on LangChain agents, so it composes with LangChain chains and tools
  • Generates charts and returns files produced during a session
  • MIT licensed and installable from PyPI

๐Ÿ’ณ Pricing

Code Interpreter API is completely free and open source under the MIT license. You only pay for the underlying model API usage (for example OpenAI tokens) and, if you use it, the hosted sandbox service your deployment relies on.

Who Is It For

Developers building data-analysis chatbots, internal analytics assistants or LLM apps that need to run code safely will find this the fastest route to Code Interpreter-style behaviour without waiting for proprietary access. It is also a useful reference implementation for anyone studying how code-execution agents are put together.

๐Ÿš€ Visit Code Interpreter API Official Site

๐Ÿšฉ Report an issue