OpenRouter provides a unified API for 200+ models. Wrap your OpenRouter client withDocumentation Index
Fetch the complete documentation index at: https://docs.lumiqtrace.com/llms.txt
Use this file to discover all available pages before exploring further.
wrapOpenRouter() to trace every call, regardless of which underlying model is used.
Installation
openai as the client.
Setup
Example
What gets captured
| Field | Details |
|---|---|
| Model | The OpenRouter model identifier (e.g. anthropic/claude-sonnet-4-6) |
| Input tokens | From OpenRouter’s usage response field |
| Output tokens | From OpenRouter’s usage response field |
| Cost | From OpenRouter’s reported cost or calculated from tokens |
| Latency | Total request duration |
Cost reporting accuracy depends on whether OpenRouter returns cost data in the response. For most popular models it does. For custom or fine-tuned routes, token-based calculation is used as a fallback.