CLAUDE_CODE_ATTRIBUTION_HEADER
Updated by Alex Sorokoletov
CLAUDE_CODE_ATTRIBUTION_HEADER controls the attribution block (client version and prompt fingerprint) that Claude Code puts at the start of the system prompt; 0 omits it. Default: on, the block is sent. Values: 0, false, no or off (case-insensitive) omits the block; any other value, or unset, keeps it. Present since v2.1.69 or earlier and still present in v2.1.332. It is listed in the official reference.
Full guide: CLAUDE_CODE_ATTRIBUTION_HEADER: Fix Bedrock 400 Errors & Prompt Caching Issues
| Status | Present in v2.1.332 |
|---|---|
| Added | Present since v2.1.69 or earlier |
| Default | on, the block is sent |
| Values | 0, false, no or off (case-insensitive) omits the block; any other value, or unset, keeps it |
| Category | Other |
| Official docs | Listed |
| Checked against | v2.1.330 |
How to set it
For one session, export it in the shell that starts Claude Code:
export CLAUDE_CODE_ATTRIBUTION_HEADER=0
claude0 keeps the block out of the prompt when a gateway reshapes system content or sends requests to a third-party provider.
To apply it to every session, add it to the env object of a settings file:
// ~/.claude/settings.json
{
"env": {
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0"
}
}Known issues
- On a direct connection to api.anthropic.com the variable does not change caching, because the API strips the block when it arrives first and unchanged. It matters when a gateway reorders, merges or converts the system array, or forwards to another upstream. Source: docs: gateway protocol.
- Claude Code keeps the block on auto mode classifier requests to api.anthropic.com even with 0 set. Before v2.1.229, setting 0 on a direct connection made auto mode fail on every tool call. Source: issue #64585.
- Bedrock rejected the block with a 400 reserved keyword error in v2.1.37, and 0 was the workaround. Before v2.1.181 the block also held a per-request token on custom base URLs, which broke gateway caching; current versions do not add it there. Source: issue #24168.
Release notes that mention it
- How Much Does Claude Code Cost? Plans, API, OpenRouter and Bedrock Prices
- Claude Code "self signed certificate in certificate chain": NODE_EXTRA_CA_CERTS, CLAUDE_CODE_CERT_STORE and the emSign Block
- Claude Code --client-data-url: Signed Model Configuration and --allow-other-models
- CLAUDE_CODE_ATTRIBUTION_HEADER: Fix Bedrock 400 Errors & Prompt Caching Issues
- 83 Undocumented Claude Code Environment Variables (v2.1.19)
Related variables
CLAUDE_CODE_ATTRIBUTION_ANNOUNCEMENT: When set, controlled whether an attribution announcement was computed and added to the context window; defaulted to on.CLAUDE_CODE_ATTRIBUTION_PROJECT: Sets the attribution project; a non-empty value is resolved to a tagged project id with source 'harness' and takes precedence over project and user settings.ANTHROPIC_BETAS: Comma-separated beta feature headers.ANTHROPIC_CUSTOM_HEADERS: Custom HTTP headers (newline-separated Key: Value).ANTHROPIC_FEDERATION_RULE_IDANTHROPIC_ORGANIZATION_IDANTHROPIC_WORKSPACE_IDBETA_TRACING_ENDPOINT: Custom endpoint for beta tracing.
Frequently asked questions
What does CLAUDE_CODE_ATTRIBUTION_HEADER do?
Controls the attribution block (client version and prompt fingerprint) that Claude Code puts at the start of the system prompt; 0 omits it.
What is the default value of CLAUDE_CODE_ATTRIBUTION_HEADER?
On, the block is sent.
What values does CLAUDE_CODE_ATTRIBUTION_HEADER accept?
0, false, no or off (case-insensitive) omits the block; any other value, or unset, keeps it.
Which Claude Code version has CLAUDE_CODE_ATTRIBUTION_HEADER?
Present since v2.1.69 or earlier and still present in v2.1.332.
How do I set CLAUDE_CODE_ATTRIBUTION_HEADER?
Export it before starting Claude Code (export CLAUDE_CODE_ATTRIBUTION_HEADER=0), or add it to the "env" object in ~/.claude/settings.json to apply it to every session. 0 keeps the block out of the prompt when a gateway reshapes system content or sends requests to a third-party provider.
All variables, searchable: Claude Code environment variables.