OpenCode

A terminal coding agent that takes a custom provider block in opencode.json.

Setup

Point OpenCode at Tium

You need the base URL https://api.tium.ai/v1 and an API key from your dashboard. Keys are shown once at creation.

  1. 1.Add the provider block to opencode.json

    OpenCode reads custom providers from its config file. This block names the gateway and the models it should offer.

    opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "tium": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Tium",
          "options": {
            "baseURL": "https://api.tium.ai/v1"
          },
          "models": {
            "glm-5.3-flash": {
              "name": "GLM-5.3 Flash",
              "limit": {
                "context": 1000000,
                "output": 32768
              }
            }
          }
        }
      }
    }
    Add this to opencode.json, then run /connect, choose tium, and paste your key. The key is stored separately in ~/.local/share/opencode/auth.json; it never goes in this file.
  2. 2.Authenticate with /connect

    Run /connect, choose tium, and paste your key. The key is stored in ~/.local/share/opencode/auth.json, separately from the config; it never goes in the file above.

Worth knowing

What OpenCode gets wrong

Tool-specific behaviour that surprises people, and what to do about it.

context is what OpenCode compacts against

OpenCode uses limit.context to decide when to summarise and drop history. The value in the block is the served ceiling, deliberately set at or below what we actually serve, because overstating it fails a session mid-edit rather than at setup.

Elsewhere

Other tools

The same base URL and key work anywhere that takes an OpenAI-compatible endpoint.