To trace Claude API requests, add an OpenTelemetry destination in the Claude Console (API tracing), register a tracer provider for the Claude SDK (SDK tracing), or both. The API sends a span for each Messages API request, model call, tool use and Managed Agents turn to your monitoring, with timing, status and tokens. In public beta since October 14, 2026.1,2
If your product has an AI feature or an agent built on Claude, that means you can see where a run failed or got slow, next to the rest of your app. And you do not have to wire it by hand: since Claude Code v2.1.309, the /claude-api skill offers API tracing next to SDK tracing when you ask it to add OpenTelemetry.6
Claude API tracing vs SDK tracing
There are two ways to trace Claude API requests, and they fit together. API tracing is set up in the Console and covers any client; SDK tracing is set up in your code and covers what your app does around the call.2 Without either, your traces show a Claude API call as one span: that it happened and how long it took, not that the agent ran three model requests, a web search and an MCP tool, or which of them failed.
| API tracing | SDK tracing | Both | |
|---|---|---|---|
| Set up in | Claude Console (or Admin API) | Your code: a tracer provider | Both |
| Permission | Admin role | None | Admin role |
| Covers | Any client | Apps using the Claude SDK | Any client |
| Messages API requests | Yes | Yes | Yes |
| Each model run inside a request | Yes | No | Yes |
| Server tools and MCP tools the API runs | Yes | No | Yes |
| Managed Agents turns | Yes | No | Yes |
| Your own tools run by the tool runner | No | Yes | Yes |
| Other API calls, such as file uploads | No | Yes | Yes |
| Where it runs | Claude Platform, Claude Platform on AWS | Any cloud platform | Claude Platform, Claude Platform on AWS |
With both, a request's SDK span and API spans sit in one trace, under your own spans.2 The spans use the OpenTelemetry GenAI semantic conventions, so tools that understand those conventions recognize them without extra setup.2
Which Claude telemetry you need
"Claude" and "OpenTelemetry" now mean three different setups, and search results mix them up. Pick by what you are watching:2,4
| You want to watch | Use | Set up with |
|---|---|---|
| An AI feature or agent in your product that calls the Claude API | Claude API and SDK tracing (this post) | A destination in the Claude Console, and the Claude SDK |
| Agents you run on Claude Managed Agents | Claude API tracing (this post) | A destination in the Claude Console |
| Your team using Claude Code | Claude Code monitoring | CLAUDE_CODE_ENABLE_TELEMETRY and OTEL_* variables |
| An agent built on the Claude Agent SDK | Agent SDK telemetry | The same variables as Claude Code |
The Claude Code side keeps changing too. Its traces use the same GenAI conventions since v2.1.300, which we cover in Claude Code OpenTelemetry: what v2.1.300 changed. Claude Code v2.1.317 (November 3) added anthropic.plan, anthropic.seat_type, anthropic.provider and anthropic.custom_base_url to its OpenTelemetry metrics, events and spans, and fixed exports behind a proxy, which now time out after 10 seconds.7 Those attributes describe Claude Code sessions. They are not in the Claude API span reference, so do not expect them on your API traces.8
What a trace shows you
Here is the shape of one Managed Agents chat request, simplified from Anthropic's example. Your app receives a message, sends it to a session, and the agent works through a turn:2
Read top to bottom: the first turn made model requests, ran bash, handed part of the work to another thread, then stopped because the model asked for list_issues, a tool your own code runs. Your code ran it, sent the result back, and a second turn started. If anything in that chain failed or was slow, it is the span that is red or long.
For a session with several threads, group spans by gen_ai.conversation.id to read one thread as a transcript, or by anthropic.session.id for the whole session.2 For a plain Messages API request, the shape is the same idea: an anthropic.messages.create span with a span for each model request and each tool the API ran.2
This is what agent monitoring needs: the whole run, not just the final answer. We wrote about why in AI agent monitoring: how to watch agents in production.
Metadata only or full content
Every destination has a content mode, and it is the one real decision in the setup:2
- Metadata only (the default): IDs, timing, status, token counts, and names you chose, such as your agent and tool names and your MCP server names. No prompts, no answers.
- Full content: everything above, plus the system prompt, the messages, the model's output, and tool arguments and results.
Full content is what lets you read why a run went wrong. Metadata only tells you that it went wrong, where, and how long it took. The cost of Full content is that your users' prompts now live in your monitoring tool, under its access and retention rules, so check those first.2
A practical start: Metadata only everywhere, and Full content on a staging workspace, where you debug. Destinations are scoped by workspace, so that split is two destinations.3 Each span holds up to 0.75 MB of content by default; longer prompts are shortened and marked anthropic.content.truncated.2
The token-counting trap
If you build a cost chart on these traces, it is easy to get wrong, because the same tokens appear on more than one span of a request.2
Anthropic's rules, in short:2
- When a request has both an SDK span and an API span (both are named
anthropic.messages.create), sum the API one. Tell them apart by kind: the SDK span isCLIENT, the API span isSERVER. - For API spans of a Messages API request, sum either the
anthropic.messages.createspans or theiranthropic.model_requestspans, never both. - For a Managed Agents session, sum
anthropic.model_requestandanthropic.session.outcome_evaluation. - Do not add the cache attributes to
gen_ai.usage.input_tokens. It already includes tokens read from and written to the cache. - Spans can arrive twice when a delivery is retried, so count each one once by trace ID and span ID.
And treat the chart as an estimate. Delivery is best effort, so a span can be lost, and a caller can leave spans out. For exact usage per API key, Anthropic points to its Usage and Cost Analytics API, grouped by api_key_id.2 More on where token spend goes in LLM observability and cost.
How to set up Claude API tracing
You need the admin role in your Claude Console organization, and a monitoring tool that accepts OTLP over HTTP with protobuf, at an HTTPS URL on port 443.3 If your tool is one of the sixteen partners in Anthropic's docs, pick it as the Provider and the Console asks for its key.2 Otherwise use Custom.
The quickest route is to ask Claude Code. Its /claude-api skill offers API tracing next to SDK tracing, and Anthropic's docs give a ready prompt for it.2,6 To do it by hand in the Console:
This is the setup with Fixter as the destination, which takes standard OTLP over HTTP:3,5
- In the Console, open the OpenTelemetry settings page and click Add destination.
- Fill in the fields like this. Do not add
/v1/tracesto the URL; the API adds it.
- Save, then click Test in the destination's More actions menu. An
anthropic.testspan should arrive. - Send a request from the playground, your app or a Managed Agents session in a covered workspace. Within about a minute the Delivery column shows Healthy.
- In your monitoring, filter on
service.name = claude-platform.
If Delivery shows Failing, hover over it. A 401 or 403 is a wrong header, a 404 a wrong path, and Invalid address a hostname that does not resolve to a public IP.3 The API disables a destination that answers with a redirect or fails every delivery for 24 hours.3
To manage destinations from a script or CI instead of the Console, use the Admin API or the ant CLI. Besides an Admin API key, they accept a service account key, and automated workloads can sign in through Workload Identity Federation.3,9 Claude Code v2.1.309 taught the /claude-api skill the same.6
To get the API spans nested under your own app's spans, also set up SDK tracing and call the SDK inside one of your spans. The SDK passes the W3C traceparent header along, and the API attaches its spans to it.3 If you connect your own MCP server through the MCP connector, the API passes the trace on to it too, so your server's spans join the same trace.3
What it is not
- Not a billing record. Best effort, at least once. Use the Usage and Cost Analytics API for exact numbers.2
- Not Claude Code. Your team's Claude Code sessions need Claude Code's own telemetry setup.4
- Not zero data retention for agents. The Messages API stays eligible with Full content on, but Managed Agents is not eligible for zero data retention.2
- Still beta. Up to 10 destinations per organization, and the details can change.3
Traces of your agent are most useful next to everything else your app does: the request that triggered the run, the database call after it, the error a user saw. Fixter finds and fixes the issues in your app in production, from your coding agent: errors, failing infrastructure, slow requests and downtime. It finds the root cause and fixes it: in your agent over MCP, or as a pull request ready for your review. Nothing to learn, built for small teams. Your app's logs and traces and your Claude API traces arrive over the same standard OpenTelemetry, so a failed agent run and the request around it sit in one place. See how monitoring works in Fixter.
Key takeaways
- To trace Claude API requests, add a destination in the Claude Console (API tracing), set up the Claude SDK (SDK tracing), or both
- In public beta since October 14, 2026, for the Messages API and Managed Agents
- Claude Code's /claude-api skill can set up both for you
- Metadata only is the default; Full content adds prompts and responses to your monitoring
- Tokens repeat across spans: sum one level only, and use the Usage API for exact spend
- Claude Code and the Agent SDK have their own, separate telemetry setup
Frequently asked questions
How do I trace Claude API requests?
Use API tracing, SDK tracing, or both. For API tracing, an admin adds an OpenTelemetry destination in the Claude Console, and the API sends a span for each Messages API request, model call and tool use, with no code change. For SDK tracing, you register a tracer provider in your app and the Claude SDK adds client spans. Both are in public beta.
Does the Claude API support OpenTelemetry?
Yes, in public beta since October 14, 2026. The Claude API can export a span for each Messages API request, model call and tool use, and for each turn of a Managed Agents session, to any monitoring tool that accepts OTLP over HTTP. API tracing works on the Claude Platform and on Claude Platform on AWS.
How do I send Claude Managed Agents traces to my monitoring tool?
In the Claude Console, open the OpenTelemetry settings page and add a destination: choose your provider or Custom, enter the tool's OTLP/HTTP endpoint URL and its authentication header, pick a content mode and the workspaces to cover, then click Test. Spans arrive with service.name set to claude-platform. You need the admin role in the organization.
Can Claude Code set up Claude API tracing for me?
Yes. Since Claude Code v2.1.309, the /claude-api skill offers API tracing next to SDK tracing when you ask it to add OpenTelemetry. Anthropic's docs also give a ready prompt: "Set up OpenTelemetry tracing with the Claude API and Claude SDK".
Does the Claude API send my prompts to my monitoring tool?
Only if you choose Full content. The default, Metadata only, sends IDs, timing, status, token counts and names you chose, such as tool and agent names. Full content adds the prompts and responses. Organizations with a HIPAA, FERPA or K-12 restriction with Anthropic only get metadata from the API, whatever the setting.
Can I use OpenTelemetry traces to count my Claude API spend?
Carefully. Token counts appear on several spans of the same request, so adding them all counts the same tokens twice. Sum only one level, as Anthropic's docs describe. And delivery is best effort, so a span can be lost. For an exact count per API key, Anthropic points to its Usage and Cost Analytics API.
Is this the same as Claude Code's OpenTelemetry?
No. This export covers apps that call the Claude API and Managed Agents sessions. Claude Code and the Claude Agent SDK have their own telemetry setup, through environment variables such as CLAUDE_CODE_ENABLE_TELEMETRY, and Cowork has its own too.
Which monitoring tools work with Claude API traces?
Any tool that accepts OTLP over HTTP with protobuf at an HTTPS URL. Anthropic's docs list sixteen partners with their own setup pages, including Grafana Cloud, Honeycomb, Sentry, Datadog, Langfuse and PostHog, and the Custom provider covers the rest. Fixter accepts it as a Custom destination.
Sources (9), all checked November 11, 2026
- Anthropic, Agent observability on the Claude Platform, October 14, 2026 (launch, public beta, partners)
- Claude API docs, OpenTelemetry tracing for the Claude API (SDK vs API tracing, partners, content modes, example traces, counting tokens)
- Claude API docs, Set up OpenTelemetry with the Claude API (destination fields, Admin API and CLI, workspaces, traceparent, delivery, limits)
- Claude Code docs, Monitoring (Claude Code's own OpenTelemetry setup)
- Fixter docs, OpenTelemetry setup (OTLP over HTTP at ingest.fixter.dev, Authorization header)
- Claude Code v2.1.309 release notes, October 22, 2026 (/claude-api skill: API tracing next to SDK tracing, service account keys and Workload Identity Federation for destinations)
- Claude Code v2.1.317 release notes, November 3, 2026 (new OpenTelemetry attributes, proxy export fixes)
- Claude API docs, OpenTelemetry span reference (spans and attributes the Claude API and SDK emit)
- Claude API docs, Admin API (accepted credentials, Workload Identity Federation for automated workloads)