Use Tokun with Cursor
Use Tokun as the model backend for Cursor via its OpenAI-compatible provider — the same Cursor workflow, billed at Tokun pricing with Tokun's model routing.
What this connects
Use Tokun as the model backend for Cursor via its OpenAI-compatible provider — the same Cursor workflow, billed at Tokun pricing with Tokun's model routing.
Before you start
- A Tokun API key (starts with
sk-) from the console. - A funded Tokun balance.
Cursorinstalled.- A chosen model id, e.g.
anthropic/claude-opus-4-8.
Recommended quickstart
Cursor's model provider lives in its Settings UI. Open Settings → Models, then in the OpenAI section:
- Paste your Tokun key (
sk-…) as the OpenAI API key. - Enable “Override OpenAI Base URL” and set it to
https://api.tokun.sh/v1. - Add a custom model with the Tokun id, e.g.
anthropic/claude-opus-4-8, and select it.
Click verify, then chat with the selected model.
Copy for AI agent
Working inside an AI coding agent? The shortest path is one line — paste this and your agent reads the full machine-readable guide at /llms.txt and does the Cursor setup itself. You only supply your key:
Read https://tokun.sh/llms.txt and integrate Tokun into this project.Cursor specifically.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).Manual configuration
Everything 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 naming
Add Tokun lab/model ids as custom models, e.g. anthropic/claude-opus-4-8 or openai/gpt-5.5. Tokun does not silently substitute models — an unknown id returns an error.
Verify & troubleshoot
/v1 (https://api.tokun.sh/v1) — it is the OpenAI surface. Some Cursor features (e.g. tab-completion) may require an OpenAI-native key and won't route through a custom base URL; chat + 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 in the console. |
Model not found | Custom model id not added/selected | Add a lab/model id, e.g. anthropic/claude-opus-4-8. |