Get started
Track Claude Code
Claude Code can export its usage with OpenTelemetry. Point it at Zexl to see what your coding sessions cost, by model and by repository. No SDK and no code change.
Set up
- In the dashboard, open Setup (or onboarding), choose Claude Code and an environment (usually Development), and create the key.
- Put these in your shell profile (
~/.zshrcor~/.bashrc), with your key:
export CLAUDE_CODE_ENABLE_TELEMETRY=1 export OTEL_LOGS_EXPORTER=otlp export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf export OTEL_EXPORTER_OTLP_ENDPOINT=https://zexl-intake.fly.dev export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer zx_<id>_<secret>"
- Open a new terminal and start
claude. Send a prompt. The call appears on the setup page within seconds.
The header takes the key without the part after the dot. Claude Code does not hash prompts, so it does not need the salt.
You can also put the same variables under "env" in Claude Code's settings.json, or use your organisation's managed settings to turn it on for a whole team.
What is sent
Per API request: model, input and output tokens, cache read and cache write tokens, cost estimate, duration, and errors with their status code. Prompts and code are not sent unless you turn that on yourself, and Zexl drops them if they arrive.
What you see
| Field | From |
|---|---|
| Run | One Claude Code session |
| Feature | Repository name when Claude Code reports it, else the kind of request |
| Actor | Claude Code's user id |
| Cost | Claude Code's own estimate |
Patterns that apply: prompt caching not used, growing context, and retries from API errors. Loops and cut-off answers need hashes that Claude Code does not send.
Pro and Max plans
On a Pro or Max plan you are not billed per token. The cost shown is what the same usage would cost on the API, which is useful for comparing sessions, models and repositories.
Further reading
- Claude Code cost tracking: what to look at once the data arrives.