Playbooks · Coding tasks
Run LongCat-2.5 in Claude Code without the 200K cap
Written November 4, 2026 · Edited November 12, 2026
Claude Code does not recognize the model ID LongCat-2.5, so it assumes a 200,000-token window and compacts the conversation there. Point one launch at LongCat's endpoint, tell Claude Code the model's real window, and read the startup warning before doing real work.
What happens without the fix
LongCat-2.5 became generally available on the LongCat API Platform on 2 November 2026, listed as compatible with Claude Code, Codex, and Hermes. Claude Code's own model configuration docs say that when it does not recognize a session's model ID, it cannot tell the model's context window and assumes 200K tokens, auto-compacting at that assumed size. The warning appears at startup. If the model's real window is 200K, there is nothing to correct; for any larger window, the fix is one variable, set in the environment that starts Claude Code.
Before you start
You need a LongCat API key, Claude Code installed, and a throwaway copy of a project for the first session. Create the key on the API Keys page: it is shown only once, so store it somewhere safe right away. The same key works for both the OpenAI-format and Anthropic-format endpoints. Read the pricing page and the model page on LongCat's platform before a long session, and take the window size for the next step from the model page, not from memory. LongCat's docs say failed requests, including 401, 403, 429, and 500 responses, are not charged, and only successful requests are billed on actual token use.
Steps
- Keep the trial to one launch. Do not paste the routing into
~/.claude/settings.jsonunless you want every Claude Code session on the machine to go to LongCat: Claude Code's environment variable docs say that file applies to you, in every project. A wrapper script keeps plainclaudeon your normal setup. Never put the key in a project.claude/settings.jsonfile, which is checked into source control. - Write the wrapper. Save this as a file such as
~/bin/claude-longcat, replacing the window value with the number on LongCat's model page:export ANTHROPIC_BASE_URL="https://api.longcat.chat/anthropic"export ANTHROPIC_AUTH_TOKEN="$LONGCAT_API_KEY"export ANTHROPIC_MODEL="LongCat-2.5"export ANTHROPIC_DEFAULT_OPUS_MODEL="LongCat-2.5"export ANTHROPIC_DEFAULT_SONNET_MODEL="LongCat-2.5"export ANTHROPIC_DEFAULT_HAIKU_MODEL="LongCat-2.5"export CLAUDE_CODE_MAX_CONTEXT_TOKENS=<window from the model page>exec claude "$@"
ANTHROPIC_BASE_URLvariable is how Claude Code routes requests through a proxy or gateway, andANTHROPIC_AUTH_TOKENsupplies theAuthorizationheader. Set the haiku slot too: it is also used for background work, and leaving it unset leaves part of the session on the default model. Make the file executable, exportLONGCAT_API_KEYin your shell, and run the wrapper in the throwaway project. - Read the startup lines. The 200K warning should be gone once Claude Code uses the window you gave it. If the warning is still there, the variable did not take effect: check that the ID does not start with
claude-and carries no[1m]suffix, the two cases where the docs say the variable applies on its own. Run/statusin the session to see which model is active. - Run one small task first. Ask for a small change with a test you can run yourself, in the throwaway copy. After the session, compare the token use against LongCat's billing records before moving real work to it. A first session that never shows the model in
/statushas not proved anything about the window. - Plan long outputs against the lower cap. LongCat's FAQ says LongCat-2.5 outputs up to 256K tokens, but Claude Code's environment variable docs say that for a model ID it cannot resolve, the output default is 32,000 and the cap is 128,000, and Claude Code lowers a higher value to the cap. Inside Claude Code, the 128,000 cap governs until a run proves otherwise. Raising
CLAUDE_CODE_MAX_OUTPUT_TOKENSreduces the effective context window available before auto-compaction triggers, so do not raise it casually on a long-context session. - Leave the traffic switch out.
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICdisables auto-updates, telemetry, and error reporting, and any non-empty value turns it on, including0. Setting it to0expecting "off" still disables that traffic. Omit it unless you mean to stop Claude Code updating itself.
What can go wrong
- Every session goes to LongCat. Routing pasted into user settings applies to every project. The wrapper in step 1 is the prevention; plain
claudestays on your normal account. - A key ends up in version control. Project settings are shared through git. Keys belong in your shell environment or user settings, never in a project settings file.
- The window is trusted without a look. If the startup warning is still showing, Claude Code is still compacting at 200K, whatever the wrapper says. The warning disappearing is the signal that the declared window took effect.
- Long generations stop early. The Claude Code output cap for an unrecognized model ID is 128,000 tokens. A generation that stops short is more likely that cap than a model failure.
- Temperature settings are ignored. LongCat's Responses API docs fix temperature at 1.0 with thinking enabled and 0.7 with thinking disabled, with other values overridden. An evaluation harness that sets temperature to 0 for repeatable runs will not get it here.
Limits
- The window value must come from LongCat's model page at the time you set it up. This page gives no window figure of its own, and a guessed number either compacts too early or sends requests the model cannot take.
- No price figure appears here. Check LongCat's pricing page before spending, and budget from your own billing records after the first session, not from launch announcements.
- Subagents inherit the session model unless given their own. If a subagent's work lands on a different model than expected, check the subagent definition and the
CLAUDE_CODE_SUBAGENT_MODELsetting before blaming the endpoint.
Related playbooks
- Run Sonnet with an Opus advisor in Claude Code
- Run Claude Code Projects without burning quota
- Run three independent lines of research at the same time in Claude Code, then combine the short summaries
- Run claude-mem on your own plan, redaction on
Sources
- https://longcat.chat/platform/docs/change-log
- https://longcat.chat/platform/docs/faq
- https://longcat.chat/platform/docs/api-docs
- https://longcat.chat/platform/docs/api/responses
- https://code.claude.com/docs/en/env-vars
- https://code.claude.com/docs/en/model-config#correct-the-window-for-a-gateway-or-custom-model-id
Back to: Coding playbooks hub · Also: Bring your own Anthropic key: what it costs · What an agent costs · GPT-6.1 Sol, Ultrafast, and the new Pro tiers · Agent cost estimator · Use Claude Code login inside OpenCode