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
  • A child span for each provider that OpenRouter tried, named provider attempt N: <provider>
  • The model, the provider that OpenRouter sent the request to, the response model, and the finish reason
  • Input, output, cache-read, cache-write, reasoning, and audio input token counts
  • The cost that OpenRouter bills for the request (see Cost)
  • The time to first chunk
  • The prompt messages and the response, unless Privacy Mode is on for the destination
  • The user and the session, when the request has user and session_id
  • The keys of the request’s trace object as trace metadata

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://api.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 request to telemetry.dev, and it keeps the destination only if the test is successful. telemetry.dev checks the API key and answers the test, but it does not store a trace for it.

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://api.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 on the generation span:

Request data Span attribute In telemetry.dev
Model gen_ai.request.model The span’s model
Provider that OpenRouter sent the request to gen_ai.provider.name or gen_ai.system The span’s provider, as a slug such as openai. On a failed request, OpenRouter sends unknown in gen_ai.provider.name, and telemetry.dev uses gen_ai.system.
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
Cache reads gen_ai.usage.input_tokens.cached The cache-read token count
Cache writes gen_ai.usage.input_tokens.cache_write, gen_ai.usage.input_tokens.cache_write_1h The cache-write token count, and its one-hour part. These names come from the OpenRouter docs. telemetry.dev has not seen them in an export yet.
Reasoning tokens gen_ai.usage.output_tokens.reasoning The reasoning token count
Audio input tokens gen_ai.usage.input_tokens.audio The audio input token count
Cost gen_ai.usage.total_cost The span’s cost. See Cost.
Time to first chunk trace.metadata.openrouter.first_token_ms The span’s time to first chunk
Prompt gen_ai.prompt The span’s Input, as the list of request messages
Completion gen_ai.completion The span’s Output, as one assistant message with the reasoning, the text, and the tool calls
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> Trace metadata, with the key <key>
Name of the OpenRouter API key trace.metadata.openrouter.api_key_name Trace metadata, with the key openrouter.api_key_name

For each field, a standard attribute wins over the OpenRouter attribute. For example, a gen_ai.usage.cache_read.input_tokens attribute wins over gen_ai.usage.input_tokens.cached.

OpenRouter also sends the completion with rawRequest, a copy of the request body. telemetry.dev does not store rawRequest. OpenRouter sends the prompt and the completion a second time as span.input and span.output. telemetry.dev does not store these copies.

OpenRouter also sends each key of the trace object two times, as trace.metadata.<key> and as span.metadata.<key>. It does the same with provider_responses and error_ownership. When the two values are the same, telemetry.dev stores only the trace.metadata.<key> attribute.

OpenRouter adds more keys under trace.metadata.openrouter., such as the provider name and the latency milestones. These keys stay span attributes. They are not trace metadata.

The generation span is the root span of the trace. OpenRouter gives it the name of generation_name in the request’s trace object, or LLM Generation. telemetry.dev uses this name as the trace name. OpenRouter sends trace_name as the span attribute trace.name, and telemetry.dev does not use it as the trace name.

Each provider attempt span has the provider and the status of one attempt. These spans are not model calls, so a failed attempt does not count in the Model errors alert. The generation span has the result of the request. If an attempt failed and a later attempt answered the request, the attempt span keeps its error status, but the trace status is success. The trace status is error when the request failed.

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. It becomes the trace metadata key 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

The span’s cost is gen_ai.usage.total_cost. This is the total that OpenRouter bills for the request, with OpenRouter fees and plugin costs. If the span also has a standard client cost attribute, such as gen_ai.usage.cost, telemetry.dev uses that attribute.

A request with your own provider key (BYOK) is different. The provider bills you for the inference, and gen_ai.usage.total_cost is only the OpenRouter fee. For these requests, telemetry.dev ignores the fee and calculates the cost from the token counts and its pricing snapshot. This cost is an estimate, and it does not include the OpenRouter fee. telemetry.dev finds a BYOK request from the is_byok value of the last provider attempt in span.metadata.provider_responses. In the exports that telemetry.dev has seen, is_byok is false for each attempt, so this rule is not yet checked with a BYOK request.

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.

If you turn off prompt capture for an environment in telemetry.dev, telemetry.dev removes the input, the output, gen_ai.prompt, gen_ai.completion, span.input, and span.output. It keeps the trace metadata, the user and session IDs, and the model parameters, such as gen_ai.request.stop_sequences. To keep content out of telemetry.dev before it leaves OpenRouter, use Privacy Mode.

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. The name of the OpenRouter API key also contains api_key, but telemetry.dev keeps it, because it is a name and not a key.

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 31, 2026

Was this page helpful?