> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirador.org/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenRouter

> Send OpenRouter Broadcast traces to Mirador for cost, performance, reliability, and prompt-level AI observability

OpenRouter can send every generation to Mirador through **Broadcast**, its built-in trace export. Mirador turns those OpenTelemetry traces into an AI observability view for spend, tokens, generation volume, errors, time to first token, latency, models, providers, API keys, and organizations.

There is no SDK to install and no change to your OpenRouter requests. You configure one OTLP destination in OpenRouter.

## Before you start

You need:

* A Mirador project
* A Mirador **server key** (`mir_srv_*`) for that project
* Access to the OpenRouter account or organization whose traffic you want to observe

<Tip>
  Configure Broadcast on your OpenRouter organization to cover every team API key. Organization administrators are required to change organization-level Broadcast settings. Use an account-level destination when you only want your own traffic.
</Tip>

## 1. Create a Mirador server key

In Mirador, open your project's **API keys** page and create a **server key**. Copy it when it is shown; the full key is only displayed once.

Use a dedicated key for OpenRouter so you can rotate or revoke the integration independently. Treat the key like a password and do not commit it to source control.

## 2. Enable OpenRouter Broadcast

Open [OpenRouter Observability settings](https://openrouter.ai/settings/observability), then:

1. Turn on **Enable Broadcast**.
2. Find **OpenTelemetry Collector** in the destination list.
3. Open the destination's edit form.

OpenRouter sends Broadcast traces asynchronously after requests complete, so the integration does not add latency to your model responses.

## 3. Point OpenRouter at Mirador

Enter this OTLP/HTTP traces endpoint:

```text theme={null}
https://otel.mirador.org/v1/traces
```

Add your Mirador server key as a JSON headers object:

```json theme={null}
{
  "Authorization": "Bearer mir_srv_your_key"
}
```

Click **Test Connection**. OpenRouter saves the destination only after the test succeeds. The test appears in Mirador as a trace named `openrouter-connection-test`.

<Warning>
  Use the full signal-specific endpoint ending in `/v1/traces`. OpenRouter's OpenTelemetry Collector destination sends OTLP over HTTP with JSON encoding.
</Warning>

## 4. Send a generation

Make any request through OpenRouter from your application, the OpenRouter playground, or `curl`. Nothing about the request needs to change.

Open your Mirador project and select **AI → OpenRouter**. Recent generations arrive first; aggregate metrics can take a little longer to update. If you do not see the request, widen the dashboard time range.

## What Mirador receives

Each OpenRouter generation becomes a trace. Mirador uses its standard GenAI and OpenRouter metadata to show:

* Model and serving provider
* Input, output, and total token counts
* Cost and average cost per generation
* Time to first token and end-to-end latency
* Error count and error rate
* OpenRouter API key and organization breakdowns
* User, session, and custom `trace` metadata when supplied with the request
* Prompt and completion content when the destination's Privacy Mode is off

From the OpenRouter dashboard, select a model, provider, API key, or organization to filter its generations. Open a generation to inspect its prompt, completion, timing, usage, and errors together.

## Privacy Mode

OpenRouter configures Privacy Mode separately for each Broadcast destination.

* **Off:** prompt and completion content is sent to Mirador, enabling conversation-level debugging.
* **On:** input and output content is removed before the trace leaves OpenRouter. Tokens, cost, timing, model, provider, errors, and custom metadata still arrive.

Use Privacy Mode when conversation content must not be sent to Mirador, or when you only need operational and cost analytics. OpenRouter can send full traces to one destination and privacy-redacted traces to another.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Test Connection fails">
    Confirm the endpoint is exactly `https://otel.mirador.org/v1/traces` and the headers field is valid JSON. The authorization value must contain a current Mirador server key for the target project.
  </Accordion>

  <Accordion title="The connection test appears, but generations do not">
    Confirm **Enable Broadcast** is still on, send a new OpenRouter request, and widen Mirador's time range. Broadcast only exports requests made after the destination is enabled.
  </Accordion>

  <Accordion title="Metrics appear, but prompts and completions are empty">
    Check Privacy Mode on the OpenTelemetry Collector destination. When it is enabled, OpenRouter deliberately strips message content while retaining operational metadata.
  </Accordion>

  <Accordion title="Only one person's traffic appears">
    The destination may be configured on an individual account. An OpenRouter organization administrator can configure organization-level Broadcast so every organization API key reports to the same Mirador project.
  </Accordion>
</AccordionGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="OpenTelemetry traces" icon="route" href="/opentelemetry/traces">
    Learn how OpenRouter span content and metadata map into Mirador traces
  </Card>

  <Card title="OpenRouter Broadcast" icon="arrow-up-right-from-square" href="https://openrouter.ai/docs/guides/features/broadcast/overview">
    Review OpenRouter's Broadcast controls, sampling, metadata, and privacy options
  </Card>
</CardGroup>
