Find a model

Browse the full catalog →

Quick start

OpenCode lists TrustedRouter as a built-in provider.

  1. Create a key in Console → API Keys; TrustedRouter inference keys start with sk-tr-.
  2. Run /connect in OpenCode, choose TrustedRouter, and paste the key.
  3. Run /models and choose trustedrouter/trustedrouter/zdr.
/connect
/models

TrustedRouter gives OpenCode one key across 600+ models and 100+ providers, provider fallback and per-key spend limits.

OpenCode documentation and catalog checked . Inference base URL: https://api.trustedrouter.com/v1.

Set a TrustedRouter API key in OpenCode

Use /connect to save a key, or set TRUSTEDROUTER_API_KEY on the OpenCode server process.

MethodCommand
TUI/connect → TrustedRouter → API key
CLI key methodopencode auth login trustedrouter --method key
Standalone environmentTRUSTEDROUTER_API_KEY="YOUR_KEY" opencode --standalone
Shared service environmentopencode service set env TRUSTEDROUTER_API_KEY YOUR_KEY
Verify connectionsopencode auth list

A saved account wins over an environment connection for the same integration. V2 saves credentials in the server's SQLite database, usually ~/.local/share/opencode/opencode.db, and imports supported credentials from 1.x's ~/.local/share/opencode/auth.json. Use opencode debug paths db to find the actual V2 path. See OpenCode connections.

OpenCode itself does not require an OpenCode key; you connect a provider key, here a TrustedRouter key.

TrustedRouter models in OpenCode

TrustedRouter appears in OpenCode's catalog with seven built-in aliases; any other catalog model is added with a few lines of config.

SelectorWhat it routes toTrustedRouter context tokens
trustedrouter/trustedrouter/autoBroad model pool with provider fallback.1,048,576 tokens
trustedrouter/trustedrouter/cheapPaid model pool ordered by input plus output prices.1,048,576 tokens
trustedrouter/trustedrouter/e2eRoutes requiring verified confidential compute, provider E2EE and explicit ZDR.1,048,576 tokens
trustedrouter/trustedrouter/fastExplicit Cerebras model pool for speed-oriented routing.131,072 tokens
trustedrouter/trustedrouter/synthMultiple model candidates combined into one synthesized answer.200,000 tokens
trustedrouter/trustedrouter/synth-codeCode-tuned multi-model synthesis.200,000 tokens
trustedrouter/trustedrouter/zdrRoutes restricted to zero data retention providers.1,048,576 tokens

models.dev lists 1,000,000 context tokens for each alias as of the check date. fast, synth and synth-code have lower served limits and need the override below; the others are at or above the catalog figure and need none. This context-only override is V2 only: the 1.x model limit requires both context and output, and TrustedRouter publishes no alias output limit. See the OpenCode schema.

Alias context limit overrides — OpenCode V2

{
  "$schema": "https://opencode.ai/config.json",
  "model": "trustedrouter/trustedrouter/fast",
  "providers": {"trustedrouter": {"models": {
    "trustedrouter/fast": {"limit": {"context": 131072}},
    "trustedrouter/synth": {"limit": {"context": 200000}},
    "trustedrouter/synth-code": {"limit": {"context": 200000}}
  }}}
}

Why is it trustedrouter/trustedrouter/zdr?

The first trustedrouter is OpenCode's provider ID. Everything after the first slash, trustedrouter/zdr, is the model ID sent to TrustedRouter.

Run opencode models in the shell to list models, or use /models in the TUI. See OpenCode model selection and configuration locations and precedence.

Add any TrustedRouter model

Save configuration in your project's opencode.jsonc or opencode.json, or globally under ~/.config/opencode/; see OpenCode configuration.

Add deepseek/deepseek-v4.1-flash to the built-in provider's models map; its package, endpoint and connection still apply.

The TrustedRouter catalog gives this model 1,048,576 context tokens and 393,216 output tokens. Use the option matching your installed OpenCode generation.

OpenCode V2 — minimal model addition

{
  "$schema": "https://opencode.ai/config.json",
  "model": "trustedrouter/deepseek/deepseek-v4.1-flash",
  "providers": {
    "trustedrouter": {
      "models": {
        "deepseek/deepseek-v4.1-flash": {
          "limit": {
            "context": 1048576,
            "output": 393216
          },
          "name": "DeepSeek V4.1 Flash"
        }
      }
    }
  }
}

OpenCode 1.x — minimal model addition

{
  "$schema": "https://opencode.ai/config.json",
  "model": "trustedrouter/deepseek/deepseek-v4.1-flash",
  "provider": {
    "trustedrouter": {
      "models": {
        "deepseek/deepseek-v4.1-flash": {
          "limit": {
            "context": 1048576,
            "output": 393216
          },
          "name": "DeepSeek V4.1 Flash"
        }
      }
    }
  }
}

The provider configuration reference documents adding models to an existing catalog provider.

OpenCode custom provider config for TrustedRouter: V2 and 1.x

Choose the option matching your installed generation when defining the full provider.

OpenCode V2 — full custom provider

{
  "$schema": "https://opencode.ai/config.json",
  "model": "trustedrouter/deepseek/deepseek-v4.1-flash",
  "providers": {
    "trustedrouter": {
      "env": [
        "TRUSTEDROUTER_API_KEY"
      ],
      "models": {
        "deepseek/deepseek-v4.1-flash": {
          "limit": {
            "context": 1048576,
            "output": 393216
          },
          "name": "DeepSeek V4.1 Flash"
        }
      },
      "name": "TrustedRouter",
      "package": "@opencode/ai/providers/openai-compatible",
      "settings": {
        "baseURL": "https://api.trustedrouter.com/v1"
      }
    }
  }
}

