Status: [UNTESTED] Endpoints found: http://localhost:80/v1/chat/completions http://localhost:80/v1/completions http://localhost:80/v1/models Source: https://github.com/adnXone/opencode-api-node # opencode-api-node [![CI](https://github.com/adnxone/opencode-api-node/actions/workflows/ci.yml/badge.svg)](https://github.com/adnxone/opencode-api-node/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/opencode-api-node.svg)](https://www.npmjs.com/package/opencode-api-node) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE) [![Node](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg)](./package.json) OpenAI-compatible API proxy for [opencode](https://opencode.ai) — exposes `opencode serve` as a standard `/v1/chat/completions` endpoint. Built with Node.js and Express. Drop-in replacement for any OpenAI client. ## Features - **OpenAI-compatible** — drop-in replacement for any OpenAI client - **Free models** — lists opencode free models (`deepseek-v4-flash-free`, `qwen3.6-plus-free`, etc.) - **True streaming** — forwards backend tokens live via `prompt_async` + the backend event bus (chat & text completion), with `stream_options.include_usage` - **Conversation memory** — pass `session_id` to keep multi-turn context in one backend session instead of replaying history on every request - **Thinking output** — backend reasoning streams as `reasoning_content` deltas (opt-in via `include_reasoning: true`) and non-streaming replies carry `message.reasoning_content` - **System prompts** — maps `system` role to opencode's system prompt - **Image input** — supports `image_url` for vision-capable models - **Text completions** — legacy `/v1/completions` endpoint - **API key auth** — optional `API_KEY` env var for bearer token auth - **Resilient** — retries on network failures, configurable timeouts, OpenAI-shaped errors - **Model mapping** — bare model name → `opencode/` provider, or `provider/model` - **Session inspector** — `--session []` CLI queries backend sessions as JSON - **Health check** — `GET /health` and `GET /` ## Install ```bash npm install -g opencode