Skip to content
BENIBIX Learn

CLAUDE_CODE_EXTRA_BODY

AI⌨️ Claude CodeConfiguration

Also known as CLAUDE_CODE_EXTRA_BODY environment variable

It adds your own fields to each model request.

Think of it like

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

Example

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

Why it matters

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

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 code

bash
export CLAUDE_CODE_EXTRA_BODY='{"metadata":{"user_id":"team-a"}}'
claude
Tag every request with a team name.

Common mistake

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

Key takeaways

  1. 1
    JSON object. Merged at the top.
  2. 2
    Every model request. Mostly.
  3. 3
    For provider extras. With no option.