Guides

OpenCode

OpenCode (terminal and desktop) reads provider configuration from opencode.json, using the @ai-sdk/openai-compatible package for any custom OpenAI-compatible endpoint — the same config file works for both the CLI and the desktop app. Add Tempr once and every model on your allowlist — Claude, GPT, Gemini — shows up under it, all through one key.

  1. Create a virtual key

    In the Portal, create a Gateway virtual key. Keys are prefixed tvk_ and shown once at creation.

  2. Add a provider key

    Gateway is BYOK: add a key for at least one provider from the supported list.

  3. Add Tempr as a provider

    Create or edit opencode.json (project root or ~/.config/opencode/opencode.json):

{
  "provider": {
    "tempr": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Tempr Gateway",
      "options": {
        "baseURL": "https://api.temprhq.io/v1",
        "apiKey": "tvk_..."
      },
      "models": {
        "anthropic/claude-sonnet-4-5": {
          "name": "Claude Sonnet 4.5 (via Tempr)"
        }
      }
    }
  }
}

Model ids

Add one entry per model under models, keyed by the fully-qualified provider/model form (e.g. anthropic/claude-sonnet-4-5, openai/gpt-5) — the same ids GET /v1/models returns.

What's next