Skip to content
Popular

Connect Cursor to Tokens

Point Cursor's chat at the Tokens OpenAI-compatible endpoint with a custom OpenAI base URL, and know which Cursor features will keep using Cursor's own models.

Works withCursor
On this page

Cursor is an AI code editor built on VS Code. To use Tokens models in Cursor chat, you give Cursor a Tokens key in its OpenAI API key field and override the OpenAI base URL to https://tokens.bd/v1. Cursor then speaks the OpenAI Chat Completions protocol to Tokens.

Not officially documented by Cursor

Cursor's current "Bring your own API key" help page (checked October 2026) covers OpenAI, Anthropic, Google, Azure OpenAI and AWS Bedrock keys only. It does not mention an "Override OpenAI Base URL" setting. The steps below come from third-party reports. The toggle may be missing on your Cursor build or plan, and where it exists it may only apply to some features. Treat this setup as best effort.

What Tokens can and cannot do inside Cursor#

Before you spend time on settings, know the limits. These come from Cursor's own docs unless marked otherwise.

Cursor featureUses your Tokens key?
Chat with a custom modelYes, when the override is available
Tab completionNo. Cursor docs: "Tab completion continues using Cursor's built-in models."
Agent modeLimited or ignored, according to third-party reports

Two more points from Cursor's docs:

  • Cursor routes BYOK requests through its own servers for prompt building. Your endpoint must be reachable from the public internet, which tokens.bd is.
  • On Teams and Enterprise plans, BYOK requests still incur the Cursor Token Rate of $0.25 per million tokens (list price, checked October 2026). That charge is Cursor's, on top of what Tokens bills.

If you need an agent that reliably uses your key for everything, install Cline, Kilo Code or Continue inside Cursor. Cursor runs VS Code extensions, and those three document custom endpoints officially.

Set a custom OpenAI base URL in Cursor#

1. Create a key#

Create a key in the dashboard. A dedicated key with a monthly spend cap is a good idea for an editor, because you can revoke it without touching your other tools. See API keys for the options.

2. Enter the settings#

  1. Open Cursor Settings with Ctrl+Shift+J (Windows, Linux) or Cmd+Shift+J (macOS), then go to Models.
  2. Under OpenAI API Key, paste your key.
  3. Turn on Override OpenAI Base URL and enter https://tokens.bd/v1.
  4. Click Add Custom Model and enter the model ID exactly.
  5. Save, and make sure the new model is enabled in the model list.

The values, in one place:

Cursor Settings Models
OpenAI API Key:            tok_live_your_key
Override OpenAI Base URL:  https://tokens.bd/v1
Custom model:              deepseek/deepseek-v4.1-flash

Cursor stores the key in its own settings. It does not read TOKENS_API_KEY from your environment, so there is nothing to export for Cursor itself. The same values appear, with your real key, under Connect Your Agent.

The base URL needs the /v1 suffix. Without it, Cursor calls a path that the gateway does not serve.

Switch models#

Add another custom model for each Tokens model you want, using the exact ID with its provider prefix, for example deepseek/deepseek-v4.1-flash. Then pick it from the model dropdown in chat.

Find IDs in the model catalog, or list the ones your key can use:

bash
curl -s https://tokens.bd/v1/models -H "Authorization: Bearer $TOKENS_API_KEY"

If you are unsure which model fits a coding workload, Choosing a model covers the trade-offs.

Verify it works#

Test the key outside Cursor first. If this fails, no Cursor setting will fix it.

bash
export TOKENS_API_KEY=tok_live_your_key
curl -s https://tokens.bd/v1/chat/completions \
  -H "Authorization: Bearer $TOKENS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek/deepseek-v4.1-flash", "max_tokens": 16, "messages": [{"role": "user", "content": "Reply with OK"}]}'

Then open Cursor chat, select deepseek/deepseek-v4.1-flash, and send a short prompt. Within a minute or so the request should show in your dashboard usage analytics. If chat answers but nothing appears in usage, Cursor answered with a different model.

Troubleshooting#

There is no "Override OpenAI Base URL" toggle. Third-party guides report it is missing on some builds and plans. Cursor's docs don't promise it, so there is no setting to hunt for. Use Cline, Kilo Code or Continue inside Cursor instead.

Claude models in Cursor fail with 422 after enabling the override. Third-party guides report this. Turn the override off when you want Cursor's built-in Anthropic models, and back on for Tokens.

Agent mode or Tab ignores Tokens. Expected, per the table above.

401 invalid_api_key or missing_api_key. The key field is empty, has extra whitespace, or holds a revoked or rotated key. Rotating stops the old secret immediately.

404 model_not_found. The model ID doesn't match a Tokens ID. With the override on, any model that uses the OpenAI key may be sent to Tokens, including names like gpt-* that Tokens may not carry under that ID. Disable those models in Cursor's list, or add the exact Tokens ID.

403 model_not_allowed_on_key or tier_permission_denied. The key has an allow-list that excludes the model, or your plan doesn't include it and the wallet is empty.

402 insufficient_credits. Top up or renew in billing.

For rate limits and upstream errors, see Troubleshooting. The request format Cursor uses is documented in Chat Completions.

Sources: Cursor API keys help page, Cursor API keys docs, checked October 2026. Base URL override steps from third-party guides (coderouter.io, routerplex.com), not confirmed by Cursor.

Was this page helpful?

Still stuck? Open a support ticket

Need help configuring your agent?

Test your connection with the connection tester, or create an API key.