By rewriting the environment variables in ~/.claude/settings.json, you can point all four Claude Code model slots (primary model / small fast model / Sonnet / Opus) to LongCat-2.0's Anthropic-compatible endpoint, allowing Claude Code to use LongCat directly for repository-level coding tasks.
Suitable tasks: Use Claude Code as an Agent shell with LongCat-2.0 as the backend for code understanding, repository-level changes, and automated task execution; compare LongCat with the Claude family in real coding workflows
Unsuitable tasks: Scenarios that require Claude-specific functionality (such as particular toolchain behavior built into Claude Code) and do not accept behavioral differences
Applicable model version: LongCat-2.0 (Anthropic-format endpoint https://api.longcat.chat/anthropic)
Applicable clients, Agents, or APIs: Claude Code CLI (the official Anthropic client)
Recommended reasoning tier and parameters: The official example sets CLAUDE_CODE_MAX_OUTPUT_TOKENS to 131072 (128K); CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 disables nonessential traffic
~/.claude/settings.json{
"env": {
"ANTHROPIC_AUTH_TOKEN": "your_longcat_api_key",
"ANTHROPIC_BASE_URL": "https://api.longcat.chat/anthropic",
"ANTHROPIC_MODEL": "LongCat-2.0",
"ANTHROPIC_SMALL_FAST_MODEL": "LongCat-2.0",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "LongCat-2.0",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "LongCat-2.0",
"CLAUDE_CODE_MAX_OUTPUT_TOKENS": "131072",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
},
"permissions": {
"allow": [],
"deny": []
}
}claude
# Enter the test message: "Hello, please introduce yourself"
# Receiving a reply from the LongCat model means the configuration succeededThe settings.json contents were transcribed verbatim from the official documentation (collected on 2026-08-18).
The official model card and OpenRouter page both list "Claude Code" as one of the Harnesses deeply adapted for LongCat-2.0; OpenRouter Apps data shows Claude Code as LongCat-2.0's second-largest traffic source (3.31B tokens, behind Hermes Agent's 7.77B), supporting that this configuration path is used at significant scale in real workflows.
Note: ANTHROPIC_AUTH_TOKEN must contain the LongCat API key, not an Anthropic key; ANTHROPIC_BASE_URL must point to LongCat's Anthropic-compatible endpoint.
This configuration replaces all of Claude Code's model slots with LongCat-2.0, so Claude and LongCat cannot be mixed within the same session; switch back by editing the configuration.
The Anthropic-compatible endpoint is implemented by a third party (Meituan), so compatibility for tool calls and other behavior is subject to the official documentation; OpenRouter testing found a tool-call error rate of approximately 0.90% (see review document 03).
The official documentation also provides equivalent configuration pages for Kilo Code, Codex, ZCode, Cline, Cherry Studio, CodeBuddy, WorkBuddy, CC Switch, and other tools (/platform/docs/<tool name>); use the same method when needed.
LongCat 2.0