Connect AI1API to OpenCode
OpenCode can use an OpenAI-compatible provider configuration, making it easy to switch between supported models.
Prerequisites
- OpenCode is installed
- An API Key exists
Setup steps
Step 1: Create opencode.json
Create opencode.json in the OpenCode project configuration directory and replace the placeholder with your key. The console can generate this file.
opencode.json
{
"provider": {
"ai1api": {
"options": {
"baseURL": "https://ai1api.com/v1",
"apiKey": "sk-your-key"
}
}
}
}Step 2: Choose a model and start
Start OpenCode, select the ai1api provider, and choose a model available to the key's group. Use the live pricing page as the source of truth.
Verify the connection
Start with the smallest request, then enable streaming and tools after the connection works.
Verification
opencodeNotes
- Use the complete model ID shown by live pricing.
- Disable the old key in the console before replacing it locally.