Get Started with AI Measurement

Route your AI API calls through the Tailpipe proxy and we measure their energy, carbon, and cost. No application code changes for Claude Code.

About 10 minutes to set up

What you'll set up

Your AI traffic flows through the Tailpipe proxy, which records usage and forwards the request unchanged to your provider. For Claude Code this is two environment variables; other providers need a base-URL change plus one header.

Hosted (recommended)

Point your client at Tailpipe's proxy with a key from your account. Nothing to deploy.

Providers

Anthropic, OpenAI, Gemini, and Mistral are supported through the proxy.

Your keys stay yours

Your provider API key is forwarded to the provider, never stored by Tailpipe.

Self-hosted (advanced)

Prefer telemetry to stay in your own AWS account? That option is available on request.

Prerequisites

  • A Tailpipe account with AI measurement enabled
  • Your existing provider API key (Anthropic, OpenAI, Gemini, or Mistral)

Hosted setup

Get your proxy URL and key

In Tailpipe, open Settings → Setup → AI Usage. Mint your telemetry key (shown once — copy it) and copy the proxy base URL and env-var block shown for your environment. The values there are authoritative; the snippets below are illustrative.

Configure Claude Code

Set two environment variables. No code changes. Pick your operating system:

macOS
# Set them for the current shell
export ANTHROPIC_BASE_URL="https://<your-proxy-url>/tenant/<your-tenant-id>"
export ANTHROPIC_CUSTOM_HEADERS="x-tailpipe-api-key: tp_your_key_here"

# Persist for new shells (zsh is the macOS default)
echo 'export ANTHROPIC_BASE_URL="https://<your-proxy-url>/tenant/<your-tenant-id>"' >> ~/.zshrc
echo 'export ANTHROPIC_CUSTOM_HEADERS="x-tailpipe-api-key: tp_your_key_here"' >> ~/.zshrc
Linux
# Set them for the current shell
export ANTHROPIC_BASE_URL="https://<your-proxy-url>/tenant/<your-tenant-id>"
export ANTHROPIC_CUSTOM_HEADERS="x-tailpipe-api-key: tp_your_key_here"

# Persist for new shells (bash is the default on most distributions)
echo 'export ANTHROPIC_BASE_URL="https://<your-proxy-url>/tenant/<your-tenant-id>"' >> ~/.bashrc
echo 'export ANTHROPIC_CUSTOM_HEADERS="x-tailpipe-api-key: tp_your_key_here"' >> ~/.bashrc
Windows (PowerShell)
# Set them for the current PowerShell session
$env:ANTHROPIC_BASE_URL = "https://<your-proxy-url>/tenant/<your-tenant-id>"
$env:ANTHROPIC_CUSTOM_HEADERS = "x-tailpipe-api-key: tp_your_key_here"

# Persist for new sessions, then reopen your terminal
setx ANTHROPIC_BASE_URL "https://<your-proxy-url>/tenant/<your-tenant-id>"
setx ANTHROPIC_CUSTOM_HEADERS "x-tailpipe-api-key: tp_your_key_here"

Other providers (OpenAI, Gemini, Mistral)

Point the provider's base URL at the route shown on the AI Usage page, then send the same x-tailpipe-api-key header. The base URL can be an environment variable for some SDKs (OPENAI_BASE_URL, MISTRAL_BASE_URL); the Gemini SDK sets it in code. The header is the part that always takes a line of code — none of these SDKs expose an environment variable for a custom header, the way Claude Code does with ANTHROPIC_CUSTOM_HEADERS:

# Other providers: set the base URL to the route shown on the AI Usage page,
# and send the x-tailpipe-api-key header via your SDK's custom-headers option.
# Example — OpenAI Python SDK (the header needs a config line, not just an env var):
client = OpenAI(
    base_url="https://<your-proxy-url>/openai/v1",
    default_headers={"x-tailpipe-api-key": "tp_your_key_here"},
)

Only the header needs code, so that line is the same on macOS, Linux, and Windows.

How authentication works

Two credentials travel with each request, and they do different jobs. You still send your normal provider credential (x-api-key or Authorization: Bearer) — Tailpipe forwards it to the provider and never stores it. The separate x-tailpipe-api-key header is what Tailpipe reads to attribute the usage to your account, and it is a credential: treat it like a secret. Don't commit it to source control or paste it into tickets. If it's ever exposed, rotate it from the AI Usage page and the old value stops working within about a minute.

Your data stays private

The proxy measures your usage without reading what you send or receive. It records the metadata it needs to attribute and cost the call, then forwards the request to your provider unchanged.

  • Prompts are never captured. Your message content passes straight through and is not logged or stored.
  • Responses are never captured. The model's reply is returned to you unchanged and is not stored.
  • Your provider key is never stored. Tailpipe forwards it to the provider and keeps no copy.
  • Only metadata is measured. Model name, token counts, latency, and status. Nothing from the body of the request or the reply.

Self-hosted setups go one step further: the telemetry never leaves your own AWS account, and Tailpipe reads it cross-account, read-only.

Deploying across a fleet

Rolling this out to hundreds of machines is a config-management job, not a bespoke one. The setup is two environment variables, so it goes through whatever tooling you already use for endpoints:

  • macOS: an MDM configuration profile (Jamf, Intune), or a managed /etc/zshenv script.
  • Linux: Ansible, Puppet, Chef, or Salt writing /etc/profile.d/tailpipe-ai.sh, or baked into your golden image or container base image.
  • Windows: a Group Policy or Intune environment-variable policy.

The base URL isn't a secret (it only carries your tenant id), so you can bake it straight into images and policies. The x-tailpipe-api-key is a secret, so distribute it through the secret manager you already run (Vault, AWS Secrets Manager, 1Password, an Intune secure value) and have each machine read it into the environment variable at login, rather than hardcoding it into a shared image. Your tenant has one active telemetry key at a time; to rotate it, mint a replacement and push it out, and the old key stops working within about a minute.

Usage is measured per tenant, by design

Telemetry attributes to your organization as a whole, never to an individual machine or developer. That's deliberate. Tailpipe measures your fleet's aggregate energy, carbon, and cost without recording who ran what, so you get accurate emissions data for the organization and no one gets a per-person usage trail as a side effect.

Self-hosted (advanced)

If your data-governance requirements mean telemetry must stay inside your own AWS account, you can run the proxy yourself: a small stack writes telemetry to an S3 bucket in your account, and Tailpipe reads it cross-account, read-only. Setup is a provided script plus a one-time handback so we can read your bucket.

The self-hosted setup kit is available on request — contact us and we'll send it over with the walkthrough.

When your data appears

Usage is batched and aggregated once a day, so allow up to about 25 hours before new activity shows on the dashboard: your calls are buffered for roughly a minute at the proxy, then a daily compaction job runs at 01:00 UTC, then ingestion aggregates the day's data. Not seeing your first day's usage until the next day is normal.

Verifying, pricing, and troubleshooting

Verify it's working

The AI Usage page shows a "telemetry received (last 48h)" indicator once your traffic is flowing. Self-hosted setups include their own verification step.

Pricing & coverage

Per-model energy and cost factors are maintained by Tailpipe — you don't configure pricing. A brand-new model may record usage before its pricing lands; if a model looks unpriced, let us know.

"tenant_id is required" (400)

Your base URL is missing its /tenant/<id> segment. Copy the full URL from the AI Usage page.

No data yet

Usually just the ~25-hour aggregation delay — wait a day before worrying. If a request errors with "model not found", that's an upstream provider error, not Tailpipe.

Need help getting set up?

Check our FAQs or get in touch — we're happy to walk you through it.