Claude Code

Send Claude Code's own telemetry to Provantix and its model calls and tool calls appear as records, tagged by team, tied to the person using it, with no code to write. This page says exactly what that carries and what it does not.

Status: built from Claude Code's published monitoring documentation (versions up to 2.1.324, read 2026-11-15) and tested with payloads made from it. It has not been run from a live Claude Code session, so check the first delivery against Connectors and the Setup page. Another coding assistant, OpenAI Codex, has its own page: Codex.

Two ways to send it

Claude Code exports log events (stable) and traces (a beta). Send either. Provantix does not take metrics.

Log events (recommended) Traces (beta)
What arrives one event per model request and per tool result a span per request and per tool, grouped by prompt
Claude Code's own cost yes, cost_usd on each request no: the spans carry tokens, not cost
Cache tokens yes yes
The person user.email on every event user.id only, where sent
Run view grouped by the prompt's id grouped by trace

If both are sent, the same request is recorded once: the log event and the span take the same key, the request id, and the first to arrive is kept.

Why not metrics. A metric (claude_code.cost.usage, claude_code.token.usage) is a running total by model. It has no call, no person and no record behind it, so it cannot be traced to anything, and it would count the same spend a second time. A delivery of metrics is refused with that reason.

Set it up

  1. On Setup, under Connect a gateway or OTLP source, create a token. Set the default agent only if you want every session under one name; leave it empty to attribute each session to the user id Claude Code sends.
  2. Set these where Claude Code runs (your shell profile, or its settings file):
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http/json     # Provantix takes the JSON encoding
export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://app.provantix.tech/v1/logs
export OTEL_EXPORTER_OTLP_LOGS_HEADERS="Authorization=Bearer pvx_otlp_..."
# the team, set once per machine (see Tags, below)
export OTEL_RESOURCE_ATTRIBUTES="department=engineering,cost_center=eng-123"

For traces as well or instead, add CLAUDE_CODE_ENHANCED_TELEMETRY_BETA=1, OTEL_TRACES_EXPORTER=otlp, OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/json and OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://app.provantix.tech/v1/traces with the same header. Leave OTEL_METRICS_EXPORTER unset.

Claude Code's default protocol for an https endpoint is protobuf from 2.1.323. Provantix takes the JSON encoding, so set the protocol to http/json as above.

What becomes a record

Claude Code Record
Event claude_code.api_request, or span claude_code.llm_request A model call: the model, input and output tokens, the cache read and cache creation counts, how long it took, Claude Code's cost_usd as its own figure.
Event claude_code.api_error A failed model call, with no tokens.
Event claude_code.tool_result, or span claude_code.tool A tool call: the tool name, whether it succeeded, how long it took.

Tokens. Claude Code's input_tokens leaves out the cache, as Anthropic reports it. Provantix adds the cache read and creation counts back, so input means the same as for every other provider, and prices each kind at its own rate. See Token kinds.

Cost. Claude Code's cost_usd is stored as reported by Claude Code, beside Provantix's estimate from your own price table. It never replaces the estimate. Add a price row for each Claude model you use (Settings, Cost tab, Model prices) or the estimate shows as not recorded; Claude Code's figure still shows.

The person. Every event carries user.email; a span carries user.id, an anonymous id Claude Code keeps on the machine. The person is the email where there is one, else the user id. Only a handle (a one-way code) is kept, never the address, so the people directory can place the call in a department.

Tags. Claude Code puts OTEL_RESOURCE_ATTRIBUTES on every event and span. For these events only, the bare names department, cost_center, product, project and environment are read as the cost tags, so a team sets them once per machine or per repository. provantix.cost.department and the other documented names work too and win. Any other key (such as team.id) is not a tag unless an admin lists it.

All records of one prompt share a run, so the run view shows them together. The session id is kept.

What is not captured

  • No content. Prompt text, assistant responses, tool input and output, file paths, commands and raw API bodies are held back by Claude Code by default (OTEL_LOG_USER_PROMPTS, OTEL_LOG_TOOL_DETAILS and the like are off) and are never read by Provantix even when switched on: only the numbers and names above are taken.
  • Session counts, lines of code, commits, the permission decision (tool_decision) and the time spent are not taken. So what a person answered at a permission prompt is not recorded here.
  • No destination check. A Claude Code tool call is the assistant's own account of what it did. Nothing here confirms the effect in another system.
  • Who the agent is is the user id Claude Code sends, or the default agent you set. It is not a verified identity.

If nothing appears

  • Connectors shows nothing received from this source yet for a token that has never delivered, and the Setup page shows the last delivery. A rejected delivery names why.
  • A wrong_signal error means a metrics exporter, or logs that are not Claude Code's or Codex's, are pointed at this endpoint.
  • A payload is not valid JSON error usually means the protocol is protobuf: set it to http/json.
  • No claude_code.* events at all: check CLAUDE_CODE_ENABLE_TELEMETRY and OTEL_LOGS_EXPORTER. No spans: check CLAUDE_CODE_ENHANCED_TELEMETRY_BETA.