Claude Code API Error 400: How Do I Fix Each Message?
Fix Claude Code API Error 400 by matching the exact message: E003 coding agent blocks, Identity verification required, Input is too long, and version errors.

Summary
- "E003: model not available for coding agents" is returned by a third-party gateway or API reseller, not Anthropic. Check ANTHROPIC_BASE_URL and /status.
- "Input is too long" and "Prompt is too long" require /compact, or pressing Esc twice (/rewind) if a massive file or image batch broke compaction itself.
- "Identity verification is required to continue" is an Anthropic account hold.
- "Claude Code does not support this model" means your CLI binary (or the binary bundled inside claude-agent-sdk or the desktop app) is older than the model's.
When Claude Code prints API Error: 400, the CLI is forwarding a rejection from whatever upstream server received your request. Because HTTP 400 covers everything from proxy permission rules to account holds and oversized payloads, running /clear or reinstalling the CLI blindly wastes time and can wipe out a session you could have recovered.
I diagnose 400 errors in Claude Code by looking at the exact string after API Error: 400. That suffix tells you immediately whether the rejection came from a third-party gateway, Anthropic's trust and safety system, the context window, or a version check.
| Error Message Text | Where It Comes From | Immediate Fix |
|---|---|---|
e003: model not available for coding agents. please use advantage assist models |
Third-party proxy, LLM gateway, or API reseller | Check ANTHROPIC_BASE_URL and /status; switch to an allowed model or connect directly to Anthropic |
Input is too long. / Prompt is too long |
Context window full or request body over 32MB (Anthropic / Bedrock) | Run /compact; if compaction also returns 400, press Esc twice (/rewind) to undo the last large file read |
Identity verification is required to continue. |
Anthropic account trust & safety hold | Complete Persona verification at claude.ai/restricted or switch to another API key |
Claude Code <version> does not support this model |
Server-side minimum CLI version check | Run claude update, or upgrade claude-agent-sdk (>=0.2.158 for Opus 5.5) |
Adaptive thinking is not supported / reasoning_content is missing |
Thinking config mismatch or non-Anthropic model proxy | Adjust /effort, disable thinking for incompatible third-party models, or roll back a breaking CLI update |
Invalid effort level |
Effort above the organization's cap for that model | claude update to 2.1.314 or newer, or a lower level with /effort |
messages.N: all messages must have non-empty content |
Corrupted local turn or empty tool output | Exit with /exit and run claude --continue to sanitize the session history |
On this page
E003: model not available for coding agents. please use advantage assist models
If your terminal prints api error: 400 e003: model not available for coding agents. please use advantage assist models, stop troubleshooting your local Claude Code installation. Neither the e003 error code nor the phrase advantage assist models exists in the Claude Platform Errors Reference or the Claude Code Error Reference.
This message comes from a middleman server sitting between your terminal and the model provider. When you run Claude Code, the CLI identifies itself in request headers (User-Agent: claude-cli/...). Enterprise LLM gateways and third-party API resellers inspect those headers to separate lightweight chat traffic from high-token coding agents. When your API key only has permission to run cheaper or curated tiers—which several proxy providers label internally as "advantage assist models"—the gateway blocks the request with 400 e003 before it ever reaches Anthropic. The same layer is also responsible for non-standard 400 strings like engine protocol predict request returned 400, which is documented under Claude Code's LLM gateway guide.
To see where your traffic is actually going, inspect your shell environment variables:
env | grep -E "ANTHROPIC_BASE_URL|ANTHROPIC_MODEL|ANTHROPIC_AUTH_TOKEN|ANTHROPIC_API_KEY"
You can also type /status inside an active Claude Code session to view the active base URL and model ID. If you left an old proxy configuration in your .zshrc or .bashrc and want to connect to Anthropic directly, unset the custom endpoint and authenticate with an official key:
unset ANTHROPIC_BASE_URL
unset ANTHROPIC_AUTH_TOKEN
export ANTHROPIC_API_KEY="sk-ant-..."
If you are intentionally routing through a corporate gateway or a reseller, you have to play by their model pool rules. Check the provider's dashboard for the exact model IDs they permit for coding agents, then pass that ID explicitly via export ANTHROPIC_MODEL="<allowed-model-id>" or switch inside the CLI with /model. I covered the full environment variable setup in my guide on pointing Claude Code at custom endpoints, and if you are paying a middleman for access, I recommend checking how resellers route and restrict upstream Claude accounts.
If the message is Engine protocol predict request returned 400 from a local LM Studio server, see Engine protocol predict request returned 400.
Input is too long. and Prompt is too long
Context overflow looks different depending on how you connect to Claude. On a direct Anthropic connection, interactive sessions usually catch the ceiling early and display Context limit reached · /compact or /clear to continue, while non-interactive (-p) runs and transcript logs record Prompt is too long. If you run Claude Code through Amazon Bedrock (CLAUDE_CODE_USE_BEDROCK=1) or a managed cloud gateway, the upstream service returns API Error: 400 Input is too long for requested model. or a bare API Error: 400 Input is too long..
In normal text-heavy coding sessions, running /compact summarizes the history and gets you moving again. However, there are two situations where /compact itself fails with Error during compaction: API Error: 400 Input is too long. after a few seconds, leaving the session stuck on every subsequent message.
The first is hitting the hard 32MB raw request body limit (documented in the Claude Code error reference). This cap is evaluated on the HTTP payload size before tokenization. If your agent reads 65 to 70 full-resolution screenshots in a single session—roughly 30MB once base64-encoded—the request exceeds 32MB even if your token count is only around 670k inside a 1M context window. When you hit this against Anthropic's direct API, the server returns HTTP 413 (request_too_large), which signals Claude Code to strip old images before compacting. When you hit it on Bedrock, Bedrock returns a generic 400 Input is too long. instead of 413. Because the CLI does not trigger its image-stripping fallback on a generic 400, /compact re-sends the exact same 30MB payload and dies with the same 400 error.
The second is a single massive file read—such as a minified JS bundle, a lockfile, or a multi-megabyte build log—that fills the context window past 100%, leaving zero token headroom for the compaction prompt itself, or hitting a proxy's smaller internal threshold (CONTENT_LENGTH_EXCEEDS_THRESHOLD) even when /context reports only 20% usage of a 1M window.
When /compact fails with a 400, do not /clear the whole session yet. Press Esc twice (Esc Esc) or run /rewind to step back to the conversation turn right before Claude Code read the giant file or image batch. Dropping that single oversized turn brings the payload back under the limit immediately.
Once the session is responsive again, run /context to see where your tokens are going. In my experience, the silent culprit is usually /mcp: every enabled MCP server injects its complete tool schema into every single request. Disable any MCP server you aren't actively using in that repository, trim long instructions out of your root CLAUDE.md, and check /config to confirm Auto-compact (autoCompactEnabled) hasn't been turned off by a stray DISABLE_COMPACT=1 or DISABLE_AUTO_COMPACT=1 environment variable. If you run workloads on managed cloud providers instead of direct keys, see how request handling differs when setting up Claude models on Google Cloud.
Single-error page: API Error: 400 Input is too long in Claude Code.
Identity verification is required to continue.
When you get API Error: 400 Identity verification is required to continue., no terminal command, model switch, or config edit will fix it. Anthropic has placed a trust and safety hold on the account associated with your API key or login session, and the API will reject every request with HTTP 400 until the account owner completes identity verification.
To clear the hold, log into your account in a browser and go to https://claude.ai/restricted, which launches Anthropic's verification flow through Persona. You will need a government-issued ID from a supported region, as detailed in the Claude Help Center article on identity verification.
Be aware that the Persona flow has a harsh edge case: if your country is missing from the country selector dropdown, or if you retry failed uploads until you see Session expired. Please restart this process or request a new link to continue., the verification state can lock up into Identity verification failed. Once an account is stuck in that state, Claude Code remains completely unusable on that account until support intervenes. To get back to work immediately, run /login to authenticate with a different verified account or export a fresh ANTHROPIC_API_KEY.
The same rule applies if you see API Error: 400 This organization has been disabled.. Even if the web console still lets you log in, the underlying organization is suspended from making API calls. If you see either the identity verification prompt or the disabled organization message while using a key from a third-party proxy, it means the reseller's upstream Anthropic account was flagged. You cannot verify someone else's upstream account, so you have to ask the provider to rotate their upstream key pool or switch back to your own direct key.
Single-error pages: Identity verification is required to continue and This organization has been disabled.
Claude Code does not support this model (claude_code_version_too_old)
When Anthropic releases a new model tier, they enforce a minimum CLI version on the server side. If your binary reports an older version string, the API immediately returns:
API Error: 400 Claude Code 2.1.275 does not support this model; version 2.1.280 or newer is required. Run 'claude update', or update the Claude desktop app, then try again.
You will see a similar 400 (is older than the minimum version required by your organization's policy) if your enterprise admin sets a minimum version floor. For example, calling claude-opus-5-5 requires CLI 2.1.280 or newer, and claude-sonnet-5-5 requires 2.1.284 or newer.
Running claude update fixes a standard global CLI install, though you should watch out for three environments where the error persists even after you update.
First, if you update via npm using the stable tag, npm install -g @anthropic-ai/claude-code@stable sometimes lags behind the minimum floor required for a brand-new model by several days (for instance, sitting at 2.1.274 when Opus 5.5 required 2.1.280). Install @latest or run claude update directly, then confirm with claude --version.
Second, if you are calling Claude through the Python claude-agent-sdk, upgrading your system-wide claude CLI does nothing. The Python SDK bundles its own standalone CLI binary inside the package's _bundled/ directory. For claude-opus-5-5, any claude-agent-sdk release below 0.2.158 bundles a CLI older than 2.1.280 and fails on every turn. Even worse, the SDK streams a ResultMessage with subtype="success" and is_error=True (terminal_reason="api_error", api_error_status=400) before raising ResultError, which can trick naive logging into recording a failed 400 turn as a success. Check your bundled CLI version and upgrade the package inside your virtual environment:
python -c "from claude_agent_sdk._cli_version import __cli_version__; print(__cli_version__)"
pip install --upgrade --no-cache-dir "claude-agent-sdk>=0.2.158"
If you are on Windows, also check that claude_agent_sdk/_bundled/ actually contains the executable; certain point releases published to PyPI without a win_amd64 wheel fall back to the source distribution (sdist), which omits the binary. If you cannot upgrade the SDK right away, pass an updated external binary explicitly via ClaudeAgentOptions(cli_path="/path/to/claude").
Third, the Claude desktop app manages its own internal CLI binary separate from your system PATH. On Windows, if you moved %APPDATA%\Claude using an NTFS directory junction to save disk space, the desktop updater can fail with ENOENT during directory creation and silently fall back to an ancient bundled version like 2.1.111. Restoring %APPDATA%\Claude as a real directory (and only junctioning large subdirectories) allows the desktop app to pull the current CLI binary and clears the 400 error.
Single-error page: Claude Code X.Y does not support this model; version X.Z or newer is required.
Thinking Mismatches and Non-Anthropic Models
A separate class of 400 errors happens when your thinking parameters or tool schemas clash with the target model.
Current-generation Claude models use adaptive thinking controlled by /effort (low, medium, high, max), whereas older 4.5-series models only accept fixed-budget extended thinking (thinking: {type: "enabled", budget_tokens: N}). If an enterprise proxy remaps a newer model name onto an older backend model, the API rejects the payload with Adaptive thinking is not supported on this model or thinking.type.enabled is not supported for this model. Similarly, if you disabled thinking in ~/.claude/settings.json ("alwaysThinkingEnabled": false) or set MAX_THINKING_TOKENS=0 while your effort level is maxed out, you will hit Effort 'xhigh' isn't available with thinking turned off. Lower the effort with /effort high or remove the flag disabling thinking (see Anthropic's thinking troubleshooting documentation for valid combinations).
If you point Claude Code at non-Anthropic models like Kimi, DeepSeek, or Qwen through an Anthropic-compatible translation layer, you will frequently run into protocol mismatches during tool use:
- Missing
reasoning_contenton Kimi / Moonshot: Multi-turn tool calls fail withAPI Error: 400 thinking is enabled but reasoning_content is missing in assistant tool call message at index 3. Turning off thinking in Claude Code stops the CLI from expecting or forwarding incompatible reasoning blocks, which gets the request through at the cost of reasoning mode. - Deferred tools and tool-result mismatches on Qwen and DeepSeek: Newer Claude Code builds use deferred custom tools to save context tokens. Non-Anthropic endpoints that don't implement deferral return
API Error: 400 Deferred custom tools are only supported on Anthropic models and on Anthropic-compatible provider endpoints that implement deferral, while strict OpenAI-to-Anthropic translation hubs often fail mid-task withtool calls and tool results do not match, please start a new conversation and retry. - Sudden 400s after a silent CLI update: If a Claude Code auto-update introduces a new request format that a third-party API (such as DeepSeek) does not yet support, causing sudden 400 errors overnight, you can downgrade the CLI with
npm install -g @anthropic-ai/claude-code@<previous-version>(for example,@2.1.153) and pause automatic updates by setting"DISABLE_AUTOUPDATER": "1"in~/.claude/settings.json.
Single-error page: adaptive thinking is not supported on this model.
Invalid effort level
API Error: 400 Invalid effort level means Claude Code sent an effort above the cap for this model. The value is the first one that is set: CLAUDE_CODE_EFFORT_LEVEL, then a level from /effort, then --effort, then the saved effortLevel, then the model default. Claude Code's model configuration page sets that default to medium on Opus 5.5, Sonnet 5.5 and Haiku 5.5, and to high on most other models that support effort. On Claude Enterprise, an admin caps effort per model for each role, and a request above the cap is rejected.
The Claude Code changelog says version 2.1.314 lowers the effort to the cap, retries, and tells you which level it used. Run claude update, then send the prompt again. On an older version, unset CLAUDE_CODE_EFFORT_LEVEL when it is above the cap, because it outranks /effort, and choose an allowed level with /effort. The cap follows the model, so a gateway model id that lands on a tighter cap needs that lower level, or an ANTHROPIC_MODEL whose cap allows the level you send.
claude update
Single-error page: Invalid effort level.
Corrupted Conversation History and Empty Content Blocks
Finally, if a session suddenly starts returning 400 on every single keystroke with a JSON payload like:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.49: all messages must have non-empty content except for the optional final assistant message"}}
an interrupted tool execution or empty response wrote a blank content block into your local session state. Because Claude Code sends the full message array on every turn, that single malformed entry at index 49 poisons every future request in the conversation.
You do not need to lose your session to fix this. Exit cleanly with /exit (or Ctrl+D twice) and resume from your terminal:
claude --continue
When Claude Code resumes a session with --continue, it sanitizes transient empty blocks from the transcript history. Updating to CLI v2.1.229 or newer also prevents whitespace-only messages from being sent in the first place. Similarly, if you hit orphaned tool_result in conversation history or Invalid encrypted_content in search_result block when switching organizations, running claude update (to v2.1.282+) allows the CLI to strip unrecognized tool calls and encrypted web-search blocks automatically.
The only history corruption that --continue cannot heal is thinking or redacted_thinking blocks in the latest assistant message cannot be modified (or role 'system' must precede an 'assistant' message), which happens when a proxy mutates a cryptographically signed thinking block or injects a system prompt mid-array. When a thinking signature is broken in the transcript, either press Esc twice (/rewind) to jump back before the corrupted assistant turn, or run /clear to start a clean conversation.
Single-error pages: due to tool use concurrency issues and messages.N: system content must contain at least one block.
More Claude Code errors with their own page
- To turn thinking off on this model, send between_tools
- Invalid effort level
- diagnostics.previous_message_id: must be the id from a prior /v1/messages response
- You have reached your specified API usage limits
- We've updated our Consumer Terms and Privacy Policy
- Invalid input at messages.1.role
- context_management: Extra inputs are not permitted
- invalid beta flag
- data retention mode 'default' is not available for this model
- Opus 5.5's safeguards flagged this session
- Response stalled mid-stream
- All target providers failed (Claude Code Router)
- This group does not allow /v1/messages dispatch (sub2api)
Sources and checks
- Claude Platform Errors Reference
- Claude Code Error Reference
- Claude Code's LLM gateway guide
- documented in the Claude Code error reference
- https://claude.ai/restricted
- Claude Help Center article on identity verification
- Anthropic's thinking troubleshooting documentation
- Claude Code model configuration
- Claude Code changelog