Skip to content
telemetry.dev
Esc
↑↓navigate↵open⌘Jpreview
On this page

OpenRouter Broadcast

Add telemetry.dev as a destination in OpenRouter Broadcast and get a trace of each OpenRouter request, with no code changes.

OpenRouter Broadcast sends a trace of each request that you make through OpenRouter to the destinations that you add. Add telemetry.dev as an OpenTelemetry Collector destination, and each OpenRouter request becomes a trace in your project. You do not change your code.

Use Broadcast to get a trace of all OpenRouter requests with no code change. Use the OpenRouter SDK integration when you want each OpenRouter call to be a child of a span from your application. If you use the two in one project, telemetry.dev counts the tokens and cost of each request two times.

What you get

  • A trace for each OpenRouter request, with the service name openrouter
  • The model, the provider that OpenRouter sent the request to, the response model, and the finish reason
  • Input and output token counts
  • The prompt and the completion, unless Privacy Mode is on for the destination
  • The user and the session, when the request has user and session_id
  • A cost that telemetry.dev calculates from the token counts (see Cost)

OpenRouter sends traces in OTLP/HTTP with JSON encoding. Broadcast sends traces only. It does not send logs or metrics.

Set up

To change the Broadcast settings of an OpenRouter organization, you must be an organization admin.

Get a telemetry.dev API key

On the API keys page of your telemetry.dev project, make a key, for example with the name OpenRouter Broadcast. Read Create a key for the steps. Keys start with td_live_.

To put all Broadcast traces in one environment, give the key an Environment. See Environment.

Open the Observability page

In OpenRouter, open Settings > Observability. Each workspace has an Observability page, such as https://openrouter.ai/workspaces/default/observability for the default workspace.

Set the Enable Broadcast switch to on.

Add the destination

Click the edit icon next to OpenTelemetry Collector. Set these fields:

Field Value
Endpoint https://ingest.telemetry.dev/v1/traces
Headers {"Authorization": "Bearer td_live_..."}

Headers is a JSON object. Replace td_live_... with your full key. Keep Bearer and the space before the key.

Do a test of the connection

Click Test Connection. OpenRouter sends a test trace to telemetry.dev, and it keeps the destination only if the test is successful.

You can also set these items on the destination:

  • Privacy Mode removes the prompt and the completion from each trace. See Privacy.
  • An API key filter sends only the requests that use the OpenRouter API keys that you select. You can also select keys whose requests the destination does not send.
  • A sampling rate sends only a part of the traces. A rate of 1.0 sends all traces. OpenRouter sends all or none of the traces that have the same session_id.

Find the first trace

  1. Send a request through OpenRouter with an API key that the destination includes.
  2. Open the trace explorer. OpenRouter sends the trace after the request is completed. The trace shows with the service openrouter.

If the test is not successful, or if no trace shows, make sure that:

  • The endpoint is https://ingest.telemetry.dev/v1/traces.
  • The Authorization value in Headers is Bearer, one space, and a key that is not revoked.
  • Enable Broadcast is on, and the sampling rate of the destination is more than 0.
  • The API key filter of the destination includes the OpenRouter key that sent the request.

Fields that telemetry.dev reads

OpenRouter sends the data of each request as span attributes. telemetry.dev reads these attributes:

Request data Span attribute In telemetry.dev
Model gen_ai.request.model The span’s model. telemetry.dev also uses it to find a price.
Provider that OpenRouter sent the request to gen_ai.provider.name or gen_ai.system The span’s provider
Response model and finish reason gen_ai.response.model, gen_ai.response.finish_reason The span’s response model and finish reason
Input and output tokens gen_ai.usage.input_tokens, gen_ai.usage.output_tokens The token counts of the span and of the trace
Prompt and completion gen_ai.prompt, gen_ai.completion The span’s Input and Output
user user.id The trace’s User
session_id, or the x-session-id header session.id The trace’s Session
Other keys in the trace object trace.metadata.<key> The span’s Attributes. They are not trace metadata.

telemetry.dev keeps gen_ai.prompt and gen_ai.completion as text. It does not read them as a list of messages.

In the request’s trace object, trace_name sets the name of the root span. telemetry.dev uses the name of the root span as the trace name.

For the full list of attributes that telemetry.dev reads, see Span attributes.

Environment

OpenRouter does not send a deployment environment. Thus telemetry.dev puts Broadcast traces in the environment of the API key. A key without an environment puts them in default.

An environment key in the request’s trace object does not change the environment. OpenRouter sends it as the span attribute trace.metadata.environment.

To send the requests of different OpenRouter API keys to different environments:

  1. Make one telemetry.dev key for each environment, with that Environment.
  2. In OpenRouter, add one OpenTelemetry Collector destination for each telemetry.dev key. You can add a maximum of 5 destinations of one type.
  3. In the API key filter of each destination, select the OpenRouter keys for that environment.

If you use one OpenRouter workspace for each environment, add the destination on the Observability page of each workspace.

Cost

telemetry.dev uses a cost from the span only if the span has a client cost attribute, such as gen_ai.usage.cost. The OpenRouter documentation for the OpenTelemetry Collector destination does not include this attribute. Without it, telemetry.dev calculates the cost from the token counts and its pricing snapshot.

The provider on these spans is the provider that OpenRouter sent the request to, not openrouter. Thus telemetry.dev does not use the OpenRouter prices in its snapshot. It uses the provider and the OpenRouter model name, such as openai/gpt-4o-mini, to find the price. See Model matching. The calculated cost can be very different from the OpenRouter cost. For example, the OpenRouter cost includes OpenRouter fees and plugin costs, and the calculation does not.

telemetry.dev reads cache token counts only from the attributes in Token usage. OpenRouter sends cache-write counts as gen_ai.usage.input_tokens.cache_write, gen_ai.usage.input_tokens.cache_write_5m, and gen_ai.usage.input_tokens.cache_write_1h. telemetry.dev does not read these attributes. When a span has no cache counts that telemetry.dev reads, telemetry.dev uses the uncached input rate for all input tokens.

If a span has one of these attributes but no cache-write count that telemetry.dev reads, telemetry.dev records the diagnostic unrecognized_usage_attribute for the span. These diagnostics count toward the Ingestion errors alert.

Privacy

Privacy Mode removes the input messages and the output from each trace before OpenRouter sends it. OpenRouter continues to send token counts, cost, timing, model data, model parameters, user and session IDs, and custom metadata. The model parameters include stop, which is text from your request.

telemetry.dev applies built-in and custom redaction to all span attributes. For example, built-in redaction removes custom trace keys such as api_key and user_token.

Good to know

  • OpenRouter sends each trace after the request is completed. Thus Broadcast does not add latency to your requests.
  • OpenRouter cuts a value only when it has more than 10,000,000 characters. A trace with a very long prompt can be larger than the body limits of the ingest API. telemetry.dev then rejects the trace with 413. Privacy Mode makes traces smaller.
  • For the OpenRouter side of the setup, see the OpenRouter guides to Broadcast and to the OpenTelemetry Collector destination.

Last updated on October 27, 2026

Was this page helpful?