VS Code chat: Custom Endpoint with your own key
Add uttapen to VS Code chat through the Custom Endpoint provider: the chatLanguageModels.json entry, token limits, and a cheap utility model.
Updated: 22 Sep 2026
VS Code chat (the Copilot Chat panel) ships a Custom Endpoint provider that accepts any Chat Completions endpoint, uttapen included — and BYOK models work without a Copilot plan. This page was checked against the official VS Code docs (September 2026 revision).
Adding a model
- In the chat panel, choose Manage Language Models from the model picker, or run Chat: Manage Language Models from the Command Palette.
- Select Add Models → Custom Endpoint.
- Give it a group name (for example
uttapen), a display name and yoursk-up-…key (Dashboard → API keys). - Pick Chat Completions as the API type.
- VS Code opens
chatLanguageModels.json. Describe your models like this:
[
{
"name": "uttapen",
"vendor": "customendpoint",
"apiKey": "${input:uttapenApiKey}",
"apiType": "chat-completions",
"models": [
{
"id": "anthropic/claude-sonnet-5",
"name": "Claude Sonnet 5",
"url": "https://api.uttapen.ir/v1/chat/completions",
"toolCalling": true,
"vision": true,
"maxInputTokens": 184000,
"maxOutputTokens": 16000
},
{
"id": "openai/gpt-5-nano",
"name": "GPT-5 nano",
"url": "https://api.uttapen.ir/v1/chat/completions",
"toolCalling": true,
"vision": false,
"maxInputTokens": 120000,
"maxOutputTokens": 8000
}
]
}
]
Details that matter:
- Give the full
urlincluding/chat/completionsso VS Code never has to guess the path. - Keep
apiTypeonchat-completions;responsesandmessagesdon't work against uttapen. - Don't add a provider-level
urlfield. With it, VS Code discovers models from the endpoint and all 400+ of ours flood the picker. List the models you want instead. maxInputTokensplusmaxOutputTokensdefine the model's context for VS Code and their sum must stay within the model's real window; the numbers are on the model list.maxOutputTokensis what we reserve against, so don't inflate it.- A model without
toolCalling: trueis hidden in agent mode.
A model for utility tasks
VS Code calls separate models for session titles, commit messages, pull request titles and descriptions, and intent detection. If you use BYOK without a GitHub account, those features stay off until you name a model. Open Settings, find chat.utilityModel and chat.utilitySmallModel, and point them at a cheap uttapen model such as openai/gpt-5-nano. chat.byokUtilityModelDefault decides what utility flows use by default when your main model is BYOK.
What BYOK does not cover
Inline code suggestions, semantic search and anything built on embeddings need the Copilot service and won't run on an uttapen key. Chat and agent mode work fully. On a Copilot Business or Enterprise account, your administrator has to enable the "Bring Your Own Language Model Key" policy first.
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
401 invalid_api_key | Wrong or revoked key | Create a new key and re-enter it |
404 model_not_found | id doesn't match a real model id | Copy it from /en/models (the 404 also lists the closest ids it guessed, in uttapen.suggestions) |
404 not_found | apiType is responses or messages, or the url is incomplete | Use chat-completions and the full URL |
402 insufficient_balance | Balance below the required hold | Top up, or lower maxOutputTokens |
429 | The key's rate or monthly limit (rate limits) | Wait, or raise the limit |
| Model missing from the picker | toolCalling not set, or VS Code needs a restart | Add the field and restart VS Code |
If the balance can't cover the full maxOutputTokens, uttapen lowers the ceiling to what it can pay for (floor 1,024 tokens) and returns the granted value in the X-Uttapen-Max-Tokens header, which can leave a reply unfinished. 402 only happens when even that floor doesn't fit.
Other tools are in integrations; error codes are in errors.
Sign up with a phone number, top up your wallet from 100,000 toman and create a key. Free models work without a top-up — up to 50 requests a day. Create an API key →