OpenCode is an open-source AI coding agent for the terminal, built on the AI SDK and Models.dev with 75+ providers plus local models. It offers a TUI, a scriptable CLI and IDE integration, and lets engineers point any provider at a custom OpenAI-compatible endpoint.
base_url or *_BASE_URL setting./v1 for anything speaking the OpenAI wire (/v1/chat/completions).GET /v1/models.Skip it — one-line setup
The script installs OpenCode from its official source, writes the gateway settings into the
tool's own config file (backing up any existing one) and runs a live check. It asks for your gateway key, or
take it from --key / --key-file. --uninstall restores exactly what it wrote.
curl -fsSL https://quantoport.com/agents/opencode/setup | bash
1 · Install
Install OpenCode from its own official source.
curl -fsSL https://opencode.ai/install | bash # macOS/Linux; cross-platform: npm install -g opencode-ai
2 · Configure — point it at QuantoPort
Gateway base URL https://quantoport.com; get your key from the console.
1) In the TUI run /connect, scroll to Other, enter a provider id (e.g. quantoport) and your API key (stored in ~/.local/share/opencode/auth.json).
2) Add the provider in opencode.json (project root) or the global ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"quantoport": {
"npm": "@ai-sdk/openai-compatible",
"name": "QuantoPort",
"options": { "baseURL": "https://quantoport.com/v1" },
"models": { "<model-id>": { "name": "<Model name>" } }
}
}
}
On the China endpoint set options.baseURL to https://api.shinlinkai.com/v1 (OpenAI wire only).
3) Run /models and pick the model.3 · Verify
One request proves you are on our channel.
opencode run "reply with OK" # or opencode auth list to inspect credentials
4 · Common pitfalls
- baseURL must include the
/v1version segment. - Use npm @ai-sdk/openai-compatible (drives
/v1/chat/completions); use @ai-sdk/openai only if the gateway speaks/v1/responses. - The global
~/.config/opencode/opencode.jsonand the projectopencode.jsonare merged; later sources override conflicting keys.OPENCODE_CONFIGcan point at a custom config. - opencode auth login is equivalent to
/connect; credentials live in~/.local/share/opencode/auth.json.
Sources for the tool-side steps: opencode.ai/docs/providers/ opencode.ai/docs/config/ opencode.ai/docs/cli/ opencode.ai/docs/