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.
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.
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.
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.