Standard API keys get generic 400 on 4.x models without undocumented billing header

Resolved 💬 3 comments Opened Apr 11, 2026 by seidnerj Closed May 23, 2026

Summary

Standard Console API keys (sk-ant-api03-*) from workspace-restricted accounts receive a generic 400 invalid_request_error with message "Error" when calling 4.x models (claude-sonnet-4-6, claude-opus-4-6). Older models (claude-haiku-4-5-20251001) work fine with the same key and request.

Related: #35269 (similar symptoms with OAuth tokens on Max plan)

Steps to Reproduce

  1. Create an API key from a workspace in the Anthropic Console
  2. Send a minimal Messages API request to claude-sonnet-4-6 or claude-opus-4-6:
curl -s 'https://api.anthropic.com/v1/messages' \
  -H 'anthropic-version: 2023-06-01' \
  -H 'x-api-key: sk-ant-api03-...' \
  -H 'Content-Type: application/json' \
  -d '{"model":"claude-sonnet-4-6","messages":[{"role":"user","content":"hi"}],"max_tokens":50}'
  1. Response: {"type":"error","error":{"type":"invalid_request_error","message":"Error"}}
  2. The same request with claude-haiku-4-5-20251001 succeeds

Workaround

Adding x-anthropic-billing-header as the first block of the system array makes 4.x models work:

{
  "model": "claude-sonnet-4-6",
  "system": [
    {"type": "text", "text": "x-anthropic-billing-header: cc_version=2.1.83.c50; cc_entrypoint=cli; cch=00000;"},
    {"type": "text", "text": "Your actual system prompt"}
  ],
  "messages": [{"role": "user", "content": "hi"}],
  "max_tokens": 50
}

This was discovered by capturing a working Claude Code CLI request via Proxyman and diffing it against our failing request. The billing header in the system body was the only structural difference.

Issues

  1. Undocumented requirement - the billing header is not mentioned anywhere in the API docs. There is no way to discover this without reverse-engineering Claude Code traffic.
  2. Unhelpful error message - "Error" gives no indication of what is wrong. A message like "This API key does not have access to this model" or "Missing required billing attribution" would save significant debugging time.
  3. Inconsistent behavior - Haiku works without the header while Sonnet/Opus don't, making it appear like a model-specific bug rather than an auth/billing issue.

Environment

  • API key type: sk-ant-api03-* (standard Console key, not OAuth)
  • Workspace: restricted workspace within an organization
  • Claude Code version used for traffic capture: 2.1.83
  • OS: macOS (Darwin 25.4.0)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