OpenCode
Configure OpenCode third-party API in Fast-Token
OpenCode is an open-source AI coding assistant that supports highly customizable API integration. By configuring a third-party API, you can freely choose models with stronger performance or better value (such as DeepSeek, SiliconFlow, and others).
Step 1: Gather core API information
Before configuring, prepare:
- API Key: Your authorization key. Fast-Token platform
- Base URL: Endpoint address (for example
https://fast-token.com/v1). - Model ID: The specific model name (for example
deepseek-ai/DeepSeek-V3).
Step 2: Open the configuration screen
- Launch OpenCode.
- Click the settings gear in the lower-left corner -> Settings.
- In the search box, type
OpenCodeorAI Provider. - Find the Provider dropdown and set it to
OpenAI Compatible(orCustom).
Step 3: Fill in parameters
1. Set Base URL
Find the OpenAI Compatible: Base URL option and enter your third-party proxy address.
Note: Make sure the address ends with
/v1and does not include/chat/completions.
2. Bind API Key
Find the OpenAI Compatible: API Key option and paste your key.
3. Define the model list
Find the Custom Models or Model Map option:
- Click Add Item.
- Enter the display name you want in the UI (for example
DeepSeek). - Enter the real model ID from your API provider (for example
deepseek-chat).
Step 4: Enable and test
- Open OpenCode’s Chat window (usually the robot icon in the sidebar).
- In the model switcher at the bottom, select the Custom Model you just added.
- Send a prompt (for example:
write a quicksort) to test connectivity.
Advanced: Environment variables (for developers)
If you prefer managing settings via the terminal or system environment, OpenCode also reads .env files or system environment variables. You can set:
OPENAI_API_BASE: Your third-party URLOPENAI_API_KEY: Your key
Troubleshooting
| Error message | Possible cause | Fix |
|---|---|---|
| Model Not Found | Model ID does not match | Check the model list in your provider’s console and ensure the ID matches exactly. |
| Invalid API Key | Key expired or copied incorrectly | Regenerate the key and make sure there are no extra line breaks. |
| Network Error | Certificate or proxy issue | If using a domestic relay, check whether you need to enable or disable a specific network proxy. |
| Stream Mode Error | Endpoint does not support streaming | Try turning off Enable Streaming in settings (most modern APIs support it). |
Tip: OpenCode works well with open-source models. If you run LM Studio or LocalAI locally, point the Base URL to
http://localhost:xxxx/v1for fully offline code assistance.