Use Tokun with Zed
Connect Zed to Tokun using your API key and a supported model.
Overview
Zed's Agent Panel connects to Tokun through an OpenAI-compatible provider. Your Zed workflow stays the same, and requests use Tokun's pricing and model routing.
Before you start
- A Tokun API key (starts with
sk-) from the API keys page. - A funded Tokun balance.
- Zed, installed.
- A model ID, such as
anthropic/claude-opus-4-8.
Quickstart
In Zed's settings.json, add Tokun as an OpenAI-compatible provider:
"language_models": {
"openai_compatible": {
"Tokun": {
"api_url": "https://api.tokun.sh/v1",
"available_models": [
{ "name": "anthropic/claude-opus-4-8", "display_name": "Tokun Opus", "max_tokens": 200000 }
]
}
}
}Then open the Agent Panel settings, select the Tokun provider, and paste your sk-… key.
Set up with an AI assistant
Paste this prompt into your AI coding agent. It reads the setup guide at /llms.txt and sets up Zed for you. You only need to provide your API key.
Read https://tokun.sh/llms.txt and integrate Tokun into this project.You are helping the user configure Zed to use Tokun. Edit Zed's settings.json and add an OpenAI-compatible provider:
"language_models": {
"openai_compatible": {
"Tokun": {
"api_url": "https://api.tokun.sh/v1",
"available_models": [
{ "name": "anthropic/claude-opus-4-8", "display_name": "Tokun Opus", "max_tokens": 200000 }
]
}
}
}
Then tell the user to open the Agent Panel settings, select the Tokun provider, and paste the Tokun key (starts with sk-).
Notes:
- api_url keeps the /v1 suffix (https://api.tokun.sh/v1).
- The key is a Tokun sk- key, NOT an OpenAI key.Set up manually
The provider is defined under language_models.openai_compatible in settings.json (api_url: https://api.tokun.sh/v1 and your models); you enter the key in the Agent Panel. To roll back, remove the provider block.
Model IDs
Each entry's name is a Tokun model ID in lab/model format, such as anthropic/claude-opus-4-8 or openai/gpt-5.5. Tokun never substitutes a different model: an unknown ID returns an error.
Official model pools
Official model pools appear in the model catalog and use a pool ID such as flash-pool. Choose an available pool from the live catalog; pool names and members are configured by Tokun administrators.
When the pool enables member selection, use pool-id/member-name, replacing the model's lab prefix with the pool ID. The selected member is the only model that can execute; the pool's pricing mode still applies. When selection is disabled, this form returns 400.
- Fixed token pricing uses the pool's input, output, cache and context-tier rates for every member, including a member you select yourself.
- Actual model pricing uses the serving member's price, frozen before the request. A retry to another member uses that member's frozen price.
- Fixed per-request pricing charges once after an upstream success response begins. Missing usage, a partial response or a client disconnect after that point still counts once. Failures before success and unsuccessful retries do not add charges.
Use a pool that lists the API format this client sends. Model pool settings in the live catalog control which members are shown and whether member selection is available.
Troubleshooting
openai_compatible (not the Anthropic provider) and keep the /v1 suffix on api_url (https://api.tokun.sh/v1). The key is your Tokun sk- key.| Symptom | Likely cause | Fix |
|---|---|---|
401 / auth error | Wrong or missing key | Paste your Tokun sk- key in the Agent Panel. |
402 / payment required | Empty Tokun balance | Top up on the Billing page. |
Model not found | Wrong model name | Use a lab/model ID, such as anthropic/claude-opus-4-8. |