Agent Setup

OpenCode

Quick answer
Prism writes two provider blocks into ~/.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.

ProviderSDKEndpointHolds
prism@ai-sdk/openai-compatible/v1/chat/completionsEvery chat_completions model.
prism-responses@ai-sdk/openai/v1/responsesModels marked api: responses, and Codex OAuth models.

One-click setup

1

Open the Agents tab

In the Admin UI, select Agents. OpenCode is detected via ~/.config/opencode/opencode.json or the OpenCode binary.
2

Click Setup

Prism backs the file up once as opencode.json.prism-backup, then adds or updates the Prism providers.
3

Select a Prism model in OpenCode

Both providers appear in OpenCode's model list with your catalog behind them.
An empty opencode.json is a valid starting point
If OpenCode has not written its config yet, Prism creates an empty file so setup can proceed, then fills in the provider blocks.

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.