Skip to main content

What is OpenCode

OpenCode is an open-source AI coding agent available as a terminal interface, desktop app, and IDE extension. With provider configuration, it can send supported model requests through Capriole AI’s OpenAI-compatible and Anthropic-compatible endpoints.

Prerequisites

Before you begin, make sure you have:

Installation

Install OpenCode with the official install script:
curl -fsSL https://opencode.ai/install | bash
Or install it with npm:
npm install -g opencode-ai
Verify the install:
opencode --version

Configuration

Create or update ~/.config/opencode/opencode.json: Use apiKey for the OpenAI provider and authToken for the Anthropic provider.
{
  "$schema": "https://opencode.ai/config.json",
  "model": "capriole-ai-openai/openai/gpt-5.5",
  "small_model": "capriole-ai-openai/openai/gpt-5.5",
  "enabled_providers": ["capriole-ai-openai", "capriole-ai-anthropic"],
  "provider": {
    "capriole-ai-openai": {
      "npm": "@ai-sdk/openai",
      "name": "Capriole AI OpenAI",
      "options": {
        "baseURL": "https://api.caprioletech.com/v1",
        "apiKey": "YOUR_CAPRIOLE_AI_API_KEY"
      },
      "models": {
        "openai/gpt-5.5": {
          "name": "GPT 5.5",
          "options": {
            "forceReasoning": true
          },
          "variants": {
            "minimal": {
              "reasoningEffort": "minimal",
              "reasoningSummary": "auto"
            },
            "low": {
              "reasoningEffort": "low",
              "reasoningSummary": "auto"
            },
            "medium": {
              "reasoningEffort": "medium",
              "reasoningSummary": "auto"
            },
            "high": {
              "reasoningEffort": "high",
              "reasoningSummary": "auto"
            },
            "xhigh": {
              "reasoningEffort": "xhigh",
              "reasoningSummary": "auto"
            }
          }
        },
        "openai/gpt-5.4-mini": {
          "name": "GPT 5.4 mini",
          "options": {
            "forceReasoning": true
          },
          "variants": {
            "minimal": {
              "reasoningEffort": "minimal",
              "reasoningSummary": "auto"
            },
            "low": {
              "reasoningEffort": "low",
              "reasoningSummary": "auto"
            },
            "medium": {
              "reasoningEffort": "medium",
              "reasoningSummary": "auto"
            },
            "high": {
              "reasoningEffort": "high",
              "reasoningSummary": "auto"
            },
            "xhigh": {
              "reasoningEffort": "xhigh",
              "reasoningSummary": "auto"
            }
          }
        }
      }
    },
    "capriole-ai-anthropic": {
      "npm": "@ai-sdk/anthropic",
      "name": "Capriole AI Anthropic",
      "options": {
        "baseURL": "https://api.caprioletech.com/v1",
        "authToken": "YOUR_CAPRIOLE_AI_API_KEY"
      },
      "models": {
        "claude-opus-4-8": {
          "name": "Opus 4.8",
          "variants": {
            "low": {
              "thinking": {
                "type": "adaptive",
                "display": "summarized"
              },
              "effort": "low"
            },
            "medium": {
              "thinking": {
                "type": "adaptive",
                "display": "summarized"
              },
              "effort": "medium"
            },
            "high": {
              "thinking": {
                "type": "adaptive",
                "display": "summarized"
              },
              "effort": "high"
            },
            "xhigh": {
              "thinking": {
                "type": "adaptive",
                "display": "summarized"
              },
              "effort": "xhigh"
            },
            "max": {
              "thinking": {
                "type": "adaptive",
                "display": "summarized"
              },
              "effort": "max"
            }
          }
        },
        "claude-opus-4-7": {
          "name": "Opus 4.7",
          "variants": {
            "low": {
              "thinking": {
                "type": "adaptive",
                "display": "summarized"
              },
              "effort": "low"
            },
            "medium": {
              "thinking": {
                "type": "adaptive",
                "display": "summarized"
              },
              "effort": "medium"
            },
            "high": {
              "thinking": {
                "type": "adaptive",
                "display": "summarized"
              },
              "effort": "high"
            },
            "xhigh": {
              "thinking": {
                "type": "adaptive",
                "display": "summarized"
              },
              "effort": "xhigh"
            },
            "max": {
              "thinking": {
                "type": "adaptive",
                "display": "summarized"
              },
              "effort": "max"
            }
          }
        }
      }
    }
  }
}

Run OpenCode

After replacing YOUR_CAPRIOLE_AI_API_KEY in the config, start OpenCode:
opencode
Use /models to select GPT 5.5, GPT 5.4 mini, Opus 4.8, or Opus 4.7. Use Ctrl+T to cycle model variants.

Supported models

OpenCode supports GPT 5.5, GPT 5.4 mini, Opus 4.8, and Opus 4.7 through Capriole AI. Use GPT 5.5 and Opus 4.8 for new setups.
  • openai/gpt-5.5
  • openai/gpt-5.4-mini
  • claude-opus-4-8
  • claude-opus-4-7

Troubleshooting

Why does OpenCode return an authentication error?

Confirm that both apiKey and authToken in ~/.config/opencode/opencode.json use your Capriole AI API key instead of YOUR_CAPRIOLE_AI_API_KEY.

Why do GPT requests fail?

Confirm that the GPT provider uses npm: "@ai-sdk/openai" and baseURL: "https://api.caprioletech.com/v1" so requests use the Responses API.

Why do Anthropic requests fail?

Confirm that the Anthropic provider uses npm: "@ai-sdk/anthropic", authToken, and baseURL: "https://api.caprioletech.com/v1".

Why don’t Capriole AI models appear?

Confirm that the model reference uses <providerId>/<modelId>, such as capriole-ai-openai/openai/gpt-5.5 or capriole-ai-anthropic/claude-opus-4-8, and that enabled_providers includes the Capriole AI providers while disabled_providers does not block them.

Why don’t model variants appear?

Confirm that you restarted OpenCode after updating ~/.config/opencode/opencode.json, then open /models and press Ctrl+T to cycle variants.

Why don’t config changes apply?

Check for project-level opencode.json or OPENCODE_CONFIG overrides, then restart OpenCode.

Why do provider initialization or provider package errors appear?

For ProviderInitError, verify the provider config first. For provider package errors, clear ~/.cache/opencode and restart OpenCode so provider packages are reinstalled.

Notes