Skip to content

exceeded the 64000/128000 output token maximum - Claude Code

Quick fix

Remove or rewrite the rejected MCP tool JSON Schema pattern to prevent Codex OAuth from falsely reporting an output token limit.

Error output
API Error: Claude's response exceeded the 64000/128000 output token maximum

The Codex OAuth backend may reject an MCP tool containing a specific JSON Schema `pattern` before processing the request, then return HTTP 200 with zero input/output tokens, an empty `output`, and `response.incomplete`. This is not actual output truncation.

cc-switch’s Responses→Anthropic converter maps this termination event to `max_tokens`, so Claude Code displays it as an output token limit. Actual output truncation should have non-zero usage; the verified version in this issue was cc-switch v3.20.4.

  1. Check the MCP tool JSON Schema included in the request. Temporarily remove the tool containing a `pattern` regex with nested repeated groups, then retry.

  2. If the tool must remain, replace the verified problematic `^[^/\s]+(?:\/[^/\s]+)+$` with the equivalent flat character class `^[A-Za-z0-9_\-.\/]+$`, then retry the request.

ToolClaude Code
Version3.20.4(已验证受影响)
PlatformsUnknown

(No FAQ yet)

This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.