Report Claude Code metrics to AI Enabler
Configure Claude Code to export usage telemetry to AI Enabler so serverless endpoint consumption appears alongside your other AI Enabler analytics.
When developers use AI Enabler's Serverless Endpoints through Claude Code (see Set up Claude Code with AI Enabler), you can configure Claude Code to report usage telemetry back to AI Enabler. This gives you a unified view of serverless endpoint consumption: token usage, costs, and tool activity across all your AI-assisted coding tools in a single place.
Claude Code supports OpenTelemetry (OTel) natively. Administrators configure telemetry export through Claude Code's managed settings file, so individual developers don't need to set anything up themselves.
Before you start
Before you configure metrics reporting, ensure:
-
You have a Cast AI API key — Generate one from the Cast AI console under AI Enabler > Overview

-
Claude Code is installed in your organization — See Claude Code installation for setup instructions
-
You have access to configure Claude Code's managed settings file — See Claude Code managed settings for file locations by platform
Configure the managed settings file
Add the following env block to your Claude Code managed settings file:
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_LOGS_PROTOCOL": "http/json",
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "https://api.cast.ai/aioptimizer/v1beta/logs:ingest",
"OTEL_EXPORTER_OTLP_LOGS_HEADERS": "Authorization=Bearer $YOUR_CASTAI_API_KEY",
"OTEL_LOGS_EXPORT_INTERVAL": "5000"
}
}Replace $YOUR_CASTAI_API_KEY with the API key you generated from the Cast AI console.
| Variable | Value | Purpose |
|---|---|---|
CLAUDE_CODE_ENABLE_TELEMETRY | 1 | Enables telemetry export in Claude Code |
OTEL_LOGS_EXPORTER | otlp | Exports logs using the OpenTelemetry Protocol |
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL | http/json | Sets the transport to HTTP with JSON encoding |
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT | https://api.cast.ai/aioptimizer/v1beta/logs:ingest | Points the exporter at Cast AI's log ingestion endpoint |
OTEL_EXPORTER_OTLP_LOGS_HEADERS | Authorization=Bearer <key> | Authenticates requests using your Cast AI API key |
OTEL_LOGS_EXPORT_INTERVAL | 5000 | Exports logs every 5 seconds (5000 ms) |
NoteManaged settings have high precedence and cannot be overridden by individual users. For details on how Claude Code resolves settings from multiple sources, see Claude Code settings precedence.
Verify telemetry is reaching AI Enabler
After developers start using Claude Code with the managed settings applied:
- Open Claude Code and run a few prompts to generate telemetry data.
- Navigate to AI Enabler in the Cast AI console and check for incoming usage data.
If data is not appearing, check the following:
- Confirm the managed settings file is in the correct location and contains valid JSON.
- Verify the Cast AI API key is valid and has not expired.
- Ensure the machine running Claude Code has network access to
api.cast.ai.
What data does Claude Code export?
Claude Code's OpenTelemetry events include structured data for each interaction:
- API requests — each API call Claude Code makes, including model, token counts, and cost
- Tool results — tool executions, including tool names and execution parameters
- User prompts — records when a user submits a prompt (prompt content is not exported by default)
Each event includes a prompt.id attribute that ties all activity back to the prompt that triggered it.
Telemetry is opt-in and requires explicit configuration. Raw file contents and code snippets are not included in events. For full details on Claude Code telemetry, see Claude Code monitoring.
See also
Updated 11 days ago
