VS Code's built-in chat can use Hatz models through the Hatz Anthropic-compatible endpoint. This works in Ask, Edit and Agent mode. No GitHub Copilot subscription is needed.
Availability: Requires VS Code 1.122 or newer. If your organization uses Copilot Business or Enterprise, an administrator can disable Bring your own language model key through a policy. If that policy is disabled, the model will not appear.
What you need
A Hatz account with the Create API Token permission. If access is restricted, ask your administrator to add this permission. See API Keys.
VS Code 1.122 or newer. Open Help → About to check your version.
Step 1 — Create your Hatz API key
Log in to Hatz in your browser. Open Workspace > API Keys, click Generate API Key, and copy the key.
Keep it secret: Do not paste your key into support tickets or chats, or send it by email. Keys can be regenerated if needed.
Step 2 — Check the key works (optional)
Open a terminal (on Mac, open the Terminal app). Paste this one line, replace PASTE_KEY_HERE with your key, and press Enter:
curl -s -H "X-API-Key: PASTE_KEY_HERE" https://ai.hatz.ai/v1/anthropic/v1/models
Good: The reply starts with {"data":[{"id":"anthropic.claude-….
Invalid key: The reply says "Missing or invalid API Key". Go back to Step 1 and copy the key again.
Step 3 — Open the chat panel
In VS Code, click the Chat icon in the top-right toolbar, or press Ctrl+Alt+I (Mac: ⌃⌘I).
Step 4 — Open Manage Language Models
Click the model name at the bottom of the chat box, such as GPT-4.1 or Auto. In the list that opens, click the gear icon → Manage Language Models.
Alternatively, press F1, type Chat: Manage Language Models, and press Enter.
Step 5 — Add a Custom Endpoint
Click Add Models, then choose Custom Endpoint from the list.
Step 6 — Paste your API key when asked
When VS Code asks for an API key, paste the key from Step 1 and press Enter. VS Code stores it securely and opens chatLanguageModels.json.
Step 7 — Replace the file contents
Check first: If VS Code already wrote a line starting with "apiKey":, keep that line. Use it in place of the "apiKey": "${input:hatzApiKey}", line below; it contains the secret VS Code just saved for you.
In chatLanguageModels.json, select everything with Ctrl+A (Mac: ⌘A), delete it, and paste this block, keeping the existing "apiKey": line as described above:
[
{
"name": "Hatz",
"vendor": "customendpoint",
"apiKey": "${input:hatzApiKey}",
"apiType": "messages",
"models": [
{
"id": "anthropic.claude-sonnet-5",
"name": "Claude Sonnet 5 (Hatz)",
"url": "https://ai.hatz.ai/v1/anthropic/v1/messages",
"toolCalling": true,
"vision": true,
"maxInputTokens": 200000,
"maxOutputTokens": 16000
}
]
}
]
Save the file with Ctrl+S (Mac: ⌘S).
Do not add a top-level "url". Only the model has a "url". Adding a "url" beside "name": "Hatz" makes VS Code fetch the model list from the server instead of using this file. If that fetch fails, you will see no models at all.
Step 8 — Reload the window
Press F1, type Developer: Reload Window, and press Enter. The window reloads.
Step 9 — Select the model and send a message
Click the model name at the bottom of the chat box again. Under Hatz, select Claude Sonnet 5 (Hatz).
Type Reply with the single word OK and press Enter. If the model replies OK, setup is complete. VS Code remembers this model for next time.
Adding more models
In chatLanguageModels.json, copy the whole { … } model block inside "models": [ … ]. Paste it after the first model block, with a comma between them, and change "id" and "name":
"id": "anthropic.claude-opus-5"and"name": "Claude Opus 5 (Hatz)""id": "anthropic.claude-fable-5-1"and"name": "Claude Fable 5.1 (Hatz)""id": "anthropic.claude-haiku-4-5"and"name": "Claude Haiku 4.5 (Hatz)"
Hatz also accepts the aliases sonnet, opus, and haiku as model IDs. The full list for your account comes from the models endpoint in Step 2. Those IDs reflect what your Hatz account can actually invoke. See Anthropic Messages Gateway for more about aliases.
Save the file, reload the window as in Step 8, and select the added model in the chat model picker.
Troubleshooting
If Hatz is not in the model picker → Open Manage Language Models as in Step 4. If Hatz is listed, turn on the switch next to Claude Sonnet 5 (Hatz), then reload the window as in Step 8.
If it is still missing after reload → Press
F1, typePreferences: Open User Settings (JSON), and press Enter. Add"chat.agentHost.byokModels.enabled": trueinside the outer braces, with a comma between settings. Save and reload the window.If the model shows in Ask mode but not Agent mode → Open Manage Language Models → Hatz → edit to open
chatLanguageModels.json. Confirm"toolCalling": trueis present in the model block. Save and reload the window.If the error mentions 401 or "invalid API key" → Open Manage Language Models, remove Hatz, and repeat Steps 5–8 with the key copied fresh from Hatz.
If the error mentions 400 or "unsupported model" → Check the model ID for a typo. For the model in Step 7, it must be exactly
anthropic.claude-sonnet-5.If the error mentions 429 → Your Hatz workspace is out of credits or over its limit. Contact your Hatz administrator.
Good to know
Model usage is billed to your Hatz credits like any other Hatz model call.
This connection does not bypass your workspace's model access, package limits, or rate limits.
Tools and agents run inside VS Code, not Hatz. VS Code handles tool calls and follow-up requests.
Extended thinking output is not returned through this endpoint.
This connects chat only, not inline code completions.
Related articles
