OpenCode
~/.config/opencode/opencode.json:prism built on the OpenAI-compatible SDK for Chat Completions models, and prism-responses built on the OpenAI SDK for models that speak the Responses API.Last updated Reviewed against Prism v0.3.26
Why two providers
OpenCode's provider format has no per-model protocol override — the transport is a property of the provider. Prism therefore registers two: one for each protocol. If every model in your catalog uses the same protocol, only that one provider is written.
| Provider | SDK | Endpoint | Holds |
|---|---|---|---|
| prism | @ai-sdk/openai-compatible | /v1/chat/completions | Every chat_completions model. |
| prism-responses | @ai-sdk/openai | /v1/responses | Models marked api: responses, and Codex OAuth models. |
One-click setup
Open the Agents tab
Agents. OpenCode is detected via ~/.config/opencode/opencode.json or the OpenCode binary.Click Setup
opencode.json.prism-backup, then adds or updates the Prism providers.Select a Prism model in OpenCode
What Prism writes
{
"provider": {
"prism": {
"npm": "@ai-sdk/openai-compatible",
"name": "Prism",
"options": {
"baseURL": "http://127.0.0.1:11434/v1",
"apiKey": "prism"
},
"models": {
"glm-5.1:cloud": { "name": "GLM 5.1 (Ollama Cloud)" }
}
},
"prism-responses": {
"npm": "@ai-sdk/openai",
"name": "Prism (Responses)",
"options": {
"baseURL": "http://127.0.0.1:11434/v1",
"apiKey": "prism"
},
"models": {
"gpt-5.2-codex": { "name": "GPT-5.2 Codex (ChatGPT)" }
}
}
}
}Every other provider and top-level key in your file is preserved.
Legacy provider cleanup
Older Prism versions wrote a single prism-codex provider before the API split. Prism removes that block automatically when it re-syncs, so no manual cleanup is needed.
Setting a default model
Prism does not change your default model. Set it in OpenCode in the normal way, choosing a model from whichever Prism provider matches the model's protocol. A Chat Completions model selected under prism-responses will not appear, because each provider only lists the models it can serve.
Add MCP servers
OpenCode keeps MCP servers in the same opencode.json, under the mcp key. Enabling OpenCode in the MCP tab adds a type: "remote" entry pointing at Prism's gateway. See MCP Gateway.