Open WebUI’s Code Interpreter lets your model write Python and run it during the conversation, so it can do real maths, analyse a CSV you attach, draw a chart or build an Excel file instead of guessing.
It works with local models from Ollama and with any OpenAI-compatible API, and the default engine runs entirely in your browser, so there is nothing to install on the server.
The feature has changed a lot this year. Native function calling is now the only supported mode, the old XML tag method is legacy, and the in-browser Pyodide and Jupyter engines are both marked legacy in favour of Open Terminal for heavy work.
This guide explains how to turn Code Interpreter on for a model, how the browser filesystem at /mnt/uploads/ works, which Python libraries you can use, when to switch to Jupyter or Open Terminal, and how to fix the most common errors. It follows the official Open WebUI documentation as of November 2026.
- Turn on per model: Admin Settings > Models > pick a model > Features > Code Interpreter.
- Global switch: Admin Settings > Code Execution (under Legacy), or
ENABLE_CODE_INTERPRETER=true(the default). - Default engine: Pyodide, which runs Python in your browser with a fixed set of libraries (pandas, numpy, matplotlib, openpyxl and more).
- Files: attachments land in
/mnt/uploads/; download results from the chat’s Files tab. - Need any package or a shell? Use Open Terminal (Docker) instead.
- Mode: the model must use Native function calling, which is the default.
What Code Interpreter Does
Language models are bad at exact arithmetic and cannot open a spreadsheet on their own. Code Interpreter fixes both by giving the model a tool, called execute_code, that runs Python and returns the output.
With it switched on, a model can:
- Do exact calculations, statistics and unit conversions.
- Read a CSV, Excel or text file you attach and summarise it.
- Draw charts with matplotlib or seaborn and show them in the chat.
- Create files such as cleaned CSVs, .xlsx workbooks, .docx reports or .pptx decks that you can download.
- Work through multi-step problems, checking each step with real code.
Open WebUI also renders MermaidJS diagrams and HTML/SVG artifacts in chat, but those do not need Code Interpreter.
Run Button vs Code Interpreter
Open WebUI has two separate Python features, and they are switched on in different places.
| Run button (Code Execution) | Code Interpreter | |
|---|---|---|
| Who runs the code | You click Run on a code block | The model runs it by itself |
| Controlled by | ENABLE_CODE_EXECUTION only |
ENABLE_CODE_INTERPRETER, the model’s Features toggle and user permissions |
| Available to | Every user | Users and models where it is allowed |
| Default engine | Pyodide in your browser | Pyodide in your browser |
| Output goes back to the model? | No, it is shown to you | Yes, the model reads it and continues |
In the admin Code Execution page the two have separate sections, each with its own engine, Jupyter URL, credentials and timeout. Setting up Jupyter for one does not set it up for the other.
Choose an Engine: Pyodide, Jupyter or Open Terminal
| Pyodide (legacy, default) | Jupyter (legacy) | Open Terminal (recommended) | |
|---|---|---|---|
| Runs in | Your browser (WebAssembly) | A Jupyter server | A Docker container |
| Packages | Fixed list only | Full Python ecosystem | Any language, any package |
| Shell access | None | Limited | Full shell |
| Multi-user safety | Per user by design | Not isolated (shared runtime) | Built-in multi-user mode for small trusted teams |
| Setup | None | Admin connects a server | Settings > Integrations |
| Speed | Much slower than native | Native | Native |
| Best for | Quick analysis, charts, file processing | Single-user or trusted setups | Real workloads, installs, scripts |
Our pick: start with Pyodide because it needs no setup and is safe on a shared server. If the model keeps failing with import errors, or your files are large, move to Open Terminal. Avoid Jupyter on any server other people use, because every user shares the same Python runtime and filesystem.
The Code Interpreter toggle and the Open Terminal toggle cannot be on at the same time. Turning one on turns the other off.
Turn On Code Interpreter
You need admin rights for these steps. If you have not installed Open WebUI yet, follow our Open WebUI with Ollama setup guide first, and keep it current with our guide to updating Open WebUI.
- Open Admin Settings > Code Execution and, under the Legacy section, check that Enable Code Interpreter is on and the engine is pyodide.
- Go to Admin Settings > Models and select the model you want to use.
- Under Features, switch on Code Interpreter, then save.
- In the same model’s advanced parameters, make sure function calling is set to Native (this is the default; only change it if someone switched it to Legacy).
- For non-admin users, open Admin Panel > Users > Groups and make sure the Code Interpreter feature permission is allowed for their group.
Pick a model that is good at tool calling. Open WebUI’s docs name GPT-5.6 Luna, Gemini 3.5 Flash-Lite, MiniMax M3 or, for local use, Muse Glimmer 30B as the minimum level for Native mode.
Small local models often write broken code or forget to call the tool. Our best Ollama models list helps you choose a local one.
Use It in a Chat
- Start a new chat with the model you enabled.
- Switch on Code Interpreter from the tools beside the message box if it is not already on for that chat.
- Attach a file if you want the model to work on one.
- Ask a question that needs real computation, for example: “Using Python, calculate the monthly EMI on a ₹25 lakh loan at 8.5% for 20 years and show a yearly amortisation table.”
- Watch the model call the tool. Expand the code block to see exactly what ran and the output under STDOUT/STDERR.
- Open the Files tab in the chat panel to download any files it created.
Work With Files in /mnt/uploads
With the Pyodide engine, Open WebUI gives Python a virtual folder at /mnt/uploads/, stored in your browser’s IndexedDB.
- Attachments appear there automatically. Files you attach to a message (with a server file ID) are copied into
/mnt/uploads/before the code runs. - Files persist between runs in the same session, so the model can build on earlier results.
- Page reloads clear it unless the admin sets
ENABLE_PYODIDE_FILE_PERSISTENCE=true(off by default). - The Files tab lets you browse, preview, upload, download and delete files without a terminal.
- Temporary chats: images pasted inline in a temporary chat have no server file ID, so they are skipped. Upload them through the Files tab instead.
A typical pattern the model will follow:
import os
import pandas as pd
print(os.listdir('/mnt/uploads'))
df = pd.read_csv('/mnt/uploads/sales.csv')
summary = df.groupby('region')['revenue'].sum()
summary.to_csv('/mnt/uploads/summary.csv')
print(summary)
Tell the model to save outputs under /mnt/uploads/, then download them from the Files tab. A sandbox: link that the model writes in its reply will not work.
The Jupyter engine does not use /mnt/uploads/ or the Files tab. It uses Jupyter’s own filesystem.
Available Python Libraries
Pyodide cannot install anything at runtime. These packages load automatically when the code imports them:
| Package | Use |
|---|---|
| pandas, numpy | Data analysis and maths |
| matplotlib, seaborn | Charts |
| scipy, scikit-learn, sympy | Science, machine learning, symbolic maths |
| openpyxl | Excel files (also used by pandas read_excel and to_excel) |
| python-docx, python-pptx | Word and PowerPoint files |
| requests, beautifulsoup4 | HTTP and HTML parsing |
| regex, pytz, tiktoken | Regex, time zones, token counting |
| micropip | Internal package loader |
The full Python standard library is available too (json, csv, math, datetime, os, io and so on). Anything with C extensions or native binaries, such as torch, tensorflow, opencv or psycopg2, will fail with an import error and cannot be added. For those, use Open Terminal or Jupyter.
Show Charts Inline
For a chart to appear in the chat, the code must print the image as a base64 data URL instead of calling plt.show(). Open WebUI spots the base64 output, uploads it as a file, swaps in a file URL and the model embeds that URL in its answer.
import matplotlib.pyplot as plt, io, base64
plt.bar(['Q1', 'Q2', 'Q3', 'Q4'], [150, 230, 180, 310])
plt.title('Quarterly sales')
buf = io.BytesIO()
plt.savefig(buf, format='png', dpi=150, bbox_inches='tight')
buf.seek(0)
print(f"data:image/png;base64,{base64.b64encode(buf.read()).decode()}")
plt.close()
If the model pastes a wall of base64 text into its reply, tell it: “Only print the base64 in code, then use the file URL from the output in your answer.”
Set Up the Jupyter Engine
Use Jupyter only on a single-user or trusted setup.
- Run a Jupyter server that Open WebUI can reach on your network.
- In Admin Settings > Code Execution, under the Code Interpreter section, set the engine to jupyter (Legacy).
- Enter the Jupyter URL.
- Pick Jupyter Auth: None, Token or Password, and fill in the matching field.
- Set a Code Execution Timeout that suits your workloads, then save.
- Repeat in the Code Execution section if you also want the Run button to use Jupyter.
Each run starts a fresh Jupyter kernel and deletes it afterwards, so variables and imports do not carry over between runs.
Environment Variables
| Variable | Default | What it does |
|---|---|---|
ENABLE_CODE_INTERPRETER |
true | Turns Code Interpreter on or off for the whole instance |
CODE_INTERPRETER_ENGINE |
pyodide | pyodide or jupyter |
CODE_INTERPRETER_PROMPT_TEMPLATE |
built-in | Custom instructions for how the model should use the tool |
CODE_INTERPRETER_BLOCKED_MODULES |
empty | Comma-separated modules to refuse importing (a convenience filter, not a security boundary) |
ENABLE_CODE_EXECUTION |
– | Controls the manual Run button |
CODE_EXECUTION_ENGINE |
pyodide | Engine for the Run button |
ENABLE_PYODIDE_FILE_PERSISTENCE |
false | Keeps /mnt/uploads/ files across page reloads |
With Docker, pass these with -e, for example -e ENABLE_PYODIDE_FILE_PERSISTENCE=true, then recreate the container.
10 Prompts to Try
- “Using Python, find the compound interest on ₹1,00,000 at 7.1% for 15 years, compounded yearly, and show each year.”
- “Read the attached CSV, show the first 10 rows, and list any columns with missing values.”
- “Group the attached sales data by month and draw a line chart of revenue.”
- “Clean the attached Excel file: remove duplicate rows, trim spaces and save it as cleaned.xlsx.”
- “Create a Word document with a one-page summary of this data and save it to /mnt/uploads/.”
- “Make a five-slide PowerPoint from these bullet points.”
- “Solve this equation symbolically with sympy and show the steps: x^3 – 6x^2 + 11x – 6 = 0.”
- “Count the tokens in the attached text file with tiktoken.”
- “Fit a simple linear regression on columns A and B of the attached file and plot it.”
- “Convert all the dates in this CSV from UTC to Asia/Kolkata time.”
Troubleshooting
The model writes code but never runs it
Check that Code Interpreter is on under the model’s Features, that ENABLE_CODE_INTERPRETER is true, and that the model is in Native function calling mode. In Native mode, code written inside the old interpreter tags is shown as text and not run. Also try a stronger tool-calling model.
ModuleNotFoundError or import error
Pyodide only has the libraries listed above. Ask the model to use pandas or numpy instead, or switch to Open Terminal for full package access.
The “Analyzing…” spinner is stuck
The code probably hit a timeout or an error. Check the Open WebUI backend logs, shorten the task, or raise the Code Execution Timeout for Jupyter.
Charts show as raw base64 text
The model echoed the base64 into its answer. Ask it to print the data URL only inside the code and use the returned file URL in its reply.
The chart does not appear at all
The code used plt.show(). Ask for the base64 pattern shown above.
My files vanished after refreshing
That is expected with the default settings. Set ENABLE_PYODIDE_FILE_PERSISTENCE=true or download results from the Files tab before reloading.
Microsoft Edge crashes with STATUS_ACCESS_VIOLATION
Edge’s “Enhance your security on the web” setting breaks WebAssembly. Turn it off at edge://settings/privacy/security, use Chrome or Firefox, or switch the engine to Jupyter.
The Code Interpreter toggle turned itself off
You switched on Open Terminal. The two cannot be active together.
Large files are slow or crash the tab
Pyodide is much slower than native Python and limited by browser memory. Use a sample of the data or move to Open Terminal.
FAQ
Does Open WebUI Code Interpreter work with Ollama models?
Yes. It works with any model you connect, including local Ollama models, as long as the model handles native tool calling well.
Is Code Interpreter safe on a shared server?
With the default Pyodide engine, yes: code runs in each user’s own browser sandbox. Jupyter is not isolated and should not be used for multi-user servers.
Can the model install pip packages?
Not with Pyodide. It can with Jupyter or Open Terminal.
Where are the files it creates?
In /mnt/uploads/ inside your browser. Download them from the chat’s Files tab.
Why is Pyodide called legacy?
Open WebUI now recommends Open Terminal for real code execution and says Pyodide and Jupyter may be deprecated in a future release. Pyodide is still the built-in default for quick in-chat Python.
Can I stop users importing certain modules?
You can list them in CODE_INTERPRETER_BLOCKED_MODULES, but it only blocks direct top-level imports and is not a security boundary.
Do I need Code Interpreter for web search or document Q&A?
No. Those are separate features. See our Open WebUI web search guide and Open WebUI RAG guide.




