// integration

OpenCode with teamToken

OpenCode declares providers in its JSON config, and teamToken goes in as an ordinary OpenAI-compatible one. The key never lands in the file; it is substituted from the environment, so the config can live in dotfiles under git.

What the tool is

OpenCode is a terminal agent for working on code. Providers are declared in its config rather than picked from a built-in list, so there is nothing to wait for.

The config

The file sits at ~/.config/opencode/opencode.json. If you already have one, the provider block merges into it rather than replacing it.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "teamtoken": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "TeamToken",
      "options": {
        "baseURL": "https://api.teamtoken.store/v1",
        "apiKey": "{env:TEAMTOKEN_KEY}"
      },
      "models": { "gpt-5.6-sol": {}, "gpt-5.3-codex": {}, "gemini-3.1-pro": {} }
    }
  }
}
export TEAMTOKEN_KEY="<your key>"

The key stays out of the file, which matters more than it looks

{env:TEAMTOKEN_KEY} means substitution from the environment at launch. The key itself never enters the JSON.

That is not a cosmetic difference. An OpenCode config usually lives in dotfiles, dotfiles usually live in a repository, and a key written as a literal travels there with them. With environment substitution the file is safe to commit without thinking about it.

Models are switched by command, not in the config

Whatever is listed under models becomes available, and switching happens with /models inside the tool. Changing model does not mean editing the config; listing the ones you want once is enough.

Names have to match the catalog exactly. GET /v1/models returns the full list on the same key; the example above carries three usual suspects for code work.

Spend caps per key

A terminal agent runs long sessions and reaches for the model without asking. A dollar ceiling sits on the key, separately from the shared balance, and a session cannot exceed it.

When it does not work

The provider does not show up
Check that the block went inside provider rather than beside it, and that the JSON is still valid after the edit.
Authorisation error
TEAMTOKEN_KEY has to be visible to the process. The {env:…} substitution reads the launching environment, not a profile file you edited in another window.
A model is missing from /models
Then it is missing from models in the config. Nothing is fetched automatically; models are listed explicitly.
Related
ClineCodex CLIZed
Get an API key