Use Tokun with Cursor
Connect Cursor to Tokun using your API key and a supported model.
Overview
Cursor connects to Tokun through its OpenAI-compatible provider settings. Your Cursor 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.
- Cursor, installed.
- A model ID, such as
anthropic/claude-opus-4-8.
Quickstart
Cursor's model provider is set in its Settings. Open Settings → Models, then in the OpenAI section:
- Paste your Tokun key (
sk-…) as the OpenAI API key. - Turn on “Override OpenAI Base URL” and set it to
https://api.tokun.sh/v1. - Add a custom model with its Tokun ID, such as
anthropic/claude-opus-4-8, and select it.
Click Verify, then chat with the selected model.
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 Cursor 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 Cursor to use Tokun. Cursor's provider config lives in its Settings UI (not a file you can edit), so OUTPUT these steps for the user to follow rather than editing anything:
1. Open Cursor -> Settings -> Models.
2. In the OpenAI section, paste the Tokun API key (starts with sk-).
3. Enable "Override OpenAI Base URL" and set it to https://api.tokun.sh/v1.
4. Add a custom model id (e.g. anthropic/claude-opus-4-8) and select it.
5. Click verify; then chat with the model.
The key is a Tokun sk- key (NOT an OpenAI key). The base URL keeps the /v1 suffix (it is the OpenAI surface).Set up manually
Every setting is under Settings → Models: the OpenAI API key field, the base URL override (https://api.tokun.sh/v1), and the custom model list. To roll back, clear the base URL override and remove the custom model.
Model IDs
Add Tokun model IDs in lab/model format as custom models, 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
/v1 (https://api.tokun.sh/v1) because it uses the OpenAI API. Some Cursor features (for example, tab completion) may require an OpenAI key and won't route through a custom base URL; chat and agent use the override.| Symptom | Likely cause | Fix |
|---|---|---|
Verification fails | Wrong key or base URL | Use your Tokun sk- key and https://api.tokun.sh/v1. |
402 / payment required | Empty Tokun balance | Top up on the Billing page. |
Model not found | Custom model ID not added or selected | Add a lab/model ID, such as anthropic/claude-opus-4-8. |