Curated models for your best work

Join the waitlist

Router docs

Cursor with TokenSpend

Use Cursor's custom OpenAI base URL with a TokenSpend key.

Paste it into your coding agent. It carries no key and states how far this setup has been tested.

See what gets copied
# Connect Cursor to TokenSpend

API format: OpenAI-compatible
API key: a TokenSpend key, read from the environment variable TOKENSPEND_API_KEY. Never write it into a project file or print it.
Back up any existing config before you change it, and tell the user what you changed.
Models: exact IDs are listed at https://tokenspend.dev/models (for example anthropic/claude-sonnet-4-6).

Steps:
1. Cursor Settings, Models. If your version has Override OpenAI Base URL, set it to https://api.tokenspend.dev/v1. If it does not, stop: this setup is not available in that version.
2. Put the TokenSpend key in the API key field (never a Cursor admin key). Add an exact TokenSpend model ID.
3. Send one small chat request and check its receipt before using Agent mode.

Cursor sends API-key requests through its own servers, so TokenSpend logging settings do not cover that path.

Check:
1. Send one small request with synthetic content. It is billable. Note the request ID, not the key.
2. Open https://tokenspend.dev/dashboard/router and match the request ID, model, status, token counts and cost.
If something fails, check the error code at https://tokenspend.dev/docs/router/reliability#errors and https://tokenspend.dev/status. Do not send keys or private prompts to support.

1. Set your key

Create a rail key in Router, then load it into this terminal. It stays in your environment, not in a project file.

Terminal
printf 'TokenSpend rail key: '
read -r -s TOKENSPEND_API_KEY
printf '\n'
export TOKENSPEND_API_KEY

2. Connect Cursor

Cursor

  1. Open Cursor Settings → Models. If your version has Override OpenAI Base URL, set it to https://api.tokenspend.dev/v1. If it does not, this setup is not available in your version.
  2. Paste a TokenSpend key into the API-key field, never a Cursor admin key. Add an exact TokenSpend model ID where custom models are allowed.
  3. Send a small chat request and check its receipt before you use Agent mode. Restore the old URL and key when you switch back.

Tab completion does not use custom keys. Cursor sends API-key requests through its own servers, so TokenSpend logging settings do not cover that path.

Sources: Cursor API keys.

3. Check the receipt

A response is only half the check. Send one small request, then match its request ID, model and cost in Router activity. The full steps are in Verify the receipt.

Other agents

All coding agents