Setup Claude Code
Claude Code supports centrally-managed configuration through the Claude admin console. An administrator defines the settings once; Anthropic delivers them to every authenticated user on next startup. No per-developer install is required.
This is different for individual developer onboarding and does not cover historical backfill - please refer to this document for details on how to do that or go direct to https://github.com/revenium/revenium-cli-node
Requirements:
Claude for Teams or Claude for Enterprise plan
Claude Code version that supports managed settings
Administrator role of Primary Owner or Owner in the Claude admin console
Direct connection to
api.anthropic.comfor server-managed settings
Claude Code evolves quickly. Anthropic updates environment variables, managed-settings fields, and admin console paths frequently. If something does not match what you see in the Claude admin console, cross-reference Anthropic's Claude Code monitoring and server-managed settings docs. The Revenium-specific values below, including the endpoint URL, API key header, and resource attributes, are the values to keep consistent.
Steps:
Sign in to Claude.ai as Primary Owner or Owner.
Navigate to the Managed settings screen. Depending on plan and admin console version, this appears under Admin Settings → Claude Code → Managed settings or Organization settings → Claude Code → Managed settings.
Paste the following JSON, substituting your Revenium metering key.
Use a Revenium metering key (rev_mk_*) for Claude Code OTLP telemetry. Do not use an Anthropic/OpenAI provider key here; provider keys authenticate model calls, while the Revenium key authenticates telemetry ingest.
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://api.revenium.ai/meter/v2/otlp",
"OTEL_EXPORTER_OTLP_HEADERS": "x-api-key=rev_mk_your_tenant_yourkey",
"OTEL_EXPORTER_OTLP_PROTOCOL": "http/json",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_METRICS_EXPORTER": "none",
"OTEL_LOGS_EXPORT_INTERVAL": "5000",
"OTEL_RESOURCE_ATTRIBUTES": "revenium.middleware.source=managed-settings"
}
}Click Add settings or save the managed settings.
Ask developers to fully quit and relaunch Claude Code after the config push.
On first launch after the settings are picked up, each developer may see a one-time security approval dialog listing the managed environment variables. They should approve the administrator-delivered configuration.
Verifying Your Configuration
Ask a developer to run a brief Claude Code session. Usage should appear in Revenium after the next telemetry flush. Your Revenium tenant is identified by the metering key, and Claude Code attaches the developer identity it knows for the session. If your organization uses direct API keys, Bedrock, Vertex, Microsoft Foundry, or a custom ANTHROPIC_BASE_URL, attach identity yourself with OTEL_RESOURCE_ATTRIBUTES.
If no sessions appear after configuring the settings, check:
The Revenium metering key is active in your Revenium account
The OTLP endpoint matches your Revenium environment
The developer fully quit and relaunched Claude Code after the config push
Field reference
OTEL_EXPORTER_OTLP_ENDPOINT— Revenium's OTLP endpoint. For most customers this ishttps://api.revenium.ai/meter/v2/otlp.OTEL_EXPORTER_OTLP_HEADERS— Your Revenium metering key, prefixed withx-api-key=.OTEL_EXPORTER_OTLP_PROTOCOL— Must behttp/json.OTEL_LOGS_EXPORTER— Must beotlp. This enables log export, which is how Revenium receives per-call telemetry.OTEL_METRICS_EXPORTER— Must benone. Revenium bills from log events only; leaving metrics enabled is unnecessary and increases HTTP traffic without adding data.OTEL_LOGS_EXPORT_INTERVAL— Milliseconds between log-batch flushes.5000matches Claude Code's documented/default flush interval.OTEL_RESOURCE_ATTRIBUTES— OTEL resource attributes attached to every event from this deployment. The required valuerevenium.middleware.source=managed-settingstags telemetry as originating from a centrally-managed settings deployment. Per-developer CLI installs are automatically taggedrevenium-cli, so the two deployment channels are separable in Revenium reporting. If you add your own attribution labels, append them comma-separated to this value (see Optional Internal Attribution below).
Optional Internal Attribution
The required configuration above is enough for correct metering and dashboard attribution. If you want to sub-segment your own Claude Code usage within your Revenium tenant — for example to compare spend across business units, teams, or internal product lines — extend the existing OTEL_RESOURCE_ATTRIBUTES value by appending your labels comma-separated after revenium.middleware.source=managed-settings:
Keep revenium.middleware.source=managed-settings as the first entry — do not remove it. The additional labels are yours to define. They are not matched against any existing list in Revenium. Choose labels that make sense for your internal reporting.
organization.name— a business unit, department, or cost center, such asEngineering,DataPlatform, orMarketingproduct.name— the application or use case, such asinternal-claude-code
OTEL_RESOURCE_ATTRIBUTES formatting constraints:
No spaces in values. Use underscores, camelCase, or percent-encoding (
%20) instead, for exampleorganization.name=Data_Platformororganization.name=DataPlatform, notorganization.name=Data Platform.Values are case-sensitive.
Engineeringandengineeringare treated as separate labels. Pick a canonical form and use it consistently across all configuration and integrations.
Third-party provider compatibility. Server-managed settings are delivered from Anthropic's servers and require a direct connection to api.anthropic.com. They are not delivered when Claude Code is routed through Amazon Bedrock, Google Vertex AI, Microsoft Foundry, or a custom endpoint via ANTHROPIC_BASE_URL or an LLM gateway. If your organization uses one of these providers, use endpoint-managed settings or the per-developer CLI setup instead.
Managed settings override user-level configuration. Values defined in the managed settings env block take precedence over shell-exported environment variables on each user's machine, including values the Revenium CLI may have previously set.
Last updated
Was this helpful?