Skip to content
New: answer your agents from your phoneLearn more

See what Claude Code sends to the API.

On each turn, Claude Code sends Anthropic the conversation so far, plus the files the agent read and the output of the commands it ran since your last message. ket can keep a copy of those requests on your Mac and show you what each turn added.

What goes into a Claude Code request

Anthropic's Messages API is stateless, so Claude Code resends the conversation on each turn. A request carries the system prompt, the tool definitions, the conversation so far and anything new since your last message. If the agent read a file, Claude Code puts the file's contents in the next request, along with the output of each command the agent ran. Anthropic's guide to the Messages API describes the format.

Read those requests and you can see what left your Mac, and why a session used up your plan faster than you expected.

Three ways to see what Claude Code sends

Claude Code's own telemetry. Claude Code can log each request and response body through OpenTelemetry. Set these variables in your shell or in ~/.claude/settings.json, since a repository's own settings can't turn telemetry on:

export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_LOGS_EXPORTER=console
export OTEL_LOG_RAW_API_BODIES=file:/tmp/claude-bodies
claude

With file:, Claude Code writes each full body to that folder. Set OTEL_LOG_RAW_API_BODIES=1 and it prints the bodies in the log instead, cut off at 60 KB. Claude Code redacts extended thinking in both modes. Claude Code's monitoring documentation lists the other settings.

A proxy you run. Start a local proxy that forwards to Anthropic and records the traffic, such as mitmproxy in reverse-proxy mode, and point ANTHROPIC_BASE_URL at it:

mitmweb --mode reverse:https://api.anthropic.com --listen-port 8080
ANTHROPIC_BASE_URL=http://localhost:8080 claude

ket's Network view. ket runs that proxy for you in each agent session it starts in a worktree, and lists the requests beside the session that sent them.

Turn on request logging in ket

  1. In ket, open Settings → Network and turn on Log what agents send. It stays off until you turn it on.
  2. Start Claude Code in a worktree. ket logs the sessions it starts from then on, and leaves a session that was already running unlogged.
  3. Open Network in the worktree's right panel, or choose View → Right Panel → Network.

As each session starts, ket sets ANTHROPIC_BASE_URL to a proxy on your Mac. Claude Code signs in as usual, with your subscription or your API key. ket passes your credentials through without storing them, forwards each request to Anthropic unchanged and keeps a copy of the body.

Read a request

The Network view lists the worktree's requests, newest first. Each row shows the model and the request's size, with a green figure for the part this turn added. ket marks a failed request in red, with its status code or no reply, and labels a reply that stopped early cut off.

Click a row to open the request as a tab. The tab shows the JSON this turn added: your new message and the results of the agent's tool calls, plus the system prompt and tool definitions if they changed since the previous request. Images and attached files appear as a placeholder with their size and hash.

Start with the turns that added the most. You might find a whole file where the agent needed twenty lines, or a test run that printed thousands of passing tests. Ask for a line range next time, or trim command output with a hook. If the system prompt keeps growing, shorten your instruction file.

Long lines wrap, and the wrap button or ⌥⌘W turns wrapping off. Select text with the mouse and copy it with ⌘C, or copy the whole body with the Copy button.

Secrets and personal data, flagged

ket checks the new part of each request, meaning what you typed and what the agent's tools read, for text shaped like these:

  • An API key or a private key
  • A Social Security number or a card number
  • A date of birth, a phone number or an email address
  • A public IP address

ket tints a matching row with a tag for what it found, and raises an alert naming the worktree. Open the request and ket scrolls to the first match and shows where it came from, such as your message or the file the agent read. From there you can stop agents reading that file, a rule you can undo in Settings → Permissions. For a key, ket links to the page where you rotate it.

ket flags requests without changing or blocking them, so Anthropic already has whatever you see flagged. ket matches by pattern and misses names and clinical details.

What ket keeps, and where

  • The request body. ket passes each reply to the agent as it arrives, and keeps its status, size, duration and token counts but none of its text.
  • On your Mac. ket stores the bodies under ~/.local/share/ket/network, readable only by your user account, and leaves them out of Help → Export Diagnostics.
  • Five days. ket deletes requests after five days, and deletes a worktree's log along with the worktree.
  • Yours to clear. Delete one request from its tab, clear a worktree's log from the Network view's ⋯ menu, or delete every log in Settings → Network.

What ket doesn't log

  • Claude Code on Amazon Bedrock, Google Vertex AI, Microsoft Foundry or your own ANTHROPIC_BASE_URL. ket leaves those sessions on their route.
  • A session started before you turned logging on, or claude typed in a plain terminal tab.
  • Agents other than Claude Code and Codex. ket logs Codex the same way, over HTTPS and over the WebSocket it tries first.

What you need

  • ket on your Mac, with the Claude Code session started from ket.
  • Claude Code installed and signed in the way you already use it.

Until ket's first release, you build the Mac app from source. To see what those requests cost against your plan, read Make Claude Fable usage limits last longer.