For V2, set the environment variable on the server or use /connect with the custom provider. The env declaration identifies the credential variable.

OpenCode 1.x — full custom provider

{
  "$schema": "https://opencode.ai/config.json",
  "model": "trustedrouter/deepseek/deepseek-v4.1-flash",
  "provider": {
    "trustedrouter": {
      "models": {
        "deepseek/deepseek-v4.1-flash": {
          "limit": {
            "context": 1048576,
            "output": 393216
          },
          "name": "DeepSeek V4.1 Flash"
        }
      },
      "name": "TrustedRouter",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "{env:TRUSTEDROUTER_API_KEY}",
        "baseURL": "https://api.trustedrouter.com/v1"
      }
    }
  }
}

The 1.x form uses npm, options.baseURL and options.apiKey. An unset TRUSTEDROUTER_API_KEY makes {env:TRUSTEDROUTER_API_KEY} an empty string. See variable substitution and the generation mapping.

1.x keyV2 key
providerproviders
npmpackage
optionssettings

Which alias should I choose for coding?

Start with trustedrouter/cheap for inexpensive trials, trustedrouter/zdr for ZDR routes, or trustedrouter/synth-code for code-tuned synthesis.

Use trustedrouter/e2e when all eligible routes must provide verified confidential compute, provider E2EE and explicit ZDR. Synth makes several model calls per request, so it costs more than a single-model request. See agent setup and Synth.

Keep the agent's bill bounded

Create a dedicated key with daily and monthly limits, budget_strict: true and budget_alert_only: false.

Strict mode counts outstanding estimates; actual charges can exceed an estimate. See spend controls and cheaper models, caching and Batch.

Switch OpenCode from OpenRouter to TrustedRouter

To use TrustedRouter as an OpenRouter alternative for OpenCode, connect TrustedRouter, add the model above, then change the provider prefix; the model slug after the provider prefix is unchanged.

OpenRouter — V2

{"$schema":"https://opencode.ai/config.json","model":"openrouter/deepseek/deepseek-v4.1-flash"}

TrustedRouter — V2, after the model addition

{"$schema":"https://opencode.ai/config.json","model":"trustedrouter/deepseek/deepseek-v4.1-flash"}
DetailOpenRouterTrustedRouter
Built-in OpenCode models, checked November 24, 2026373Seven aliases
Catalog runtime package@openrouter/ai-sdk-provider@ai-sdk/openai-compatible; V2 native custom form above uses @opencode/ai/providers/openai-compatible
Standard fee5.5% on purchased credits, $0.80 minimum; 8% on Business5.5% markup inside token prices; separate payment processing on credit purchases
Privacy routingZDR parameter and account settings filter by provider policy.trustedrouter/zdr selects ZDR routes; trustedrouter/e2e requires verified confidential compute, provider E2EE and explicit ZDR.
Gateway verificationClosed-source gateway; SOC 2 Type 2 assurance.Source-available gateway with live hardware attestation on three clouds.
Spend controlsWorkspace and Guardrails budget controls.Dedicated per-key daily, weekly and monthly limits; strict mode includes outstanding estimates. Actual charges can exceed estimates.
SwitchingBoth can stay connected; use /models to switch.

Staying on OpenRouter is the better choice when its 373 built-in entries cover your needs and you want no model configuration.

Sources: privacy routing and gateway verification comparison, strict per-key limits, OpenCode catalog, OpenRouter pricing, minimum fee, TrustedRouter and gateway fees. OpenRouter's own guide still shows the 1.x provider.openrouter.models shape.

Test the key and base URL

Send one small request to verify authentication and routing.

curl https://api.trustedrouter.com/v1/chat/completions \
  -H "Authorization: Bearer $TRUSTEDROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek/deepseek-v4.1-flash","messages":[{"role":"user","content":"Reply with PONG only."}],"max_tokens":16}'

OpenCode API key not working

Check the saved account first, then the server environment and installed configuration generation.

SymptomFix
Key belongs to a different providerConnect a TrustedRouter key under TrustedRouter; a DeepSeek or OpenRouter key belongs to that provider's connection.
Shared service still has the old keyopencode service set env TRUSTEDROUTER_API_KEY YOUR_KEY stops the running service; the next command starts it with the new value. See OpenCode connections.
New environment key ignoredA saved account outranks the environment variable. Inspect opencode auth list and manage the saved account with /connect.
Empty API keyAn unset {env:NAME} becomes an empty string. The V2 full form uses env plus a connection instead of substituting settings.apiKey.
404 or wrong endpointUse https://api.trustedrouter.com/v1 as the base URL; append /chat/completions only for curl.
Model missingAdd the exact catalog ID under the provider's models map, then run opencode models.
Hand-migrated 1.x config failsV2 renames provider/npm/options to providers/package/settings. An AI SDK package needs the aisdk: prefix, such as aisdk:@ai-sdk/openai-compatible; a native OpenCode package does not. See migration notes.

For direct DeepSeek and OpenRouter routes, use DeepSeek in OpenCode: three routes.

Questions

How do I connect a TrustedRouter API key in OpenCode?

Create a key at Console → API Keys, run /connect, choose TrustedRouter, enter the key, then run /models. A saved account takes precedence over TRUSTEDROUTER_API_KEY in the server environment.

Why is the OpenCode selector trustedrouter/trustedrouter/zdr?

The first trustedrouter is the OpenCode provider ID. Everything after the first slash is the TrustedRouter model ID, trustedrouter/zdr.

Workspace access

Sign in

Choose a sign in method to access your TrustedRouter workspace.

New to TrustedRouter?

By continuing you agree to the terms of service and privacy policy.