Claude Code Free API: Run It on FreeTheAI Models
Claude Code can run on FreeTheAI's Anthropic-compatible Messages endpoint. Point ANTHROPIC_BASE_URL at FreeTheAI and choose which model fills each Claude slot.
Before you start
- Create a free account and an API key. Create an account
- Check in once a day to unlock the free models. Daily check-in
- Pick a model ID from the models page. Browse models
Settings
- ANTHROPIC_BASE_URL
https://api.freetheai.org- ANTHROPIC_AUTH_TOKEN
your FreeTheAI key (ftai_..., 53 characters)- ANTHROPIC_MODEL
fta/zai/glm-5.3
Steps
Add the settings
Put this in ~/.claude/settings.json (on Windows, %USERPROFILE%\.claude\settings.json). Never put your key in a project's shared .claude/settings.json.
json{ "env": { "ANTHROPIC_BASE_URL": "https://api.freetheai.org", "ANTHROPIC_AUTH_TOKEN": "ftai_your_key_here", "ANTHROPIC_MODEL": "fta/zai/glm-5.3", "ANTHROPIC_DEFAULT_OPUS_MODEL": "fta/zai/glm-5.3", "ANTHROPIC_DEFAULT_SONNET_MODEL": "fta/zai/glm-5.3", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "fta/zai/glm-5.3-flash", "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1" } }Start Claude Code
Run claude, then /status. The Anthropic base URL line should show https://api.freetheai.org.
Check in daily
Free models need one check-in a day at freetheai.org/checkin, or requests are refused.
How this guide was checked: Tested end to end with Claude Code 2.1.284 on 2026-09-29 (reads a file with its Read tool on three FreeTheAI models).
Tips
- Claude Code warns that fta/ models are not in its model catalog. That is expected; it still works and assumes a 200K context.
- The HAIKU model runs background tasks such as titles, so a fast model fits there.
- If a model answers 400 about unknown fields, add "CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS": "1".
Troubleshooting
Is using Claude Code with FreeTheAI official?
No. Claude Code supports custom gateways through ANTHROPIC_BASE_URL, but Anthropic does not support non-Claude models behind one, so some Claude-only features may not work.
Does Claude Code tool use work on FreeTheAI?
Yes. File reading and other tools were tested on 2026-09-29 with fta/zai/glm-5.3 and fta/kimi/k3.
Does it use my Claude subscription?
No. While ANTHROPIC_AUTH_TOKEN is set, requests go to FreeTheAI with your FreeTheAI key and do not count against a claude.ai plan.
Common errors
- 401: the key is wrong or incomplete. Paste the whole key.
- 403: check in for today, or confirm your email.
- 404: the model ID or URL is wrong.
- 429: daily limit reached, or too many requests at once.