OpenCode
OpenCode can use an OpenAI-compatible provider. Configure a provider that points to R9S and authenticate with your R9S API key.
Environment Variables
Section titled “Environment Variables”export R9S_API_KEY="<R9S_API_KEY>"Configure Provider
Section titled “Configure Provider”Add an R9S provider to your OpenCode configuration:
{ "$schema": "https://opencode.ai/config.json", "provider": { "r9s": { "npm": "@ai-sdk/openai-compatible", "name": "R9S", "options": { "baseURL": "https://api.r9s.ai/" }, "models": { "gpt-5-codex": { "name": "GPT-5 Codex" }, "claude-sonnet-4.5": { "name": "Claude Sonnet 4.5" } } } }}Connect API Key
Section titled “Connect API Key”Launch OpenCode:
opencodeThen run:
/connectUse R9S as the provider name and paste your R9S API key when prompted.
Run OpenCode
Section titled “Run OpenCode”In OpenCode, open the model picker:
/modelsSelect gpt-5-codex, claude-sonnet-4.5, or another model listed in your R9S provider config.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Check |
|---|---|
| Authentication error | Confirm the R9S provider key saved by OpenCode is your R9S API key. |
| Model not found | Confirm the model name exists in R9S and is listed in the provider config. |
| Requests go to a different provider | Confirm the selected model comes from the R9S provider. |