Claude Code
Anthropic's terminal coding agent via Messages route.
Claude Code talks to FreeTheAi through the Anthropic Messages format. Set the gateway env vars, run `claude`, and pick a Claude alias.
Messages Streaming Tool calling
Connect Claude Code to FreeTheAi.
3 steps
- 1
Export the gateway env vars
Claude Code reads ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN. Point them at FreeTheAi.
bash export ANTHROPIC_BASE_URL=https://api.freetheai.xyz export ANTHROPIC_AUTH_TOKEN=fta_PASTE_YOUR_FREETHEAI_KEY - 2
Optional: enable model discovery
Claude Code can list models from the gateway when you flip on discovery.
bash export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 - 3
Run claude and pick a model
Start Claude Code, then use `/model` or `--model` to choose a FreeTheAi Claude alias.
bash claude --model bbl/gpt-5.5-mini
Models that pair well with Claude Code.
bbl/gpt-5.5-miniglm/glm-5.1opc/deepseek-v4-flash-free
See the full live catalog at /models. Aliases are stable; pricing on the free tier stays $0.
Common gotchas.
- Claude Code's discovery can be restrictive. If discovery does not surface the catalog, pass a known FreeTheAi alias explicitly with `--model`.
- Setting `ANTHROPIC_AUTH_TOKEN` disables Remote Control, MCP connectors, and `/schedule` tied to a claude.ai login. That is expected.
- FreeTheAi's `/v1/messages` already supports `anthropic-beta` and `count_tokens`, so no extra config is needed on the gateway side.