- Analytics connection (recommended): Weave syncs usage, tokens, and cost directly from OpenRouter’s Analytics API.
- Direct capture: Weave stores sanitized OpenTelemetry exports from OpenRouter Broadcast.
- Harness telemetry: a supported AI harness, such as Oh My Pi, reports its own OpenRouter usage.
Connect OpenRouter Analytics
You need an OpenRouter organization admin to create the key and a Weave admin to connect it.- In OpenRouter → Settings → Management Keys, click Create New Key, name it (for example
Weave Analytics), and set an expiration. OpenRouter shows the key once and cannot extend its expiration later. - In Weave, open Data → OpenRouter and click Connect OpenRouter. Enter a connection name, paste the management key, and click Save.
- Weave validates that the key can read Analytics before encrypting and storing it. Management keys cannot make model requests; Weave uses the key only to read Analytics.
- Weave syncs the last 14 days of usage on each scheduled sync, about every 3 hours. To import older history, ask Weave support for a backfill: OpenRouter provides per-request detail for the last 31 days and daily per-model totals before that.
- Map OpenRouter identities to members on the same page; see Analytics identity mapping. Unmapped usage still counts toward organization totals.
- If the key expires or is revoked, the connection shows Action required. Create a new management key and use Replace key.
- Disconnecting erases the stored key in Weave. Revoke the key in OpenRouter separately.
Direct capture
- In Weave, open Data → AI Gateway and click Create API key. This Weave key authenticates the receiver; it is not your OpenRouter inference or management key.
-
In OpenRouter Observability settings, configure an OpenTelemetry Collector destination with:
- Endpoint:
https://app.workweave.ai/api/ingest/openrouter/v1/traces - Custom headers:
{"X-Weave-Token":"YOUR_WEAVE_AI_GATEWAY_KEY"} - Privacy Mode: enabled
- Sampling:
1.0/ 100% - Included API keys: explicitly select the OpenRouter keys whose usage you want to capture. An empty inclusion list can export all organization traffic.
- Endpoint:
- Run Test Connection, then save. Do not replace an existing destination if it serves another system.
-
Have Weave support confirm that a real export was persisted. A successful response includes an
X-Weave-Inbox-IDreceipt header and is returned only after the database write commits.
https://app.workweave.ai with your instance’s externally reachable URL.
The receiver accepts OTLP/HTTP JSON or protobuf, including gzip, with a 32 MiB decompressed request limit. It uses the header key’s organization; a resource-level weave.token, if present, must match that header. Invalid or revoked keys return 401, malformed exports return 400, oversized exports return 413, and storage failures return a retryable 503.
The inbox preserves trace/span identifiers, timing, status codes, and allowlisted model/provider/user/session attributes. Usage fields use an exact-name allowlist, not a namespace wildcard:
gen_ai.usage.input_tokens,output_tokens,total_tokens,reasoning_tokens,cache_read.input_tokens,cache_creation.input_tokens,cache_write.input_tokens, andcostgen_ai.cost.total,input, andoutputopenrouter.usage.input_tokens,output_tokens,total_tokens, andcostopenrouter.cost.total
How harness reporting flows
What Weave needs from a harness
A harness integration must provide the following information in its telemetry:
A harness’s
OPENROUTER_API_KEY or an openrouter/... model name by itself is not enough for Weave to identify or report usage. The harness must send telemetry through a supported Weave integration.
OpenRouter costs
When Oh My Pi routes a request through OpenRouter and receives OpenRouter’s reported request cost, Pi includes that value in its cumulative cost metric. Weave converts the repeated cumulative observations into positive cost deltas before adding them to aggregate Pi cost reporting. The normal cost path is:gen_ai.conversation.id or gen_ai.response.id. Consequently, this path reports cost by person, model, provider, and time period; it does not assign metric-derived cost to individual requests or sessions.
Provider-reported cost should still be reconciled against the organization’s OpenRouter usage records for billing-sensitive reporting. Credits, discounts, negotiated rates, taxes, and account-level adjustments may not be represented in an individual response cost.
Visibility in Weave
Usage that a harness reports appears under the AI harness source. Usage synced through the Analytics connection appears under the separate OpenRouter source. For requests sent by Oh My Pi:- Data → Pi — create and manage the Weave telemetry key and generate setup instructions
- AI reports — view activity by person, team, date range, model, and AI tool
- AI tool costs — view aggregate Pi costs and cost fidelity
- Token usage — view input, output, and cache-token totals from Pi traces
- Session views — view conversation activity from Pi traces when the harness supplies a session ID; metric-derived cost is not assigned to sessions
Analytics identity mapping
When an OpenRouter Analytics connection is configured under Data → OpenRouter, Weave records the identities that OpenRouter reports on each generation: the OpenRouter user email, theexternal_user value the caller sent, and the API key. Admins map those identities to Weave members on the same page.
Weave maps some identities automatically during each sync. When a request’s external_user (the user field your tools send to OpenRouter) is exactly a member’s email, Weave maps it to that member. When your organization’s requests come from two or more OpenRouter accounts, each account email that exactly matches a member’s email is mapped to that member too. A single OpenRouter account shared by the whole team is never auto-mapped, and neither is an API key, because either can carry everyone’s traffic. Weave never changes an identity an admin has already mapped or unmapped.
What mapping does:
- Attributes OpenRouter usage, tokens, and cost to a Weave member for reporting.
- Accepts several identities per member (an email, an external user ID, and one or more API keys).
- Records an effective window per mapping. Rotate a key by ending the old key’s mapping and mapping the new key; usage before the cutoff keeps the old attribution and usage after it follows the new mapping.
- Lets you mark an API key as shared or as a service account with a label so its usage is reported as unattributed or as that service rather than as a person.
- It never assigns shared-key traffic to the administrator who connected OpenRouter or created the mapping. Unmapped and shared identities stay unattributed.
- It does not convert OpenRouter token counts into lines of code. The only OpenRouter lines of code come from file-edit tool calls captured through direct capture, which Weave credits in AI code LOC and PR attribution to the member that the generation’s identity maps to.
- It does not infer identity from the connection creator, display names, or model names. Only the stable
user_email,external_user, andapi_keyvalues are mapping keys.
Setup responsibilities
Weave administrator
- Open Data → Pi.
- Create one organization-wide Pi telemetry key.
- Give the key to the team through your normal secret-management process.
- Do not give the team a Weave OpenRouter key—there is no such key.
Each harness user
Each user must configure their own identity. For Oh My Pi:Each harness owner
Configure OpenRouter authentication in the harness itself, then configure the harness’s supported Weave telemetry integration. For Oh My Pi, use the Oh My Pi setup instructions. For a different AI harness, confirm with Weave support whether it has a supported integration before deploying it across the organization. Sending arbitrary OTLP data to the endpoint does not automatically make a new harness reportable.Validation checklist
Before a broad rollout, validate one request in both systems:- The harness request reaches OpenRouter successfully.
- The harness sends OTLP traces and metrics to Weave and receives successful ingest responses.
- The telemetry includes the user’s own Weave email.
- The requested and served model values are present in the traces.
- Input, output, and cache-token counts match the trace data.
- A populated
pi.omp.agent.chat.cost.estimated_usdmetric is present when the request has cost. - Repeated cumulative metric exports do not double-count cost.
- The aggregate OpenRouter-reported cost matches the Pi metric and Weave cost report.
- The request appears under the Pi source in Weave after asynchronous processing and the next reporting refresh.
- Metric-derived cost is not presented as an exact session or request cost.
Related pages
- Oh My Pi — configure Pi’s OTLP telemetry and OpenRouter provider
- AI tool costs — understand cost fidelity and visibility
- Ingest API — review the OTLP ingestion contract
- AI tools overview — compare supported AI harnesses
