TokenFlyTokenFly
API GuideGetting StartedClient Setup

OpenCode Setup

Connect OpenCode to Tokenfly

Installation

npm install -g opencode-ai

Check the Version

After installation, run the following command to confirm the version:

opencode --version

Start OpenCode

Type the following command and press Enter to open OpenCode:

opencode

End the Current Session

Press Ctrl+x within an OpenCode session to end the current session.

To start a new session, run the start command again:

opencode

Configure opencode.jsonc / opencode.json

The default installation path is:

C:\Users\<current Windows user>\.config\opencode

Edit the opencode.jsonc or opencode.json file with the following content:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "hosted_vllm/gpt-5.4",
  "provider": {
    "hosted_vllm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Hosted vLLM",
      "options": {
        "apiKey": "sk-.......",
        "baseURL": "https://tokenfly.com/v1"
      },
      "models": {
        "gpt-5.4": {
          "name": "gpt-5.4"
        }
      }
    }
  }
}

Configuration Reference

FieldDescription
apiKeyPaste the key created on the platform
baseURLRequest address
modelsModel name, case-sensitive

How is this guide?