Documentation
On this page

Connect OpenCode to CyberRouter

Connect OpenCode to CyberRouter with your account key and an enhanced model.

Prepare your connection

Use your CyberRouter models in OpenCode for code review, explanations, and development work. OpenCode connects to your CyberRouter account, which uses your saved provider keys and applies your account’s usage fee.

  1. Sign in and create an application key on API Keys.
  2. Connect a provider that serves your chosen model, and check your CyberRouter credits.
  3. Set CYBERROUTER_API_KEY in the environment where you start OpenCode. Use your CyberRouter application key here; your upstream provider key stays in CyberRouter.

Install OpenCode using its official instructions. Check opencode --version before choosing a configuration format below.

Build your OpenCode configuration

Choose your OpenCode version and a model, then merge this configuration into your project’s opencode.json. Keep any existing settings you need.

The base URL follows this browser’s CyberRouter connection and includes /v1. When OpenCode runs on another machine or inside a container, replace a localhost address with the reachable CyberRouter address.

Starter settings use text input, up to 32,768 context tokens and 4,096 output tokens. These are conservative client budgets. Adjust them using your model’s endpoint limits and allow room for added CyberRouter context. Tool support depends on the selected provider endpoint.

Check your context budget before increasing the starter limits. Include loaded tool definitions and any security context added by CyberRouter.

Configuration formats follow OpenCode’s v1 custom-provider guide and v2 provider guide. The generated configuration references an environment variable and contains no account key.

Select your model in OpenCode

Start OpenCode from the configured project, run /models, and select the model under CyberRouter. The configuration also sets it as the default. OpenCode’s reference starts with cyberrouter/; the model ID sent to our API retains the :cyberrouter suffix.

To offer more models in OpenCode’s picker, add their entries to the same models object. The configuration does not automatically import the whole CyberRouter catalog. Keep only one top-level default model.

Start with a simple request such as “Explain the purpose of this README.” Find the resulting request and service fee on Usage. OpenCode executes its own local tools and manages its own permissions; CyberRouter handles model requests, routing, and billing.

Troubleshooting

SymptomWhat to check
CyberRouter missing from /modelsUse the configuration format matching your OpenCode version. Confirm the config file is in the project and the key environment variable is available to the OpenCode process.
401 authentication errorUse an active CyberRouter application key. A provider key or website login does not authenticate the OpenCode process.
402 payment requiredCheck available CyberRouter credits and account/key spending limits. Your upstream provider also needs sufficient balance.
No eligible endpointsConnect a provider that serves this exact model and review any routing restrictions.
404, HTML response, or JSON parse errorCheck the API host and /v1 base path. Choose the OpenAI-compatible chat package shown above; CyberRouter exposes /chat/completions.
Context too large or unsupported parametersReduce context/output budgets and check the serving endpoint’s supported parameters.

Accessibility

Adjust how CyberRouter looks and moves. Preferences apply to this browser.

You can also use your browser’s zoom controls.

Accessibility help

Analytics preferences

Choose anonymous page counts or optional visit, scroll and reading-time analytics. Privacy details.