Home / Docs / OpenCode

OpenCode

Point the open-source terminal coding agent at the gateway.

OpenCode supports custom providers through its config file, using the OpenAI-compatible surface.

{
  "provider": {
    "claudeapikey": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://aiprimetech.io/v1",
        "apiKey": "sk-your-key"
      },
      "models": {
        "claude-sonnet-4-6": {"name": "Claude Sonnet 4.6"},
        "claude-opus-4-8": {"name": "Claude Opus 4.8"}
      }
    }
  }
}

Config lives at ~/.config/opencode/opencode.json or opencode.json in the project root. Restart OpenCode and select the provider.

OpenCode is under fast development and its config schema moves. If the block above is rejected, check the provider section of OpenCode's own docs — the values you need are always base URL https://aiprimetech.io/v1, your key, and exact model ids.