Dev.to AI ๐Ÿค– Ai ๐Ÿ‘ 0 ๐Ÿ“– 2 min read

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.delta events โ€” 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

  1. Install Node.js 18+ and OpenCode v2.
  2. Run opencode service start.
  3. Double-click OpenCode Bridge.exe (or run node src/server.js).
  4. Open http://127.0.0.1:8080/ or point another app to http://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

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!

๐Ÿ“ฐ Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.