OpenCode is an open-source terminal coding assistant. You can map Toknix models directly in its configuration file.
opencode.json Configuration
Place this in ~/.config/opencode/opencode.json:
json
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"toknix": {
"npm": "@ai-sdk/openai",
"name": "createOpenAI",
"options": {
"baseURL": "https://api.toknix.in/v1",
"apiKey": "{env:TOKNIX_API_KEY}"
},
"models": {
"fast": { "id": "glm-5.3-flash" },
"smart": { "id": "claude-opus-5-5" },
"coding": { "id": "deepseek-v4.1-flash-1017-hq" }
}
}
}
}Launching OpenCode
bash
export TOKNIX_API_KEY="tk_live_your_key"
opencode