Coding agents
Use Libremodel in Claude Code
Claude Code speaks the Anthropic Messages format, which we serve. One settings file points it at us and puts every model in its picker.
1. Install Claude Code
curl -fsSL https://claude.ai/install.sh | bashirm https://claude.ai/install.ps1 | iex2. Set your API key
Create a key in API keys and save it as LIBREMODEL_API_KEY. On macOS and Linux, add the line to ~/.zshrc or ~/.bashrc so every new terminal has it.
export LIBREMODEL_API_KEY="sk-libremodel-..."[Environment]::SetEnvironmentVariable("LIBREMODEL_API_KEY", "sk-libremodel-...", "User")3. Add Libremodel
Paste this into ~/.claude/settings.json. If the file already has settings, merge these keys into them. apiKeyHelper reads the key from the variable, so it never sits in the file.
{
"apiKeyHelper": "echo $LIBREMODEL_API_KEY",
"env": {
"ANTHROPIC_BASE_URL": "https://api.libremodel.ai",
"ANTHROPIC_DEFAULT_MODEL": "deepseek-v4.1-flash-1017",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "kimi-k3.1-pro",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k3.1-pro",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4.1-flash-1017",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4.1-flash-1017",
"CLAUDE_CODE_MAX_CONTEXT_TOKENS": "1048576"
},
"modelPicker": {
"replaceBuiltInOptions": true,
"options": [
{
"model": "kimi-k3.1-pro-uncensored",
"label": "Kimi K3.1 Pro Uncensored"
},
{
"model": "deepseek-v4.1-flash-1017-uncensored",
"label": "DeepSeek V4.1 Flash Uncensored"
},
{
"model": "glm-5.3-flash-uncensored",
"label": "GLM 5.3 Flash Uncensored"
},
{
"model": "kimi-k3.1-pro",
"label": "Kimi K3.1 Pro"
},
{
"model": "deepseek-v4.1-flash-1017",
"label": "DeepSeek V4.1 Flash"
},
{
"model": "minimax-m3.1-flash",
"label": "MiniMax M3.1 Flash"
}
]
}
}The default model is deepseek-v4.1-flash-1017. The Opus and Fable slots point at kimi-k3.1-pro, for the hardest tasks.
4. Start it
claudeSwitch models with /model and reasoning effort with /effort.
Troubleshooting
Run this in the same terminal you start the tool from. It costs nothing. A list of models means the key is fine. A 401 means LIBREMODEL_API_KEY is empty or wrong in that terminal; open a new one after saving it.
curl -s https://api.libremodel.ai/v1/models -H "Authorization: Bearer $LIBREMODEL_API_KEY"curl.exe -s https://api.libremodel.ai/v1/models -H "Authorization: Bearer $env:LIBREMODEL_API_KEY"If the key is fine and the tool gets a 402, your balance does not cover the request. See Billing and credits.
Notes
Agents that run subagents send several requests at once. When capacity is busy, the extra ones wait in a short queue instead of failing. See Limits and errors.
Of the Anthropic server tools, web search and web fetch work, on standard models: each search is charged (Web search) and each fetch is free (Web fetch). The others are not available.