OpenCode
Use TokenOff OpenAI model service in OpenCode Agent.
Download OpenCode from the OpenCode website. You can choose:
- OpenCode CLI
- OpenCode Desktop
You can use TokenOff's OpenAI model service as follows.
Get API Key
Go to the API Keys page to create your API key.
Configuration
-
Add a custom Provider
Create an
opencode.jsoncfile in the user's~/.config/opencodedirectory with the following content:{ "$schema": "https://opencode.ai/config.json", "provider": { "tokenoff": { "npm": "@ai-sdk/openai-compatible", "name": "Tokenoff", "options": { "baseURL": "https://tokenoff.com/api/v1" }, "models": { "gpt-6-luna": { "name": "GPT-6 Luna" } } } } }modelsdefines the list of models you want to use, and eachkeyis the model id.OpenCode's settings page also provides an entry for adding a custom model provider, but in testing (version 2.0.28) it reports an error when adding. We recommend this configuration method instead.
You can add multiple providers; just make sure the
keyandnamedo not conflict. -
Then open OpenCode, start a new session, type
/connectin the input box, and select the provider you added above (e.g. tokenoff) in the popup window. Enter your API key on the page that opens.This needs to be done once for each provider.
-
After OpenCode shows that the connection succeeded, you can see the models you added in the session's model list.
Contact Us
If you encounter any issues while using TokenOff:
Contact us atsupport@tokenoff.comand other official channels for technical support
Submit an issue on ourGithubrepository