A practical OpenCode configuration path
OpenCode and similar clients normally need a provider, base URL, API key, and model. Keep those values explicit and test the complete request path before enabling tools.
Minimal setup
- Create a relay.fast API key.
- Choose an OpenAI-compatible provider in OpenCode.
- Set
https://relay.fast/v1as the base URL. - Choose a model from
/v1/modelsand send a short test request.
Keep costs predictable
Set context and output limits where the client supports them, inspect token usage, and avoid unbounded agent loops. Compare the resulting workload against the live pricing catalog rather than a single prompt.
One-command setup
The script configures OpenCode for relay.fast. It adds a relay.fast provider with every chat model your key can use and keeps the key in an environment variable. It asks for the API key inside the script, so the key never appears in the command or shell history. Every downloaded file is checked against a published SHA-256 checksum, and running it again can restore the previous settings.
Windows (PowerShell):
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://relay.fast/downloads/setup/install-opencode-en.ps1 | iex"macOS and Linux:
curl -fsSL https://relay.fast/downloads/setup/install-opencode-en.sh | bashYou can read the script before running it by opening the same URL in a browser.
Current prices of models for coding agents
Prices checked from the live catalog. "From" is the lowest price among the relay.fast sources that currently serve the model. The price you pay depends on the source your request uses and can change on any day. The pricing page always shows current values.
| Model | Model ID | Official input / output per 1M tokens | relay.fast from, input / output | Cache read from | Context |
|---|---|---|---|---|---|
| Claude Sonnet 5.5 | claude-sonnet-5-5 | $2 / $10 | $0.238 / $1.19 (−88%) | $0.0238 | 1M |
| Claude Opus 5.5 | claude-opus-5-5 | $4 / $20 | $0.111 / $0.556 (−97%) | $0.00556 | 1M |
| GPT-6.1 Sol requests above 272K input tokens cost more | gpt-6.1-sol | $2 / $10 | $0.03 / $0.15 (−98%) | $0.0015 | 1.05M |
| GLM-5.3 | glm-5.3 | $1.4 / $4.4 | $0.035 / $0.11 (−97%) | $0.0065 | 1M |
| Kimi K3 | kimi-k3 | $3 / $15 | $0.15 / $0.75 (−95%) | $0.015 | 1.05M |
| DeepSeek V4.1 Flash price depends on the time of day; the peak-hours price is shown | deepseek-v4.1-flash | $0.3 / $1.2 | $0.03 / $0.12 (−90%) | $0.0006 | 1M |
Frequently asked questions
Can I use a Claude model in OpenCode?
Use the Anthropic-compatible provider mode if your OpenCode version supports it and the model is enabled for your account.
Why does OpenCode return an auth error?
Check the base URL, key scope, endpoint family, and whether a proxy or shell environment is replacing the value.
Is OpenCode affiliated with relay.fast?
No. It is a separate client. This page documents a compatible connection pattern.