Integrations
Claude Code
Run Claude Code on a pay-per-token freeaiapi.ai key.
Claude Code supports LLM gateways. Point it at freeaiapi.ai with two settings.
Configure
Add this to ~/.claude/settings.json (or export the same variables in your shell):
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.freeaiapi.ai",
"ANTHROPIC_AUTH_TOKEN": "YOUR_FREEAIAPI_KEY",
"CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
}
}ANTHROPIC_BASE_URLhas no/v1— Claude Code appends/v1/messagesitself.ANTHROPIC_AUTH_TOKENis sent asAuthorization: Bearer.ANTHROPIC_API_KEY(sent asx-api-key) also works.CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERYfills the model picker fromGET /v1/models.
Choose models
Set ANTHROPIC_MODEL to pin a model, and ANTHROPIC_DEFAULT_HAIKU_MODEL for the model Claude Code uses for background tasks. Use Claude model IDs from the model list.