Use ApexApi in OpenCode
OpenCode is an open-source coding agent for the terminal and desktop. Add ApexApi as a custom provider once and every model you list from our catalog shows up in its model picker.
1. Get your API key
Create a key in your dashboard. It starts with ak-.
2. Export your key
export APEXAPI_API_KEY=ak-your-key-here3. Add ApexApi to opencode.json
Edit ~/.config/opencode/opencode.json (or a project-level opencode.json) and add:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"apexapi": {
"npm": "@ai-sdk/openai-compatible",
"name": "ApexApi",
"options": {
"baseURL": "https://api.apexapi.dev/v1",
"apiKey": "{env:APEXAPI_API_KEY}"
},
"models": {
"anthropic/claude-sonnet-4.6": { "name": "Claude Sonnet 4.6" },
"openai/gpt-5.6-sol": { "name": "GPT 5.6 Sol" },
"deepseek/deepseek-v4-pro": { "name": "DeepSeek V4 Pro" }
}
}
}
}The ID must match the catalog exactly, in provider/model format. Browse all IDs on the models page.
4. Select a model
Start OpenCode and run /models; the ApexApi entries are in the list. The same config powers OpenCode Desktop, which reads opencode.json too; on desktop you pick the model from the dropdown instead of the command.
Troubleshooting
- 401 Unauthorized: the key wasn't pasted correctly or has been revoked.
- Model not found: the model ID doesn't match a catalog ID. Copy it verbatim from the models page.
- Connection fails: make sure the base URL is exactly
https://api.apexapi.dev/v1(no trailing slash after v1) and your balance is positive. - Provider missing from /models: the JSON didn't parse or the env variable isn't set in the shell that launched OpenCode. Validate the file and run
echo $APEXAPI_API_KEY. - Anything else: check the error codes reference; streaming and tool calling are fully supported on
/v1/chat/completions.