Broadcast does not replace Analytics: without Analytics, captured traces cannot be credited to anyone and do not populate usage or cost reports.
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 every hour. 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.
Broadcast capture
OpenRouter Broadcast sends a trace of each request to destinations you configure. Weave counts the lines in coding agents’ file-edit tool calls from those traces and credits them in AI code LOC and PR attribution to the member that the request’s OpenRouter identity maps to. Captured traces also fill in user identities that Analytics omits. Capture does not change usage or cost reports, which come from the Analytics connection. You need an OpenRouter organization admin to edit Broadcast settings and a Weave admin to create the key.- 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, turn on Enable Broadcast and add 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: off. Privacy Mode removes the request’s output, which holds the tool calls Weave counts lines from. Weave counts the lines and then discards prompts, responses, and tool arguments before storing anything; see what Weave keeps.
- Sampling:
1.0/ 100%. Lower sampling undercounts AI code lines. - Included API keys: explicitly select the OpenRouter keys your coding agents use. An empty inclusion list exports all organization traffic.
- Endpoint:
- Run Test Connection, then save. OpenRouter allows up to five Broadcast destinations, so do not replace an existing destination if it serves another system.
-
Send a request through one of the included keys, then ask Weave support to confirm that its trace was stored. Weave answers each export with an
X-Weave-Inbox-IDreceipt header, sent only after the database write commits, but that response goes to OpenRouter’s exporter, not to your coding agent, so you cannot see it yourself. AI code lines appear after the next Analytics sync matches the trace to a member.
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.
What Weave keeps
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
Analytics connection
With an Analytics connection, Weave reads cost from OpenRouter’s own usage records, so it covers every request sent through your OpenRouter account, whichever AI harness or tool sent it. Each request’s cost is its credit spend plus its bring-your-own-key (BYOK) spend, and Weave labels it Actual fidelity. OpenRouter keeps per-request detail for 31 days. For older days, and for parts of a day the per-request detail doesn’t cover, Weave adds the difference from OpenRouter’s daily per-model totals, so your organization’s cost matches OpenRouter’s totals without counting any spend twice. That daily remainder has no identity, so it counts toward organization totals but not toward any person. OpenRouter’s usage records don’t say which harness sent a request, so Analytics cost appears under the OpenRouter source, not split by harness.Harness-reported cost
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.
For billing-sensitive reporting, connect OpenRouter Analytics so cost comes from OpenRouter’s usage records rather than individual response costs. 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 the hourly 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
