> For the complete documentation index, see [llms.txt](https://docs.revenium.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.revenium.io/instrument-your-agents/setup-claude-code-desktop.md).

# Setup: Claude Code desktop app (OTel telemetry to Revenium)

Configure OpenTelemetry for Claude Code sessions in the Claude desktop app so their AI usage is metered in Revenium.

Claude Code sessions in the Claude desktop app's **Code** tab are metered in Revenium alongside your CLI usage. How you set them up depends on whether your organization manages Claude Code settings centrally.

## If your organization uses managed settings

If your organization deploys Revenium's telemetry settings through the claude.ai admin console (server-managed settings), or as a managed settings file or MDM profile on each device, **Local** sessions in the Code tab pick them up. There is nothing to enter by hand in the desktop app.

The admin console's server-managed settings are available on Claude for Teams and Claude for Enterprise plans. Anthropic's [desktop app documentation](https://code.claude.com/docs/en/desktop#managed-settings) describes how they reach Local sessions:

> Local sessions on this machine: a managed settings file deployed to disk applies. Managed settings pushed remotely through the admin console also reach these sessions on Anthropic’s API when the session authenticates with an eligible login or key, following the same settings precedence as the terminal CLI.

Admin-console delivery needs a direct connection to Anthropic's API and an [eligible credential](https://code.claude.com/docs/en/server-managed-settings#platform-availability), such as a Team or Enterprise login. Sessions routed through Amazon Bedrock, Google Cloud, Microsoft Foundry, or a custom `ANTHROPIC_BASE_URL` skip it; use a managed settings file or a [Claude apps gateway](https://code.claude.com/docs/en/claude-apps-gateway) for those.

## If you are not using managed settings

For an individual setup, enter the values below in the desktop app's local environment editor:

1. In the Claude desktop app, open the **Code** tab.
2. Open the environment dropdown in the prompt box, hover over **Local**, and click the gear icon.
3. In the **Edit local environment** dialog, paste the settings below into the **Environment variables** box (`.env` format, one `KEY=value` per line). The dialog stores these securely and passes them to Claude sessions.
4. Fully quit and relaunch the app.

Anthropic's own [desktop app quickstart](https://code.claude.com/docs/en/desktop-quickstart) covers the Code tab and choosing an environment if you are new to the app.

### Settings to add

Use a **Revenium metering key (`rev_mk_*`)**, not an Anthropic/OpenAI provider key — the Revenium key authenticates telemetry ingest.

```ini
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_METRICS_INCLUDE_ENTRYPOINT=true
```

Field meanings are identical to the CLI managed-settings page (endpoint = Revenium OTLP; header = your metering key; protocol `http/json`; logs exporter `otlp` is how Revenium receives per-call telemetry; metrics `none` because Revenium bills from log events only and answers the metrics endpoint with `410 Gone`; logs export interval 5000 ms, a 5-second flush; include entrypoint `true` so each call records how the session was launched).

## Keep local values out of the way

If your organization manages these settings, leave Revenium telemetry values out of the desktop app's local environment editor. Managed settings already supply them, and a second, hand-entered copy can drift out of date.

Telemetry variables exported in your shell profile are not picked up. Anthropic's [desktop app documentation](https://code.claude.com/docs/en/desktop#local-sessions) notes: "On macOS, when you launch the app from the Dock or Finder, it reads your shell profile, such as `~/.zshrc` or `~/.bashrc`, to extract `PATH` and a fixed set of Claude Code variables, but other variables you export there are not picked up."

Keep the desktop app updated so its sessions follow the behavior described here.

## Collection marker

When the settings come from your organization's managed settings, Desktop sessions carry the organization's managed collection marker (`revenium.middleware.source`), the same as CLI sessions.

## Verify your configuration

Start a short **Local** session in the Code tab and send a prompt. After the next telemetry flush, the session should appear in Revenium under **AI Assistants > Claude Code**, and its individual calls under **Logs**. If nothing appears, check: the metering key is active, the OTLP endpoint matches your Revenium environment, for an individual setup the key and endpoint in the local environment editor are current, and the app was fully quit and relaunched after any change.

## Cloud sessions

**Cloud** sessions started from the desktop app run on Anthropic's infrastructure, not on your machine. Anthropic's [desktop app documentation](https://code.claude.com/docs/en/desktop#managed-settings) states that cloud sessions "receive server-managed settings; device-deployed files don’t reach them, because they run on Anthropic-managed VMs." Revenium's settings reach them through the admin console; a managed settings file, MDM profile, or local environment editor values on your device do not apply to them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.revenium.io/instrument-your-agents/setup-claude-code-desktop.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
