Skip to content

OpenCode

OpenCode can use an OpenAI-compatible provider. Configure a provider that points to R9S and authenticate with your R9S API key.

Terminal window
export R9S_API_KEY="<R9S_API_KEY>"

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"
}
}
}
}
}

Launch OpenCode:

Terminal window
opencode

Then run:

/connect

Use R9S as the provider name and paste your R9S API key when prompted.

In OpenCode, open the model picker:

/models

Select gpt-5-codex, claude-sonnet-4.5, or another model listed in your R9S provider config.

SymptomCheck
Authentication errorConfirm the R9S provider key saved by OpenCode is your R9S API key.
Model not foundConfirm the model name exists in R9S and is listed in the provider config.
Requests go to a different providerConfirm the selected model comes from the R9S provider.