---
title: "Connect opencode to apiToken.sale"
description: "Wire opencode to the apiToken.sale OpenAI-compatible endpoint with one provider block and run GPT-5.6 models on your prepaid balance."
url: "https://apitoken.sale/int-opencode"
language: "en"
---
# Connect opencode to apiToken.sale

Wire opencode to the apiToken.sale OpenAI-compatible endpoint with one provider block and run GPT-5.6 models on your prepaid balance.

## Steps

1. Create a key at https://apitoken.sale/register — it looks like `sk-pool-…` and works across every GPT and Gemini model.
2. Point opencode at the OpenAI-compatible surface: base URL `https://router.apitoken.sale/v1`, key sent as `Authorization: Bearer`.
3. Pick a model by namespaced ID (e.g. `openai/gpt-6.1-terra` or `google/gemini-3.8-flash`) and start — billing is per token at your discount, `GET /v1/models` lists the enabled set.

## Configuration

```
# one-click setup: installs the router plugin (live model catalog,
# limits, pricing) and merges the apitoken provider into
# ~/.config/opencode/opencode.jsonc — asks for your sk-pool-… key,
# backs up an existing config, touches nothing else
curl -fsSL https://apitoken.sale/setup/connect.sh | bash

# verify (models are namespaced: apitoken/<provider>/<model>)
opencode run --model apitoken/openai/gpt-5.6-sol "Reply with exactly: connected"

# The setup imports every model in the selected provider namespace. It writes
# a private launcher and backs up the previous config. Manual provider blocks
# are not needed.
# {
#   "provider": {
#     "apitoken": {
#       "npm": "@ai-sdk/openai-compatible",
#       "name": "apiToken.sale",
#       "options": {
#         "baseURL": "https://router.apitoken.sale/v1",
#         "apiKey": "{env:APITOKEN_API_KEY}"
#       },
#       "models": {
#         "gpt-5.6-sol": { "name": "GPT-5.6 Sol" }
#       }
#     }
#   }
# }
```

---
API reference: https://apitoken.sale/md/docs · All integrations: https://apitoken.sale/md/int
