Skip to content

What you need

  • Base URL: https://api.smouter.ai/v1 — the /v1 suffix matters; leaving it off is the most common setup failure.
  • API key: an sk-smouter-… secret from API keys. It is shown once at creation — if you lost it, create a new key.
  • Model id: copied exactly from the live catalog (or GET /v1/models). Ids are matched verbatim — no vendor prefixes, no renaming.

Point OpenCode at Smouter

OpenCode takes custom providers through its JSON config, using the AI SDK's @ai-sdk/openai-compatible package under the hood.

  1. Create opencode.json in your project (or the global config) with a smouter provider as below.
  2. List every catalog model you want under models, keyed by the exact id.
  3. Export SMOUTER_API_KEY, start opencode, and choose the model with the /models command — entries appear as smouter/<model-id>.
// ./opencode.json (per project) or ~/.config/opencode/opencode.json (global){  "$schema": "https://opencode.ai/config.json",  "provider": {    "smouter": {      "npm": "@ai-sdk/openai-compatible",      "name": "Smouter",      "options": {        "baseURL": "https://api.smouter.ai/v1",        "apiKey": "{env:SMOUTER_API_KEY}"      },      "models": {        "<model-id>": { "name": "<model-id> (Smouter)" }      }    }  }}

The smouter/ prefix is OpenCode's own addressing — provider-key/model-key, where smouter is just the key you chose for the provider block. OpenCode strips it before sending, so the request reaches Smouter with the bare catalog id — which is why the keys under models must match the catalog exactly.

Every OpenCode surface reads this same config, so the provider follows you if you use OpenCode outside the terminal — desktop or web clients included. One catch for the desktop app: an app launched from the dock never sees shell exports, so {env:SMOUTER_API_KEY} resolves empty there. Store the key with opencode auth login instead (choose "Other", provider id smouter, paste the key) — OpenCode keeps it in its own credential store and injects it no matter how the app was launched.

Verify outside the tool first

Two commands separate a Smouter problem from a tool problem. If both succeed, your key, credit, and model id are fine — whatever remains is the tool's configuration.

# Which model ids can I use right now? (no auth needed)curl -s https://api.smouter.ai/v1/models | jq -r '.data[].id'

If it doesn't work

  • Base URL wrong or missing /v1. OpenAI-style tools need exactly https://api.smouter.ai/v1 — no trailing /chat/completions, no bare api.smouter.ai. Anthropic-style tools (Claude Code) use https://api.smouter.ai with no suffix.
  • 401 auth — the key was pasted wrong, expired, or revoked. Secrets are shown once; create a fresh key in API keys and paste it whole, including the sk-smouter- prefix.
  • 402 insufficient_quota — your wallet or a per-key cap can't cover the request. Top up in Billing or raise the key's cap.
  • 404 model_not_found — the id doesn't match the catalog. Copy it verbatim from the catalog; ids are case-sensitive and carry no openai/-style prefix (where a tool requires one, the tool strips it before sending).
  • 429 — a rate or tokens-per-minute window is exhausted. Honor retry-after; per-key TPM is adjustable in API keys.
  • Scoped key. If the key has a model allowlist, every model the tool may call — including fallbacks — must be on it. When in doubt, test with an unscoped key.
  • The tool's UI moved. Settings get renamed; the three constants don't. Any field asking for an OpenAI(-compatible) base URL, key, and model name takes the values above.

Still stuck? Open a ticket with the request's x-request-id (or the error body) and we'll trace it — or email support@smouter.ai.