Agent workflows · 2026-10-10
Claude Code gateway: ANTHROPIC_DEFAULT_HAIKU_MODEL for free Haiku 5.5
Set ANTHROPIC_DEFAULT_HAIKU_MODEL so Claude Code sends background tasks through LLMTR to anthropic/claude-haiku-5.5-free, free until 14 October 2026.
Short answer: one variable sends background tasks to the free model
LLMTR (llmtr.com) is a gateway that gives access to language models hosted in Türkiye and at global providers through one OpenAI-compatible API. Point Claude Code, Anthropic's coding agent, at llmtr.com with ANTHROPIC_BASE_URL and set ANTHROPIC_DEFAULT_HAIKU_MODEL to anthropic/claude-haiku-5.5-free: background tasks such as session titles then go to Claude Haiku 5.5 at $0.00 per 1M tokens. OpenAI-compatible clients use https://llmtr.com/v1.
Claude Haiku 5.5 is Anthropic's current Haiku model for high-volume, latency-sensitive work such as classification, routing, extraction and sub-agent tasks. On LLMTR it is free until 14 October 2026, 23:59 (TRT), with no credit deducted and a daily limit per account; the period can end earlier if the quota set aside for free use runs out. After the end, requests return HTTP 410 model_retired.
How to set the Claude Code background model with ANTHROPIC_DEFAULT_HAIKU_MODEL
Set ANTHROPIC_DEFAULT_HAIKU_MODEL=anthropic/claude-haiku-5.5-free together with ANTHROPIC_BASE_URL=https://llmtr.com and your LLMTR key in ANTHROPIC_AUTH_TOKEN, then start Claude Code from the same shell: background tasks and the haiku alias go to the free model until 14 October 2026, 23:59 (TRT). Behind a gateway, if this variable is not set, background tasks use the main model.
The block also sets CLAUDE_CODE_AUTO_COMPACT_WINDOW=100000 and CLAUDE_CODE_MAX_OUTPUT_TOKENS=32000, which keep Claude Code inside the free model's prompt and response limits (see the limits section). The variables apply to the session started from that shell; the main model stays as you configured it unless you choose another with ANTHROPIC_MODEL, /model or --model.
Environment variables that send Claude Code background tasks to anthropic/claude-haiku-5.5-free (bash).
export ANTHROPIC_BASE_URL=https://llmtr.com
export ANTHROPIC_AUTH_TOKEN=llmtr-your_key
export ANTHROPIC_DEFAULT_HAIKU_MODEL=anthropic/claude-haiku-5.5-free
export CLAUDE_CODE_AUTO_COMPACT_WINDOW=100000
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=32000
The variables and what each one does
ANTHROPIC_BASE_URL takes the host root without /v1: https://llmtr.com. Claude Code sends its requests to https://llmtr.com/v1/messages. ANTHROPIC_AUTH_TOKEN carries the LLMTR key and is sent as Authorization: Bearer. If you give the key as ANTHROPIC_API_KEY instead, Claude Code sends it in the x-api-key header; LLMTR accepts the same key in either header.
ANTHROPIC_DEFAULT_HAIKU_MODEL sets the model id the haiku alias resolves to, and Claude Code also uses it for background functionality such as session titles. Behind a gateway, if the variable is not set, background tasks use the main model. Setting it gives those small requests a model of their own while the conversation stays on the main model.
| Variable | Value | Effect |
|---|---|---|
| ANTHROPIC_BASE_URL | https://llmtr.com | sends requests to LLMTR's /v1/messages |
| ANTHROPIC_AUTH_TOKEN | your LLMTR key | sent as Authorization: Bearer |
| ANTHROPIC_DEFAULT_HAIKU_MODEL | anthropic/claude-haiku-5.5-free | model for background tasks and the haiku alias |
| ANTHROPIC_MODEL | anthropic/claude-haiku-5.5-free | main model (optional, whole session) |
| CLAUDE_CODE_AUTO_COMPACT_WINDOW | 100000 | compacts the conversation at 100,000 tokens |
| CLAUDE_CODE_MAX_OUTPUT_TOKENS | 32000 | max output tokens per request |
Two setups: background only, or the whole session
Setup A, background only: set ANTHROPIC_DEFAULT_HAIKU_MODEL and leave the main model as it is; background tasks send small prompts, so this stays far from the prompt limit. Setup B, the whole session: give ANTHROPIC_MODEL and ANTHROPIC_DEFAULT_HAIKU_MODEL the same id, anthropic/claude-haiku-5.5-free, and every request goes to that model. The /model command and the --model flag take priority over ANTHROPIC_MODEL.
Before starting Claude Code, check the connection with the request below: it asks /v1/messages for at most 16 tokens with the key in ANTHROPIC_AUTH_TOKEN, and if an answer comes back, the key, the address and the model id are correct. With CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1, the /model picker is filled from https://llmtr.com/v1/models and shows anthropic/claude-haiku-5.5-free, because it keeps ids that contain claude or anthropic.
A request to /v1/messages that checks the key and the model id before you start Claude Code.
curl https://llmtr.com/v1/messages \
-H "Authorization: Bearer $ANTHROPIC_AUTH_TOKEN" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"anthropic/claude-haiku-5.5-free","max_tokens":16,"messages":[{"role":"user","content":"test"}]}'
Limits to plan for, and the 14 October end date
The free model accepts up to 100,000 prompt tokens per request, counting the messages and the tool definitions Claude Code sends. With CLAUDE_CODE_AUTO_COMPACT_WINDOW=100000, Claude Code compacts the conversation at that size. That is the documented minimum for the variable, so if a long session still gets HTTP 400 prompt_too_large, run /compact. The response limit is 32,768 tokens; keep CLAUDE_CODE_MAX_OUTPUT_TOKENS at or below it.
Free use has a daily limit per account; when it is reached, the API returns HTTP 429 with a Retry-After header and the limit resets on its own. The free period ends on 14 October 2026, 23:59 (TRT), or earlier if its quota runs out. After that, anthropic/claude-haiku-5.5-free returns HTTP 410 model_retired, so change ANTHROPIC_DEFAULT_HAIKU_MODEL, and ANTHROPIC_MODEL if you set it, before then. On Windows, use PowerShell as below.
The same variables in Windows PowerShell, with the compaction and output values from this section.
$env:ANTHROPIC_BASE_URL = "https://llmtr.com"
$env:ANTHROPIC_AUTH_TOKEN = "llmtr-your_key"
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "anthropic/claude-haiku-5.5-free"
$env:CLAUDE_CODE_AUTO_COMPACT_WINDOW = "100000"
$env:CLAUDE_CODE_MAX_OUTPUT_TOKENS = "32000"
Getting started on LLMTR: account, key and first request
Step 1: create an account at llmtr.com. Step 2: create an API key under Dashboard > API Keys. The raw key is shown only once, so store it as an environment variable such as LLMTR_API_KEY, or in ANTHROPIC_AUTH_TOKEN for Claude Code. Step 3: send the first request to https://llmtr.com/v1 with any OpenAI-compatible SDK by changing only base_url and api_key, using the model id anthropic/claude-haiku-5.5-free.
Usage per key is visible on the Dashboard usage page. The same key works for every model in the catalog; switching models means changing the model string. Other models are billed from prepaid credit at their catalog price, while anthropic/claude-haiku-5.5-free costs $0.00 per 1M input and output tokens until the end date.
Send Claude Code background tasks to the free Claude Haiku 5.5
Create an LLMTR API key, set the Claude Code environment variables and check the connection with a request to /v1/messages.
- LLMTR account and API key. Create an account at llmtr.com and an API key under Dashboard > API Keys. The raw key is shown only once; store it in an environment variable.
- Set the environment variables. In the shell that starts Claude Code, set ANTHROPIC_BASE_URL=https://llmtr.com, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_DEFAULT_HAIKU_MODEL=anthropic/claude-haiku-5.5-free, CLAUDE_CODE_AUTO_COMPACT_WINDOW=100000 and CLAUDE_CODE_MAX_OUTPUT_TOKENS=32000.
- Check with a curl request. Send the curl request to https://llmtr.com/v1/messages with the model id anthropic/claude-haiku-5.5-free; if an answer comes back, the key and the model id are correct.
Frequently asked questions
Which Claude Code environment variable sets the background model?
ANTHROPIC_DEFAULT_HAIKU_MODEL. Set it to anthropic/claude-haiku-5.5-free together with ANTHROPIC_BASE_URL=https://llmtr.com and your LLMTR key; behind a gateway, background tasks use the main model when it is not set.
Why set CLAUDE_CODE_AUTO_COMPACT_WINDOW to 100000 for Claude Haiku 5.5?
The free model accepts prompts up to 100,000 tokens, tool definitions included, and with this value Claude Code compacts the conversation at that size. If a long session still gets HTTP 400 prompt_too_large, run /compact.
What happens to free Haiku in Claude Code after 14 October 2026?
After 14 October 2026, 23:59 (TRT), or earlier if the free quota runs out, requests to anthropic/claude-haiku-5.5-free return HTTP 410 model_retired. Change ANTHROPIC_DEFAULT_HAIKU_MODEL before the end date.