Skip to main content
OpenRouter routes model calls across many providers — Claude, GPT, Gemini, Llama, Grok, Mistral, and more — from a single balance. OpenRouter’s Broadcast feature exports a trace for every completed request, and Terma accepts those traces directly on its OpenTelemetry endpoint. Once connected, each routed call appears in Terma with the model it actually hit, the provider that served it, the tokens it used, and the cost charged against your OpenRouter balance. No agent, SDK change, or proxy is required. The connection is configured once in OpenRouter and applies to every request made with the keys you enable it for.

How it works

  1. You create an Ingest only team API key for a Terma team. It can send telemetry to that team but cannot read the team’s sessions or metrics.
  2. In OpenRouter, you add Terma as an OpenTelemetry Collector destination under Broadcast, using Terma’s OTLP endpoint and the team API key as a bearer token.
  3. After every request, OpenRouter asynchronously posts an OTLP trace to Terma. Terma recognises the OpenRouter format, applies the team’s collection policy, records a model call with tokens and cost, and groups calls into sessions.
Traces are sent after the request completes, so enabling Broadcast does not add latency to your OpenRouter calls.

Before you start

  • A Terma team. Every team API key is scoped to one team, and OpenRouter traffic lands in that team.
  • A collection policy on that team, set by an organization admin on Team settings → Data collection. Until the team has one, Terma accepts OpenRouter’s traces but stores none of them.
  • Access to the OpenRouter account or organization whose traffic you want to track. Editing an organization’s Broadcast settings requires an OpenRouter organization admin.

Setup

1

Get connection details from Terma

You need two values from Terma: the OTLP endpoint (for example https://otel.terma.ai) and a team API key.
  • Setting up a new team? In the team’s setup guide, choose Other, then the OpenRouter format. Terma shows the endpoint and headers to paste, filled in with the team’s auto-created Ingestion key.
  • Existing team? Open Team settings → API keys and create a key with a recognizable name such as OpenRouter, keeping Ingest only selected. The panel shows the OTLP endpoint above the keys.
The panel shows a new key in full only when you create it, so copy it before leaving the page. You can revoke it later from Team settings → API keys.
2

Enable Broadcast in OpenRouter

In OpenRouter, open Settings → Observability and turn on Enable Broadcast.Find OpenTelemetry Collector in the destination list and click its edit icon.
3

Add Terma as the destination

Fill in the destination with the values from step 1. OpenRouter needs the full traces URL, so append /v1/traces to the endpoint Terma showed you.Endpoint
Headers (optional) — a JSON object carrying your Terma team API key:
Click Test Connection. OpenRouter sends a small synthetic span to Terma and only saves the destination if Terma accepts it.
Leave the destination’s sampling rate at 1.0. Sampled-out requests never reach Terma, so any lower rate undercounts spend.
4

Make a request and verify

Send any request through OpenRouter with a key covered by the Broadcast settings you just edited. Within a minute, the call should appear in Terma:
  • Overview lists openrouter under Spend by source
  • Sessions shows the request as a session, with the model and provider that served it

What Terma captures

Cost comes straight from OpenRouter’s own accounting, so it matches the drawdown on your OpenRouter balance rather than a Terma-side estimate.

Attributing calls to people and sessions

OpenRouter identifies each call by the API key that made it, and Terma uses that key as the principal for the call. The key’s name in OpenRouter is what you will see on Terma’s Users page. To get useful attribution:
  • Use one OpenRouter key per person or per service, named after them. A single shared key makes every call look like the same actor.
  • Map keys to people in the Terma dashboard under Team settings → Principals. An organization admin can seat an OpenRouter key to the person who owns it, or give it an alias, so their OpenRouter usage sits alongside their Claude Code or Codex activity.
To group related requests into one Terma session, pass a session_id in the request body (or an x-session-id header). Every call sharing that value lands in the same session:
Without a session_id, each request is its own session.
OpenRouter traffic from a key that is not mapped to a person appears under that key’s name. Map the key to its owner under Team settings → Principals.

Collection policy

OpenRouter sends to Terma directly, not through the terma CLI, so Terma applies the team’s collection policy on its server when each trace arrives, before anything is stored: Repository selection applies only to the coding agents the Terma CLI sets up, since the CLI reads the repository each session runs in (see where the policy is applied). OpenRouter calls aren’t matched against the list, so under Only the repositories listed Terma keeps their usage whatever the list holds, and spend tracking is unaffected. The policy is applied after OpenRouter has sent the trace. For a guarantee that prompts and completions are never sent to Terma at all, use Privacy Mode.

Privacy Mode

OpenRouter’s Broadcast settings include a Privacy Mode that strips prompts and completions from exported traces. It is set per destination: select Privacy Mode in the Privacy section of the Terma destination. With it enabled, OpenRouter never sends that content to Terma, and Terma still receives model, provider, tokens, cost, and timing for every call, so spend tracking is unaffected. Session replay will show the call structure and usage but not the conversation text.

Multiple OpenRouter accounts or organizations

Broadcast settings live on the OpenRouter account or organization, and each Terma team API key belongs to one team. To send traffic from several OpenRouter organizations to Terma, configure Broadcast in each one. Point them at the same team API key to land everything in one team, or create a key per team to keep them separate.

Troubleshooting

  • Test Connection fails. Check that the endpoint ends in /v1/traces and that the header value starts with Bearer followed by the full key. A revoked key is rejected the same way; create a new one under Team settings → API keys.
  • The test passes but no sessions appear. Check that the team has a collection policy: with none, Terma accepts the traces but stores nothing. Then confirm the requests are being made with a key covered by the Broadcast settings you edited, and that the destination’s sampling rate is 1.0. Traces arrive asynchronously, so allow a minute after the request.
  • Everything shows as one person. The calls share an OpenRouter API key. Create per-person keys, or map the shared key under Team settings → Principals.
  • Spend looks like an estimate. It is not. Costs for OpenRouter calls are the amounts OpenRouter reported for each request. Costs marked Estimated only appear for sources that do not report cost themselves.