GreenTokens

Search

Search models, guides, docs and the FAQ.

Clients

OpenCode

Add GreenTokens as an OpenAI-compatible provider in OpenCode.

Add GreenTokens as a provider

OpenCode connects to any OpenAI-compatible API through a custom provider. Add GreenTokens to opencode.json in your project, or to ~/.config/opencode/opencode.json to use it everywhere:

opencode.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "greentokens": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "GreenTokens",
      "options": {
        "baseURL": "https://api.greentokens.io/v1",
        "apiKey": "{env:GREENTOKENS_API_KEY}"
      },
      "models": {
        "claude-sonnet-5": { "name": "Claude Sonnet 5" },
        "claude-opus-5-5": { "name": "Claude Opus 5.5" },
        "gpt-6-sol": { "name": "GPT-6 Sol" },
        "glm-5.3": { "name": "GLM-5.3" }
      }
    }
  },
  "model": "greentokens/claude-sonnet-5"
}
  • {env:GREENTOKENS_API_KEY} reads your key from the environment, so it never sits in the file.
  • List the models you want under models. The keys are GreenTokens model IDs from the models page; the names are what opencode shows.
  • model sets the default, as provider/model-id.

Run it

export GREENTOKENS_API_KEY="sk-gt-…"
opencode
Switch between the models you listed with /models inside opencode.