OpenCode Bridge: a local OpenAI-compatible API and chat for OpenCode models
What is it? OpenCode Bridge is a small local application that exposes the models available in OpenCode through an OpenAI-compatible HTTP API. It also ships a browser chat UI, a Windows EXE launcher and a multilingual i
What is it?
OpenCode Bridge is a small local application that exposes the models available in OpenCode through an OpenAI-compatible HTTP API. It also ships a browser chat UI, a Windows EXE launcher and a multilingual interface (Russian, English, Chinese, Korean).
The idea is simple: if a program can talk to the OpenAI API, it can talk to OpenCode models. No cloud proxy, no API key for the models themselves โ just a server on 127.0.0.1:8080.
Features
-
GET /v1/models,POST /v1/chat/completions,POST /v1/completions. - Real SSE streaming via OpenCode's
session.text.deltaevents โ chunks arrive while the model is still generating. - A web chat with conversation history, streaming output, a system prompt field and a language switcher.
- Four UI languages: Russian, English, Chinese and Korean. The model is instructed to answer in the user's language.
- Optional API key authentication and CORS restricted to local origins.
- A workaround for the daily free-model limit: clean forks of an already admitted session inherit the right to generate.
- A Windows EXE that starts the server, opens the browser and lives in the tray.
Quick start
- Install Node.js 18+ and OpenCode v2.
- Run
opencode service start. - Double-click
OpenCode Bridge.exe(or runnode src/server.js). - Open
http://127.0.0.1:8080/or point another app tohttp://127.0.0.1:8080/v1.
Example request:
curl http://127.0.0.1:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"opencode/hy4-flash-free","messages":[{"role":"user","content":"Hello!"}]}'
Using it from other programs
-
Base URL:
http://127.0.0.1:8080/v1 -
API Key: any string, e.g.
dummy(when no key is configured) -
Model: e.g.
opencode/hy4-flash-free
This works with Cursor, Continue, Open WebUI, LibreChat, LangChain, the Python openai package and similar clients.
Multilingual summary
- RU: ะะพะบะฐะปัะฝัะน ะผะพัั ะบ ะผะพะดะตะปัะผ OpenCode: ะฒะตะฑ-ัะฐั, OpenAI-ัะพะฒะผะตััะธะผัะน API, ัะตัััะต ัะทัะบะฐ ะธะฝัะตััะตะนัะฐ ะธ EXE-ะทะฐะฟััะบะฐะปััะธะบ.
- ZH: OpenCode ๆจกๅ็ๆฌๅฐๆกฅๆฅ๏ผ็ฝ้กต่ๅคฉใOpenAI ๅ ผๅฎน APIใๅ็ง็้ข่ฏญ่จไธ EXE ๅฏๅจๅจใ
- KO: OpenCode ๋ชจ๋ธ์ฉ ๋ก์ปฌ ๋ธ๋ฆฌ์ง: ์น ์ฑํ , OpenAI ํธํ API, 4๊ฐ ์ธ์ด ์ธํฐํ์ด์ค์ EXE ์คํ ํ๋ก๊ทธ๋จ.
Links
- Landing page: https://bcfnjxbtd.github.io/opencode-bridge-landing/
- Source and archive: https://github.com/bcfnjxbtd/opencode-bridge-landing
- Release v1.0.0: https://github.com/bcfnjxbtd/opencode-bridge-landing/releases/tag/v1.0.0
- Gist: https://gist.github.com/bcfnjxbtd/fc31cb773afb9fd3770772b96f123c4f
Caveats
Free OpenCode models have a daily quota; the bridge works around it but cannot create new quota. temperature/top_p are ignored, and max_tokens/stop are applied as post-processing. In fork mode, tool permissions cannot be hard-disabled โ keep the server on localhost and set an API key if needed.
Feedback and contributions are welcome!
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.