Edgee CLI setup (recommended)
The fastest way to connect OpenCode to Edgee is the CLI. It authenticates, merges an Edgee provider into your OpenCode config (populated from the live Edgee model catalog), and starts OpenCode, no config file to edit by hand.1
Install the Edgee CLI
- macOS / Linux
- Homebrew (macOS)
- Windows (PowerShell)
2
Launch OpenCode through Edgee
edgee provider, and starts OpenCode. Token compression is enabled automatically. Pick an Edgee model from OpenCode’s model picker.Model context windows and pricing
Each model the CLI writes into theedgee provider carries its context window and its per-million-token rates, read from the Edgee model catalog:
0 for a config-defined model. Without limit, its context gauge and auto-compaction have nothing to measure against; without cost, every session reports as free.
Details on what the CLI emits:
limit.contextcomes from the catalog. When a model is served by several LLM providers with different windows, the value is the author’s own provider entry, or the smallest declared window when the author doesn’t serve it — overstating the window makes the agent compact too late and the request gets rejected.limit.outputis always32000. OpenCode clamps every request’smax_tokensto its own 32k ceiling anyway, and its schema requiresoutputwheneverlimitis set.costis in US dollars per million tokens, the same unit as OpenCode’s own catalog. A model that is genuinely free gets zeroed rates rather than an omittedcost.- Tiered long-context pricing is not emitted. The catalog carries a premium above 200k tokens for a few models (Claude Sonnet 4.5 goes to 22.50 there), and OpenCode’s config schema has a
cost.context_over_200kslot, but its config merge drops that field — it survives only on the models.dev path. Declaring it would imply a tier that never takes effect. - Models the catalog has no entry for keep working; they just ship without
limitorcost. The fetch is best-effort — if it fails, launch continues with no declared metadata.
Manual setup (advanced)
Prefer to configure OpenCode yourself? Open or create~/.config/opencode/opencode.json and add the following configuration:
"sk-edgee-..." with your actual Edgee API key.
Model ids use the provider/model form the Edgee catalog exposes. limit and cost are optional, but a model without them gets no context gauge, no auto-compaction, and a $0 cost readout — the same reason edgee launch opencode declares them for you. Keep limit.output at 32000: OpenCode clamps max_tokens to that ceiling regardless.
Usage
Once configured, you can select the configured models directly within the OpenCode CLI interface. When you launch OpenCode, you will be able to choose from the models you defined in themodels section of your configuration (e.g., “mistral small (edgee)”, “gpt-4 (edgee)”, etc.).
Authentication
Edgee uses standard Bearer token authentication. Your API key configured inopencode.json is automatically used to authenticate requests to the Edgee API.
Token compression is only available when routing through Edgee. You can use your own provider keys via BYOK — compression still applies as long as requests go through Edgee.
Benefits of Using OpenCode with Edgee
Unified Infrastructure
Access all LLM providers through Edgee while using OpenCode’s developer-friendly CLI.
Cost Control
Leverage Edgee’s cost tracking and routing while building applications with OpenCode.
Reliability
Combine OpenCode’s agent capabilities with Edgee’s automatic failover and load balancing.
Observability
Monitor your OpenCode sessions with Edgee’s built-in observability features.
Next Steps
- Explore OpenCode’s documentation for more features
- Set up observability to monitor your OpenCode sessions