Setup guide
Connect VS Code
Visual Studio Code has AI chat built in (GitHub Copilot Chat), and it accepts your own models through a custom endpoint. This guide connects that chat to CheapTokens.
Before you start
- A CheapTokens account with some balance. Create one if you haven't.
- Your API key from Dashboard → API key. It starts with
ct_live_. - Any text model from the models page. They all work over the OpenAI Chat Completions format.
The snippets below use claude-sonnet-5-5. Pick another model to update them.
Steps
-
Install VS Code if you don't have it. These steps use the chat that is built in.
-
Open the Command Palette (
Ctrl+Shift+P, orCmd+Shift+Pon macOS) and run Chat: Manage Language Models. -
Click Add Models → Custom Endpoint. Name the group
CheapTokens, paste your API key when asked, and choose Chat Completions as the API type. -
VS Code opens the file
chatLanguageModels.json. Make the CheapTokens entry look like this and save. Keep theapiKeyline that VS Code wrote for you.chatLanguageModels.json[ { "name": "CheapTokens", "vendor": "customendpoint", "apiKey": "${input:cheaptokensApiKey}", "apiType": "chat-completions", "models": [ { "id": "claude-sonnet-5-5", "name": "claude-sonnet-5-5", "url": "https://cheaptokens.pw/v1/chat/completions", "toolCalling": true, "vision": true, "maxInputTokens": 200000, "maxOutputTokens": 8192 } ] } ] -
Open the Chat view, pick
claude-sonnet-5-5in the model picker and send a message. Restart VS Code if the model isn't listed.
Check that it works
Send a short message in VS Code, then open Dashboard → Usage. The request appears there within a few seconds, with its model, tokens and cost.
Good to know
- Other ways to use CheapTokens in VS Code: the Claude Code, Codex, Cline, Roo Code and Continue extensions each have their own guide.
- A model needs
"toolCalling": trueto show up in agent mode. - Inline code completions can't use your own models. Only chat and agent mode can.
- To add more models, repeat the block inside
modelswith another model ID. - On a company GitHub Copilot plan, an administrator has to allow your own model keys first.
If something goes wrong
| What you see | What to do |
|---|---|
401 or invalid_api_key | The key is wrong, disabled or has extra spaces. Create a new key and paste it again. |
402 or insufficient_quota | Your balance is empty. Top up under Billing. |
404 or model_not_found | The model ID has a typo. Copy it from the models page. |
| 404 on every request | The base URL is wrong. Check whether this tool needs the /v1 ending (see the steps above). |
| 429 | Too many requests per minute. Wait a few seconds and retry. |
Prefer a guided version? Open the setup wizard →