Skip to content
BENIBIX Learn

OTEL_LOG_RAW_API_BODIES

AI⌨️ Claude CodeConfiguration

Also known as OTEL_LOG_RAW_API_BODIES=1, CLAUDE_CODE_OTEL_CONTENT_MAX_LENGTH

It logs the full JSON of each model request and answer.

Think of it like

It is like you keep a copy of each whole letter. Not just the front.

Example

Lucy's gateway rejects one request, and she cannot see why. She saves the raw bodies to a folder and finds the bad field.

Why it matters

When a request fails in a strange way, the raw body shows exactly what was sent.

Definition

OTEL_LOG_RAW_API_BODIES logs the full JSON of each model request and answer. Set it to 1 to put the bodies in the log, cut at 60 KB by default. Set it to file: and a folder to save whole bodies to disk instead. Each body holds the whole chat so far, so it is off by default.

Example code

bash
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_LOG_RAW_API_BODIES=file:/tmp/claude-bodies
claude
Save whole request bodies to a folder.

Common mistake

Leaving it on. The bodies hold your whole chat, code included, and grow fast.

Key takeaways

  1. 1
    Full JSON. Request and answer.
  2. 2
    1 or file:. Inline or to disk.
  3. 3
    Off by default. Holds the whole chat.