Turn ChatGPT, DeepSeek, Gemini, Kimi, GLM, Qwen, Meta AI, Arena into a local OpenAI-compatible API server. No API keys needed — your logged-in browser sessions are the engine.
Based on ZeroScript by sebattfg, transformed into pure API server.
- OpenAI-compatible: Works with OpenAI SDK, LangChain, OpenWebUI, opencode, etc.
- Site names as models:
deepseek,chatgpt,gemini,kimi,glm,qwen,meta,arena,auto - File support: Any file type via
image_urlorfileparts, auto-cleared after insertion - Auto-switch tabs: When different model requested, extension switches to matching tab
- Tunnel detection + auto-start: Detects public URLs from ngrok, Cloudflare, localtunnel, bore; can auto-start tunnel from config
- Compact UI: Clean console with server URLs, models, controls
- Config file:
zeroapi_config.jsonfor ports, keys, models, tunnels
| Model ID | Provider | Site |
|---|---|---|
deepseek |
DeepSeek | chat.deepseek.com |
chatgpt |
ChatGPT | chatgpt.com |
gemini |
Gemini | gemini.google.com |
kimi |
Kimi K2 | kimi.ai |
glm |
GLM-4 | chat.z.ai |
qwen |
Qwen Turbo | chat.qwen.ai |
meta |
Meta AI | meta.ai |
arena |
Arena | arena.ai |
auto |
Any active tab | — |
Aliases also work: deepseek-chat, deepseek-reasoner, gpt-4o, gpt-4o-mini, gemini-2.0-flash, etc.
Windows: double-click start_api.bat
macOS/Linux: ./start_api.sh or python zeroapi.py
ZeroAPI v1.0.0 | OpenAI Compatible API Server
------------------------------------------------------------
Status: RUNNING | Port: 8000 | Browsers: 0
------------------------------------------------------------
Server
Local: http://localhost:8000
Network: http://192.168.1.50:8000
Public: (none)
Auth
API Key: zeroapi
Models
deepseek chatgpt gemini kimi glm qwen meta arena
0 browsers, 0 providers, auto-switch: on
Endpoints
/ /v1/models /v1/chat/completions /api/tunnels /health
Dashboard: http://localhost:8000/
Logs: OFF | Tunnels: 0 | Providers: none
------------------------------------------------------------
[L] Logs [T] Tunnels [S] Tunnel Start/Stop [R] Reload [C] Clear [Q] Quit
------------------------------------------------------------
- Open
chrome://extensionsin Chrome/Edge/Brave - Enable Developer mode
- Click Load unpacked
- Select
zeroapi-extension/folder from this repo
Open https://chat.deepseek.com and log in.
Extension bar at bottom shows: ZeroAPI [deepseek] Active. If not active, click Use this chat.
For other providers, open their sites in separate tabs.
curl http://localhost:8000/v1/modelsfrom openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="zeroapi")
resp = client.chat.completions.create(
model="deepseek",
messages=[{"role": "user", "content": "Hello!"}]
)
print(resp.choices[0].message.content)This is the recommended setup for local coding agent using your DeepSeek browser session.
opencode is an open-source AI coding agent that supports OpenAI-compatible providers. With ZeroAPI, you can use DeepSeek (or any browser chat) as its engine without API keys.
# macOS / Linux
curl -fsSL https://opencode.ai/install | bash
# or npm
npm i -g opencode-aiVerify:
opencode --version- Run server:
python zeroapi.pyorstart_api.bat - Load extension in browser
- Open https://chat.deepseek.com, log in, make sure tab shows
ZeroAPI [deepseek] Active - Check dashboard http://localhost:8000/ — should show 1 browser connected, provider
deepseek
In your project root, create opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"zeroapi": {
"npm": "@ai-sdk/openai-compatible",
"name": "ZeroAPI (local browser)",
"options": {
"baseURL": "http://localhost:8000/v1",
"apiKey": "zeroapi"
},
"models": {
"deepseek": {
"name": "DeepSeek"
}
}
}
}
}Or use the example file from this repo:
cp opencode.zeroapi.example.json opencode.jsonIf you want all models available, use this expanded version:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"zeroapi": {
"npm": "@ai-sdk/openai-compatible",
"name": "ZeroAPI",
"options": {
"baseURL": "http://localhost:8000/v1",
"apiKey": "zeroapi"
},
"models": {
"deepseek": { "name": "DeepSeek" },
"chatgpt": { "name": "ChatGPT" },
"gemini": { "name": "Gemini" },
"auto": { "name": "Auto" }
}
}
},
"model": "zeroapi/deepseek"
}Set default model:
{
"model": "zeroapi/deepseek"
}opencode
# or
opencode run "Explain this codebase"opencode will now:
- Call
http://localhost:8000/v1/chat/completionswithmodel: deepseek - ZeroAPI server forwards prompt to your DeepSeek browser tab via WebSocket
- Extension types prompt into chat.deepseek.com and reads response
- Response streams back to opencode as OpenAI-compatible chunks
You should see streaming in opencode TUI, and in browser tab you will see messages appearing.
- Keep DeepSeek tab visible (not minimized) — Chrome throttles background tabs
- DeepSeek has strong reasoning, good for code. Use
deepseekmodel id. - For files: opencode sends file context automatically, ZeroAPI injects them via
image_urlparts and auto-clears after. - If you request
geminibut onlydeepseektab open, ZeroAPI will usedeepseekanyway (or auto-switch if you have both tabs open and auto-switch enabled).
No browser connected: Make sure extension shows Active and server shows Browsers: 1Timeout: DeepSeek may be thinking — wait 30s, check browser tab for errorsModel not found: Checkopencode.jsonprovider id matcheszeroapiand model isdeepseek- Tools not running: ZeroAPI translates the browser answer into OpenAI
tool_calls; if opencode shows the tool JSON as plain text, checkGET /health->browsers_connectedand make sure the tool block is written as a fenced ```json block (see "Tool Calling") - Browser tab not typing: Refresh chat.deepseek.com, click
Use this chatagain - Want public URL for remote opencode: enable tunnel in
zeroapi_config.json(see Tunnels section)
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="zeroapi")
client.chat.completions.create(model="deepseek", messages=[{"role":"user","content":"hi"}])Settings -> Connections -> OpenAI -> Base URL: http://localhost:8000/v1, API Key: zeroapi
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(base_url="http://localhost:8000/v1", api_key="zeroapi", model="deepseek")Browser chats have no native function calling, so ZeroAPI emulates the OpenAI tool protocol around them:
- tool definitions from the request (
tools) are injected into the prompt that is typed into the browser chat, - the model answers with a fenced JSON block
(
json {"name": "bash", "arguments": {"command": "ls"}}), - ZeroAPI parses that block server-side and returns real OpenAI
tool_calls(finish_reason: "tool_calls") instead of leaking the JSON as message content, - the client executes the tool and sends the result back as a
role: "tool"message; ZeroAPI folds it back into the next prompt as[Tool result: <name>] ....
Works for both stream: false and stream: true (tool calls are streamed as
delta.tool_calls chunks). Several calls in one answer are supported
(parallel calls), and tool_choice: "none" | "auto" | "required" | {"function": ...}
is honoured.
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="zeroapi")
tools = [{
"type": "function",
"function": {
"name": "bash",
"description": "Run a shell command",
"parameters": {"type": "object", "properties": {"command": {"type": "string"}}, "required": ["command"]},
},
}]
resp = client.chat.completions.create(
model="deepseek",
messages=[{"role": "user", "content": "Which files are in the project?"}],
tools=tools,
)
print(resp.choices[0].finish_reason) # tool_calls
print(resp.choices[0].message.tool_calls) # [bash {"command": "ls"}]This is what makes agent clients work: opencode, LangChain agents, OpenWebUI tools
and anything else that sends tools and executes the returned calls.
ZeroAPI can also expose MCP servers as tools and execute them itself — no client
support needed. Add the servers to zeroapi_config.json:
{
"mcp_servers": {
"roblox": { "command": "python", "args": ["roblox_mcp_server.py"] },
"files": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/me"] }
},
"mcp_tools": {
"enabled": true,
"auto_execute": true,
"max_rounds": 5
}
}GET /api/tools— raw MCP tool list (name, description, schema, server, health)GET /v1/tools— the same tools in OpenAI format, for clients that want to execute themPOST /api/tool/call {"name": ..., "arguments": {...}}— call one tool directly
When MCP servers are configured, a chat request that carries no client tools gets
the MCP tools injected automatically: the model asks for one, ZeroAPI runs it and
feeds the result back to the model (up to max_rounds), and the client only sees the
final answer. Client-provided tools always take precedence.
zeroapi_config.json:
{
"host": "0.0.0.0",
"port": 8000,
"api_key": "zeroapi",
"log_enabled": false,
"auto_switch_tabs": true,
"auto_focus_tab": true,
"notify_on_switch": true,
"tunnel_auto_detect": true,
"tunnel": {
"enabled": false,
"provider": "cloudflare",
"auto_start": false,
"port": null,
"subdomain": "",
"custom_command": "",
"extra_args": ""
},
"models": ["deepseek", "chatgpt", "gemini", "kimi", "glm", "qwen", "meta", "arena", "auto"],
"mcp_servers": {},
"mcp_tools": {
"enabled": true,
"auto_execute": true,
"max_rounds": 5
}
}mcp_servers / mcp_tools are optional — leave them out (or empty) and ZeroAPI runs
as a plain chat bridge. See "Tool Calling" above for the format.
CLI args:
python zeroapi.py --port 8000 --api-key mykey --tunnel-provider cloudflare --tunnel-autostart
python zeroapi.py --no-uiEnv vars:
ZEROAPI_PORT=8000 ZEROAPI_API_KEY=zeroapi ZEROAPI_TUNNEL_URL=https://xxx.trycloudflare.com python zeroapi.pyMake local API public:
# Cloudflare (recommended)
cloudflared tunnel --url http://localhost:8000
# ngrok
ngrok http 8000
# localtunnel
lt --port 8000
# bore
bore local 8000 --to bore.pubAuto-detection: ZeroAPI auto-detects tunnel URLs from ngrok API (4040), cloudflared logs, env vars.
Auto-start from config:
{
"tunnel": {
"enabled": true,
"provider": "cloudflare",
"auto_start": true
}
}Providers: cloudflare, ngrok, localtunnel, bore, custom
Then UI shows:
Public: https://abc.trycloudflare.com [cloudflare]
https://abc.trycloudflare.com/v1/chat/completions
Use public URL in opencode.json:
{
"options": {
"baseURL": "https://abc.trycloudflare.com/v1",
"apiKey": "zeroapi"
}
}GET /— DashboardGET /v1/models— 9 simple models (site names)GET /v1/models/all— 21 models with aliasesGET /api/active-models— active browsersGET /api/tunnels— tunnels + autostart configPOST /api/tunnels/start— get start command for providerGET /health— health, tunnels, providers, auto_switchGET /api/status— statusPOST /v1/chat/completions— OpenAI compatible, streaming supported, tool calling supportedPOST /v1/completions— legacy completionsPOST /v1/embeddings— dummy embeddings (1536 dim)GET /v1/tools— MCP tools in OpenAItoolsformatGET /api/tools— MCP tools, servers and healthPOST /api/tool/call— execute an MCP tool directly
opencode / OpenAI Client
|
v
ZeroAPI Server (FastAPI :8000) -- WebSocket :8000/ws
|
v
Extension (content script + background)
|
v
AI Chat Site (chat.deepseek.com, etc.)
Server selects browser tab by provider (model -> provider map). Extension uses provider-specific DOM logic to type prompt and read response. Streaming via incremental text diff.
pip install -r requirements.txt
python tests/test_server.py
python zeroapi.py --reloadGPL-3.0 — Based on ZeroScript by sebattfg