# CLAUDE_CODE_EXTRA_BODY

> It adds your own fields to each model request.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** CLAUDE_CODE_EXTRA_BODY environment variable

## Think of it like

It is like you put a note in each letter you send.

## Definition

CLAUDE_CODE_EXTRA_BODY is a JSON object that Claude Code adds to the top of each model request. Use it to pass a setting your provider takes but Claude Code has no option for. Some requests outside the chat, such as model checks, do not get it. A value set in your shell also reaches background sessions.

## Example

Lucy's gateway bills by a team tag in the request body. She puts the tag here, and every request carries it.

## Example code

```bash
export CLAUDE_CODE_EXTRA_BODY='{"metadata":{"user_id":"team-a"}}'
claude
```

Tag every request with a team name.

## Why it matters

It lets you use a provider feature the day it ships, with no wait for a new option.

## Common mistake

Writing JSON with a typo. A broken object can make every request fail.

## Three principles

- **JSON object.** Merged at the top.
- **Every model request.** Mostly.
- **For provider extras.** With no option.

## Related terms

- [ANTHROPIC_CUSTOM_HEADERS](https://learn.benibix.com/term/ai/anthropic-custom-headers-variable)
- [ANTHROPIC_BETAS](https://learn.benibix.com/term/ai/anthropic-betas-variable)
- [LLM Gateway](https://learn.benibix.com/term/development/llm-gateway)

---

Source: https://learn.benibix.com/term/ai/claude-code-extra-body-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
