Skip to content

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:

  1. API Key: Your authorization key. Fast-Token platform
  2. Base URL: Endpoint address (for example https://fast-token.com/v1).
  3. Model ID: The specific model name (for example deepseek-ai/DeepSeek-V3).

Step 2: Open the configuration screen

  1. Launch OpenCode.
  2. Click the settings gear in the lower-left corner -> Settings.
  3. In the search box, type OpenCode or AI Provider.
  4. Find the Provider dropdown and set it to OpenAI Compatible (or Custom).

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 /v1 and 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

  1. Open OpenCode’s Chat window (usually the robot icon in the sidebar).
  2. In the model switcher at the bottom, select the Custom Model you just added.
  3. 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 URL
  • OPENAI_API_KEY: Your key

Troubleshooting

Error messagePossible causeFix
Model Not FoundModel ID does not matchCheck the model list in your provider’s console and ensure the ID matches exactly.
Invalid API KeyKey expired or copied incorrectlyRegenerate the key and make sure there are no extra line breaks.
Network ErrorCertificate or proxy issueIf using a domestic relay, check whether you need to enable or disable a specific network proxy.
Stream Mode ErrorEndpoint does not support streamingTry 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/v1 for fully offline code assistance.