Skip to content
opencode logo (SST)

opencode via Tokonomix

Add Tokonomix as a provider in opencode.json — drive the terminal agent with 130+ models and consensus on one key.

@ai-sdk/openai-compatibleTerminal coding agentMIT · open sourcemacOS · Windows · Linux
opencode — open-source terminal coding agent, via Tokonomix

What is opencode?

opencode (by SST) is an open-source AI coding agent for the terminal. It is provider-agnostic by design: any model in the catalogue — or a custom provider you declare in opencode.json — can drive it, including any OpenAI-compatible endpoint via the AI SDK.

  • A terminal-native agent that plans, edits and runs commands across your project.
  • Declares custom providers in opencode.json using @ai-sdk/openai-compatible.
  • Reads API keys via {env:VAR} references — secrets stay out of the config file.
  • Open source and model-agnostic.

Why route opencode through Tokonomix?

  • One provider entry, 130+ models — pick tokonomix-consensus or any direct slug.
  • Reach for consensus on the hard turns; a fast model for routine edits.
  • Per-call spend caps bound an agentic session; region / origin routing for compliance.
  • Keep your key in an env var via the {env:…} reference.

Connect Tokonomix in opencode.json

Add a provider entry that uses the @ai-sdk/openai-compatible package, with the Tokonomix baseURL and an {env:…} key reference.

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "tokonomix": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Tokonomix",
      "options": {
        "baseURL": "https://tokonomix.ai/api/v1",
        "apiKey": "{env:TOKONOMIX_API_KEY}"
      },
      "models": {
        "tokonomix-consensus": { "name": "Tokonomix Consensus" }
      }
    }
  }
}

Verify it works

  • Export TOKONOMIX_API_KEY, save opencode.json, and start opencode.
  • Select the Tokonomix model and run a small task.
  • Confirm the call and token usage in your Tokonomix dashboard.

Model selection

Which model and endpoint should my agent use?

Pick by what your agent does, then swap the model id any time — every model in the catalog works through the same key.

What your agent doesUse this
Edits files / calls tools and streams responses (most coding agents)An Anthropic model via the Anthropic endpoint (tools + streaming both work)
Calls tools but does not need streaming (any model)The OpenAI-compatible endpoint with a single model id
Wants tools and streaming on a non-Anthropic modelRun non-streaming for now — streaming tool-calls on other providers is not enabled yet
Plain chat, no toolsEither endpoint; streaming is fine
Wants a cross-model verdict (consensus) on a high-stakes answerSet model to tokonomix-consensus on the OpenAI-compatible endpoint — note: consensus rejects tool requests (no tool-calling)
Endpoint & API reference (technical)

anthropic-messages → https://tokonomix.ai/api/anthropic — tools ✓, streaming ✓ (use an Anthropic model). openai-completions → https://tokonomix.ai/api/v1 — tools ✓ (single-model passthrough), streaming with tools not yet enabled. Plain chat: streaming works on both. Consensus: openai-completions, model tokonomix-consensus, no tools. Swap the model id to any slug returned by GET /api/v1/models.

Browse all models →

Related agents