OpenCode
OpenCode is an open-source coding agent for the terminal. One command signs it in to Synthorai: OpenCode gets an API key of its own and a Synthorai provider that lists the models that key may call. There is no key to copy and no config file to edit.
Step 1 - Sign in
opencode auth login https://synthorai.io OpenCode reads https://synthorai.io/.well-known/opencode and runs the sign-in command it names. That command prints a link and an 8-letter code such as BCDF-GHJK, then opens your browser.
Sign in to the console, check that the code on the page matches the one in your terminal, choose how long the key lasts (7, 30 or 90 days; the default is 90) and click Allow. The terminal prints Signed in and OpenCode stores the new key.
The sign-in command needs sh and curl, so it runs on macOS, Linux, WSL and Git Bash. On native Windows, set the provider up by hand with an API key.
Over SSH the command does not open a browser: open the link on another device and sign in there. Set SYNTHORAI_NO_BROWSER=1 to get the same behavior on your own machine.
Step 2 - Pick a model
opencode
# then, inside OpenCode:
/models Start OpenCode and type /models. The Synthorai provider lists the models your key may call, with their context limits and prices. OpenCode refreshes the list each time it starts.
Each model is called over the protocol that suits it, with nothing to set: Claude models over the Anthropic Messages API (so prompt caching keeps working), OpenAI models over the Responses API, and all other models over Chat Completions.
The key OpenCode uses
The key appears on the API keys page of the console as OpenCode · …, followed by where you signed in from, with the label Agent sign-in. You can delete it there at any time.
When the key expires, calls fail with a message that tells you to run opencode auth login https://synthorai.io again.
Security
- Approve only a code you started yourself. When the sign-in request comes from a different network than your browser, the confirmation page warns you.
- If the workspace has Approve new IPs turned on (Settings › Security), the address you signed in from is trusted for the new key automatically when you allow the sign-in from the same network, and calls from any other address wait for approval. Allowed from another network, the address is not trusted: approve it when its first call is held. If the setting is off, consider turning it on.
Local config wins
If your local opencode.json defines a provider named synthorai, OpenCode uses it instead of the one from the gateway, because local config overrides remote config.
Manual setup (Windows without sh)
Create a key on the API keys page of the console, put it in the SYNTHORAI_API_KEY environment variable, and add this provider to opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"synthorai": {
"npm": "@ai-sdk/openai-compatible",
"name": "Synthorai",
"options": {
"baseURL": "https://synthorai.io/v1",
"apiKey": "{env:SYNTHORAI_API_KEY}"
},
"models": {
"claude-sonnet-5-5": { "name": "Claude Sonnet 5.5" }
}
}
}
} List under models each model you want to pick in OpenCode. The IDs are on the models page.
Troubleshooting
Failed to load auth provider metadata Check the address: it is https://synthorai.io, with no path after it.
Sign-in did not complete: the login was declined in the console The request was declined on the confirmation page. Run the command again to start over.
The code has expired Codes last 10 minutes. Run opencode auth login https://synthorai.io again for a new one.
For limits, expiry and deleting keys, see API Keys.