Claude Code Auto Mode With a Third-Party API: Why It Breaks and How to Fix It

Fix the "Auto mode can't check actions in this session" error when Claude Code runs behind DeepSeek, a proxy, or an LLM gateway — what changed in 2.1.319 and the exact settings.

If you run Claude Code against a third-party Anthropic-compatible endpoint — DeepSeek, GLM, Kimi, OpenRouter, LiteLLM, or your own proxy — auto mode can suddenly stop approving anything and answer with this:

Auto mode can't check actions in this session. Its safety check runs on the server,
and your requests go through api.deepseek.com, which doesn't pass it through.
Actions that need the check now ask for your approval.

Other sessions show the same problem with different wording: Auto mode could not evaluate this action and is blocking it for safety, The server-side auto mode classifier gave no verdict, or in headless runs a bare exit code 1.

The cause is a change on Anthropic’s side, not a broken config. This post explains what changed, which setups are affected, and the three ways to get a working auto mode back.

What actually changed

Auto mode’s safety decisions can come from two places:

  1. Server-side review — the check travels with the session’s normal model requests as an extra beta header and body field. The provider runs it and returns a verdict.
  2. Claude Code’s own classifier — a separate classifier request made by the client, billed as normal token usage.

For a while, a call the server could not check quietly fell back to the local classifier. Claude Code 2.1.319 (November 6, 2026) removed that fallback for a specific group of sessions. From the changelog:

Changed auto mode with telemetry or feature flags off, including behind LLM gateways: calls the server can’t check are asked about or denied, with no fallback to the built-in classifier; set CLAUDE_CODE_AUTO_MODE_SERVER=0 to keep using it (Bedrock, Vertex and Foundry are unchanged)

That is a precise description of most third-party setups:

  • Requests go through a gateway or proxy, and the upstream never returns Anthropic’s safeguard_results field, so the server cannot issue a verdict.
  • Telemetry is disabled — common in privacy-conscious setups and in CI — which is one of the conditions that switches the fallback off.

Put both together and auto mode has no classifier at all. Every action that needs a review is refused or asks for manual approval. Headless claude -p runs got stricter too: they now exit with code 1 when actions are refused for lack of a check, so pipelines that used to show green while doing nothing fail visibly.

The default had already moved this direction earlier: 2.1.278 made server-side review the default for gateways, cloud providers, and the Claude API, and 2.1.281 extended CLAUDE_CODE_AUTO_MODE_SERVER to direct connections. 2.1.319 was the release that made the fallback unavailable in gateway sessions with telemetry or feature flags off.

Fix 1: force Claude Code’s own classifier

The documented escape hatch, and the most reliable fix for a third-party endpoint, is to tell Claude Code not to ask the server for checks at all:

export CLAUDE_CODE_AUTO_MODE_SERVER=0

Put it in your shell profile, in the launcher script for that provider, or in the env block of your settings file:

{
  "env": {
    "CLAUDE_CODE_AUTO_MODE_SERVER": "0"
  }
}

Restart the session — the variable is read at launch. In auto mode, classifier requests are then always Claude Code’s own, billed as token usage like before. The billing notice does not appear, and auto mode works again even with telemetry disabled.

Two things to know:

  • It costs tokens. The local classifier is a model call, separate from your main conversation. On a pay-per-token endpoint this shows up on the bill.
  • It is documented as temporary. The setting may be removed in a later release, and the notice introduced in 2.1.327 says an upcoming release removes the fallback entirely. Treat this as a working fix for now, not a permanent architecture.

Fix 2: keep the server check and allow the fallback

If your endpoint can sometimes pass the check through and you prefer the server path, the local fallback is allowed when telemetry and feature flags are on. In that configuration Claude Code asks the server, and when no verdict arrives it falls back to its own classifier and shows a notice:

We're changing auto mode to no longer charge for classifier requests in Claude Code.
However, this session isn't eligible because your requests go through <host>...

Press Enter to continue: the held action runs, the rest of the session uses Claude Code’s own classifier, and the notice does not reappear in that session. When the notice named a gateway, the acknowledgment is remembered for 24 hours on that machine. Esc or Ctrl+C cancels the held action instead.

This path is only available if you have not disabled telemetry or feature flags. If you turned those off deliberately, Fix 1 is the better fit.

Fix 3: make the gateway pass the check through

The clean long-term solution is for the gateway to behave like a transparent proxy. Anthropic’s gateway compatibility guide lists what has to survive:

  • Requests: forward the anthropic-beta header and the safeguards body field unchanged. They travel as a pair, so stripping one without the other does not work.
  • Responses: return them without dropping fields, and keep safeguard_results so the verdicts reach Claude Code. Do not rewrite tool-use IDs or streaming events.

If both sides are handled, new sessions use the server-side check again and no local classifier is needed. Gateways that only translate the message format and drop unknown fields will keep failing this, which is why the local-classifier workaround remains the practical option for most third-party endpoints.

If auto mode still cannot work

Auto mode is not the only prompt-free option, and on some setups it is not the right one:

  • acceptEdits runs edits and common filesystem commands, and asks for the rest. Fewer prompts, not zero.
  • dontAsk never prompts, but denies anything that is not already allowed. Combine it with explicit permissions.allow rules to define exactly what may run.
  • bypassPermissions runs everything without asking. Deny rules are still enforced, but this is the same mechanism as --dangerously-skip-permissions — scope it to a launcher or a sandbox, not to every session.
  • permissions.denyInsteadOfPrompting (added in 2.1.319) denies calls that would otherwise wait on a prompt and lets the turn continue. Useful for unattended runs where a hanging prompt is worse than a refusal.

You can also verify which path a session uses: /status has an Auto mode server row that reads Enabled while the server’s checks decide actions, and Disabled once the session has fallen back.

A quick checklist

  1. Update to at least 2.1.319 and check /status to see whether the server check is actually reaching the session.
  2. Behind a third-party endpoint with telemetry off: set CLAUDE_CODE_AUTO_MODE_SERVER=0 and restart.
  3. Keep an eye on the changelog — the local fallback is on a deprecation path, and gateways that implement the safeguards pass-through will be the only ones with server-side auto mode.
  4. For CI, make sure headless runs handle exit code 1 instead of assuming success.

The error looks like a broken installation. It is really a protocol mismatch: auto mode needs a safety verdict, the gateway cannot produce one, and since 2.1.319 the client no longer silently substitutes its own. Once you know which of the two classifiers you are allowed to use, the fix is a one-line environment variable.

Further reading: