LancelotDocs
OpenRouter and OpenTelemetry

Send usage

OpenRouter and OpenTelemetry

Import every call from OpenRouter, or from any OpenTelemetry sender, with no code change.

Imported calls keep the cost the gateway reported. To let Lancelot throttle, pause or switch models inside your app, add the SDK as well: only the SDK can apply those.

OpenRouter

  1. In Lancelot, open Settings → Integrations → OpenRouter and click Set up. Lancelot creates an API key for OpenRouter and shows it once.
  2. In OpenRouter, open Settings → Observability and turn on Broadcast.
  3. Add an OpenTelemetry Collector destination with the endpoint and headers Lancelot shows:
Endpoint: https://app.lancelot.watch/api/v1/otlp/v1/traces
Headers:  {"Authorization":"Bearer lc_live_..."}
  1. Click Test connection, then save.

Send each customer's ID as user on every OpenRouter request. Calls without one can't be counted for anyone.

Clicking New key in Lancelot replaces the key and revokes the old one.

Any OpenTelemetry sender

The same endpoint accepts OTLP traces over HTTP from any tool that emits GenAI spans.

POST https://app.lancelot.watch/api/v1/otlp/v1/traces
Authorization: Bearer lc_live_...
Content-Type: application/json
  • Encoding: JSON (http/json) only. Protobuf returns 415. Gzip is accepted.
  • Size: up to 5 MB per request, 20 MB unzipped.
  • Spans without a customer ID are returned as partialSuccess.rejectedSpans.
  • Prompts and completions in the spans are never read or stored.
  • Calls older than 35 days are dropped.

Attributes Lancelot reads

For each field, the first attribute present wins.

FieldAttributes
Customerlancelot.customer_id, trace.metadata.lancelot_customer_id, trace.metadata.customer_id, user.id, langfuse.user.id, llm.user, metadata.user_api_key_end_user_id, gen_ai.request.user, enduser.id, then the resource's user.id
Featurelancelot.feature, trace.metadata.lancelot_feature, trace.metadata.feature, metadata.feature, feature
Modelgen_ai.response.model, gen_ai.request.model, llm.model_name, llm.model
Providergen_ai.provider.name, gen_ai.system, llm.provider
Input tokensgen_ai.usage.input_tokens, gen_ai.usage.prompt_tokens, llm.usage.prompt_tokens, llm.token_count.prompt
Output tokensgen_ai.usage.output_tokens, gen_ai.usage.completion_tokens, llm.usage.completion_tokens, llm.token_count.completion
Costgen_ai.usage.total_cost, gen_ai.cost.total_cost, gen_ai.usage.cost, llm.cost.total

When a span carries a cost, Lancelot uses it instead of list prices.