#32280 Passthrough /anthropic logging crashes with KeyError: 'content' on count_tokens (and other non-Messages) response bodies
**Title:** Passthrough `/anthropic` logging crashes with `KeyError: 'content'` on `count_tokens` (and other non-Messages) response bodies
**Labels:** bug, passthrough
---
### What happened
Every `/anthropic` passthrough request to `…/v1/messages/count_tokens` crashes the async logging worker with `LoggingWorker error: 'content'`. The client-facing response succeeds (the body is forwarded fine), but the spend-log write dies, so **both** the `LiteLLM_SpendLogs` row **and** the native `litellm_total_tokens_metric_total` Prometheus counter are dropped for that call. In our fleet this was ~663 errors / 5 min sustained (one per agent token-count preflight).
### Root cause
`AnthropicPassthroughLoggingHandler.anthropic_passthrough_handler` (unary path) unconditionally calls `AnthropicConfig.transform_response`, which does `completion_response["content"]` at `litellm/llms/anthropic/chat/transformation.py` (extract_response_content, ~line 1982 in v1.91.0).
The `count_tokens` endpoint returns `{"input_tokens": N}` — valid JSON, HTTP 200, but **not** a Messages response and with **no top-level `content`**. `_is_streaming_response` gates purely on `content-type: text/event-stream`, so an…