﻿---
title: Send OpenRouter traces to Elastic
description: Send OpenTelemetry traces from OpenRouter Broadcast, one trace per chat completion request, to Elastic Observability through the Elastic Cloud Managed OTLP Endpoint.
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9588/solutions/observability/get-started/opentelemetry/use-cases/llms/send-openrouter-broadcast-traces
products:
  - Elastic Cloud Hosted
  - Elastic Cloud Serverless
  - Elastic Documentation
  - Elastic Observability
applies_to:
  - Serverless Observability projects: Generally available
  - Elastic Cloud Hosted: Generally available
---

# Send OpenRouter traces to Elastic
[OpenRouter](https://openrouter.ai) is a gateway that routes LLM requests across many model providers. OpenRouter [Broadcast](https://openrouter.ai/docs/guides/features/broadcast) can send OpenTelemetry traces of every chat completion straight to Elastic. After an account admin adds Elastic as a destination in the OpenRouter console, one trace per request starts arriving in your Elastic project. You don't need to change your code or run an OpenTelemetry Collector.
Each request produces a parent span for the LLM generation plus one child span per upstream provider attempt. The spans follow the OpenTelemetry GenAI semantic conventions and are stored in Elastic in OTLP format.

## Before you begin

Make sure you have the following:
- An **admin** role on the OpenRouter account whose API keys you want to broadcast. If someone else administers the account, give them the endpoint and API key from the next item.
- An Elastic Observability Serverless project or an Elastic Cloud Hosted deployment. On Elastic Cloud Hosted, the Elastic Cloud Managed OTLP Endpoint requires version 9.0 or later. The Elastic Cloud Managed OTLP Endpoint isn't available for self-managed, Elastic Cloud Enterprise, or Elastic Cloud on Kubernetes deployments.
- Your Elastic Cloud Managed OTLP Endpoint endpoint and an API key with the `event:write` privilege for the `apm` application. To get both, follow the **Find your endpoint** and **Create an API key** steps in [Quickstart: Send OTLP data to Elastic Serverless or Elastic Cloud Hosted](/elastic/docs-content/pull/9588/solutions/observability/get-started/quickstart-elastic-cloud-otel-endpoint#send-data-to-elastic).


## Add Elastic as a Broadcast destination

Full step-by-step setup is in OpenRouter's guide: [Broadcast — Elastic Observability](https://openrouter.ai/docs/guides/features/broadcast/elastic).
<stepper>
  <step title="Open the Observability settings">
    In the OpenRouter console, open **Settings → Observability** and select **Elastic Observability** from the destinations list.
  </step>

  <step title="Enter your Elastic endpoint and API key">
    Set the OTLP endpoint to your Elastic Cloud Managed OTLP Endpoint URL. Set the header `Authorization` to `ApiKey <your-api-key>` (the word `ApiKey`, a space, then the encoded key).
  </step>

  <step title="Test the connection">
    Select **Test Connection** and confirm the synthetic `Test Generation` span lands in Elastic Discover under `service.name: openrouter`. Then save the destination.
  </step>
</stepper>

<tip>
  OpenRouter's Broadcast has a **Privacy Mode** that strips prompt and completion content from the trace, keeping only metadata (model, tokens, latency, response id). Enable it from the same destination if you don't want message content to leave OpenRouter.
</tip>


## Check that traces arrive

To verify Elastic is receiving spans without sending a real chat completion, use OpenRouter's **Test Connection** button at **Settings → Observability → your Elastic destination**. It fires a synthetic `Test Generation` span.
In Kibana **Discover**, run this ES|QL query to find the test span (and any real Broadcast span) by `service.name`:
```esql
FROM traces-*
| WHERE service.name == "openrouter"
```

The destination's delivery status in the OpenRouter console shows a healthy indicator once spans are being accepted. This can take about a minute after setup.

## Where the traces appear in Elastic

Traces land as OTLP spans under `service.name: openrouter`. Each span carries the request metadata (model, provider, tokens, cost, finish reason, response id) and the full conversation. You can reach them from:
- **Discover**: Query with ES|QL, then expand a row.
- **Applications → Service inventory → `openrouter` → Transactions**: Opens the request waterfall. Pick a transaction to view its details.
- **Applications → Traces**: The list of root transactions.


## Example: Token usage by model

In Kibana **Discover**, run this ES|QL query to sum input and output tokens by model. The `name == "LLM Generation"` filter restricts the query to the parent request spans, so child `provider attempt` spans aren't counted twice:
```esql
FROM traces-*
| WHERE service.name == "openrouter" AND name == "LLM Generation"
| STATS
    input_tokens = SUM(attributes.gen_ai.usage.input_tokens),
    output_tokens = SUM(attributes.gen_ai.usage.output_tokens)
  BY attributes.gen_ai.request.model
```


## Related pages

- [OpenRouter Broadcast documentation](https://openrouter.ai/docs/guides/features/broadcast) (OpenRouter documentation)
- [Elastic Cloud Managed OTLP Endpoint reference](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9588/reference/managed-inputs/managed-otlp-endpoint)
- [LLM and agentic AI observability](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9588/solutions/observability/applications/llm-observability)