Code interpreter API
A stateless code interpreter API with a published Python stack
A code interpreter lets a model or a user run Python on data and get numbers and charts back. This one is a plain HTTP call: send code and CSV files, get output and PNG files. It works with any model, keeps no sessions, has no installs and no GPU, and costs one run per call. Here is what is in it, a working example, and when E2B, Modal or Daytona fit better.
By the OnlineCompiler.io team. Updated . We make OnlineCompiler.io, so we're one of the options here. Every competitor figure links to the vendor's own page, and we say where our API falls short.
The short answer
- Use this for short, self-contained analysis: read a file, compute, print a table, draw a chart. Each call is independent, takes up to 30 seconds and 512 MB, and costs one run.
- Use E2B, Modal or Daytona when the work needs state across calls, packages you install, network access, files larger than 1 MB, more memory or a GPU. We have none of those.
No sessions, no installs, no GPUs. That is the whole design: because nothing persists, every call gets a fresh gVisor sandbox with no network, and the price is per run.
The stack
python-3.14 comes with these packages, at these versions. The same table is in the compiler docs and is read from the images we build.
| Package | python-3.14 | python-3.14-pandas2 |
|---|---|---|
| numpy | 2.5.4 | 2.5.4 |
| pandas | 3.0.6 | 2.3.3 |
| scipy | 1.18.1 | 1.18.1 |
| scikit-learn | 1.9.1 | 1.9.1 |
| matplotlib | 3.11.2 | 3.11.2 |
| seaborn | 0.13.2 | 0.13.2 |
| statsmodels | 0.15.0 | 0.15.0 |
| sympy | 1.14.0 | 1.14.0 |
| openpyxl | 3.1.5 | 3.1.5 |
| pillow | 13.0.0 | 13.0.0 |
| duckdb | 1.5.6 | 1.5.6 |
pandas 3 is the default. Code written for pandas 2 (copy-on-write and string dtype differences are the usual
breakage) can use python-3.14-pandas2, which is the same image with pandas 2.3.3. Plots use
Matplotlib's non-interactive backend, so plt.show() saves a file instead of opening a window.
CSV in, PNG out
Send input files in files; the program reads them from its working directory. Write anything to $OUTPUT_DIR (/tmp/outputs) and it comes back in the response; plt.show() does that for
you, saving each open figure as figure-1.png, figure-2.png and so on, so code copied from a
tutorial returns its charts unchanged.
curl -X POST https://api.onlinecompiler.io/api/run-code-sync/ \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"compiler": "python-3.14",
"code": "import pandas as pd\nimport matplotlib.pyplot as plt\ndf = pd.read_csv(\"data.csv\")\nprint(df.describe())\ndf.plot(x=\"a\", y=\"b\")\nplt.show()",
"files": [
{"name": "data.csv", "content": "a,b\n1,2\n2,4\n3,5\n"}
]
}'{
"status": "success",
"exit_code": 0,
"output": " a b\ncount 3.0 3.000000\nmean 2.0 3.666667\n...",
"error": "",
"truncated": false,
"files": [
{
"name": "figure-1.png",
"mime": "image/png",
"size": 14862,
"content_base64": "iVBORw0KGgo...",
"url": "https://api.onlinecompiler.io/..."
}
],
"files_truncated": false
}curl -s -X POST https://api.onlinecompiler.io/api/run-code-sync/ ... \
| jq -r '.files[0].content_base64' | base64 -d > figure-1.png- In: up to 8 files and 1 MB in total, with plain file names.
- Out: up to 8 files and 2 MB a run, as png, svg, csv, json, txt. Other files are dropped.
- Kept: each file's
urlworks with your API key for 60 days. - Limits: 30 s, 512 MB, 2 CPUs and no network, as on every run. The files reference has the exact fields, and limits the rest.
Speed and memory
Importing is the cost. On our measurements pandas imports in about 0.55 s, scikit-learn in about 1.5 s and the whole stack in up to 3 s, and a program pays only for what it imports.
The memory field overstates use: gVisor counts the library files Python maps, so a hello world that
imports the whole stack reports about 430 MB while really using about
200 MB. Your data has the rest of the 512 MB, so a dataset of a few hundred
megabytes in memory is out of reach.
Price per run
A run is a run: the same price on every plan, with Python data science, input files and output files included, and nothing billed for minutes. 100,000 runs a month are free, commercial use included.
| Plan | Price | Runs a month | Per run | Per 1,000 runs |
|---|---|---|---|---|
| Free | $0 | 100,000 | $0 | $0 |
| Starter | $10 | 150,000 | $0.000067 | $0.067 |
| Pro | $49 | 1,000,000 | $0.000049 | $0.049 |
| Business | $199 | 4,000,000 | $0.000050 | $0.050 |
That is per call, not per hour, so it favours many short calls. A model-provider tool that bills container time with a five-minute minimum, such as Anthropic's code execution tool at $0.05 a container-hour after its free allowance, works out to about $0.004 for a short call (our arithmetic), and OpenAI's starts at $0.03 for a 20-minute session. Those tools also keep state and have more memory, so the comparison is about the shape of the work, not a like-for-like price.
How it compares
| Product | Packages | Installs and network | State | Charts and files |
|---|---|---|---|---|
| OnlineCompiler.io | Fixed list, published with versions | No installs, no network | None; each call is fresh | png, svg, csv, json, txt files from $OUTPUT_DIR |
| Anthropic code execution | pandas, numpy, scipy, scikit-learn, statsmodels, matplotlib, seaborn, pyarrow | No internet | REPL state; containers kept up to 30 days | Files from $OUTPUT_DIR |
| Gemini code execution | 37 libraries, none added by the user | None | Not documented | Inline matplotlib images |
| E2B Code Interpreter | A broad pinned list | pip; outbound internet on by default | Jupyter contexts in sessions of 1 or 24 hours | Typed results: PNG, SVG, HTML, JSON and a chart object |
| Daytona | pandas, scikit-learn, torch and transformers in its snapshots | pip; custom snapshots | Stateless and stateful modes | Chart artifacts |
| Modal | Your own image | Your own image | Sandboxes you manage | Whatever you build; GPUs from about $0.59 an hour |
Model-provider tools are bundled with one vendor's model, and OpenAI's and Anthropic's keep a container for a session. A model-agnostic interpreter can be called from Claude, GPT, Gemini or a plain backend, which is what this page's API is for. Riza, a hosted code interpreter with a similar stateless, per-run design, shut down in October 2025 citing slow demand, so treat the market as unproven and keep your code behind a thin wrapper you could point at another provider.
Using it from an agent
The MCP server exposes the same runs as a run_code tool. It takes
the files field too, returns PNG charts as image content, and returns CSV, JSON and text files with
their text, so an assistant can look at the chart it drew. A function-calling model can call the HTTP endpoint from
its tool handler in the same way.
For teaching and assessment
The same stack grades data questions: /api/run-tests/ takes shared files and a rows checker that ignores row order, for SQL on duckdb-1.5 and for pandas. The online judge guide shows both.
See also the files reference, the package table and the comparison of code execution APIs.
Frequently asked questions
What is a code interpreter API?
An HTTP API that runs code a model or a user wrote and returns the result, so your application never runs untrusted code itself. Model providers bundle one with their chat APIs; a model-agnostic one is a separate service you call from any model, tool or backend.
Which Python packages are installed?
numpy 2.5.4, pandas 3.0.6, scipy 1.18.1, scikit-learn 1.9.1, matplotlib 3.11.2, seaborn 0.13.2, statsmodels 0.15.0, sympy 1.14.0, openpyxl 3.1.5, pillow 13.0.0, duckdb 1.5.6 in python-3.14. python-3.14-pandas2 is the same stack with pandas 2.3.3. The list is fixed and published with versions. pip is in the image, but runs have no network, so it can't download a package.
Can it read a CSV and return a chart?
Yes. Send up to 8 files in the files field (1 MB in total) and the program reads them from its working directory. Anything it writes to $OUTPUT_DIR (/tmp/outputs) comes back in the files field as base64, up to 8 files and 2 MB a run, in these types: png, svg, csv, json, txt. plt.show() saves each figure as figure-1.png, figure-2.png and so on.
Does it keep state between calls?
No. Every call starts a fresh sandbox, so variables, files and imports are gone when it ends. If an agent needs a dataframe across steps, it sends the data and the earlier code again, or it uses a stateful sandbox such as E2B.
Is there a GPU, torch or TensorFlow?
No. There is no GPU and no deep learning framework. The stack is for analysis, charts, statistics and classical machine learning with scikit-learn, inside a fixed memory and time limit.
How much does a run cost?
A run is a run on every plan. 100,000 runs a month are free, then Starter is $10 for 150k runs, Pro is $49 for 1M runs and Business is $199 for 4M runs. There is no charge for sandbox minutes, files or the packages.
How long do the returned files stay available?
The base64 content is in the response. Each file also has a url that works with your API key for 60 days. An account stores up to 1 GB; past that, files still come back in the response with url set to null.
Does it work with Claude, GPT or Gemini?
It works with any model or none. Call the HTTP API from your tool handler, or connect the MCP server, which returns PNG charts as image content. Model-provider tools only work with their own model.