docs(analytics): server-tool accounting, 367-day cap, region + query behavior - #94
docs(analytics): server-tool accounting, 367-day cap, region + query behavior#94jtcies wants to merge 6 commits into
Conversation
Co-Authored-By: Joseph Ciesielski <joseph.ciesielski@openrouter.ai>
Original prompt from Joseph
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Joseph Ciesielski <joseph.ciesielski@openrouter.ai>
…ly-analytics-sync
…backs) Co-Authored-By: Joseph Ciesielski <joseph.ciesielski@openrouter.ai>
Co-Authored-By: Joseph Ciesielski <joseph.ciesielski@openrouter.ai>
Co-Authored-By: Joseph Ciesielski <joseph.ciesielski@openrouter.ai>
| - Other dimensions (`provider`, `origin`, `country`, `finish_reason`, `external_user`, etc.) are not enriched — filter values match what's returned in results. | ||
| - `model` — permaslug (e.g. `openai/gpt-4o`); both the filter value and returned value are the permaslug, not a display name. | ||
| - Other dimensions (`provider`, `origin`, `country`, `data_region`, `finish_reason`, `external_user`, etc.) are not enriched — filter values match what's returned in results. | ||
| - `data_region` values are `global`, `europe`, or `us`. It is a generations-only dimension (31-day limit), and rows predating region attribution report as `global`. |
There was a problem hiding this comment.
🔍 data_region documented in two skills but missing from the schema skill's dimension list
This PR documents data_region in skills/openrouter-analytics-query/SKILL.md:97 and in skills/openrouter-analytics/SKILL.md:153, but the schema-discovery skill's dimension catalog (skills/openrouter-analytics-schema/SKILL.md:139-146, "Limited to 31-day time ranges") and its non-enriched dimension list (skills/openrouter-analytics-schema/SKILL.md:236) were not updated. Since the schema skill is the one agents consult to learn which dimensions exist, the omission leaves the three skills inconsistent (session_id has the same pre-existing gap). Worth confirming whether this is deliberate (e.g. covered by another open sync PR) or an oversight.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Deliberate. The schema-skill entries for both dimensions are already open: data_region in #112, session_id in #100. Touching the same lines here would create a conflict between two sync PRs, so this PR covers only the two skills those PRs do not.
Action needed: @jtcies, merging #112 and #100 (or this PR after them) is what closes the three-skill gap.
|
|
||
| When interpreting results for the user: | ||
| - **Spend metrics** (`total_usage`, `credits_usage`, `openrouter_usage`, `byok_usage`, `byok_fees`, `usage_upstream`, `usage_cache`, `usage_web`, `usage_upstream_web`, `usage_file`, `usage_upstream_file`, `usage_web_fetch`, `usage_upstream_web_fetch`) are in USD. `total_usage` includes BYOK inference cost. `usage_data` is typically negative (a data logging discount) | ||
| - **Blended cost** (`blended_cost_per_million_tokens`) is the blended inference cost per 1M tokens, including applicable BYOK inference usage |
There was a problem hiding this comment.
🔍 blended_cost_per_million_tokens described only in two of three skills
The metric is added to the interpretation list here and to the numeric-types note in skills/openrouter-analytics-query/SKILL.md:192, but it is absent from the schema skill's cost-metric catalog (skills/openrouter-analytics-schema/SKILL.md:76-90). The PR description states this is intentional because open PR #88 covers the schema entry; if that PR does not land, agents discovering metrics through the schema skill will not know the metric exists or its 31-day/367-day range class.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Summary
Rolling weekly analytics skills sync. Each run appends the query-builder drift that no other open sync PR covers.
2026-08-03 run — drift from this week's
packages/clickhouse/analytics/commits, plus two pre-existing factual errors:data_regiondimension (openrouter-web #31199): documented inopenrouter-analytics-queryandopenrouter-analytics. Generations-only, so it carries the 31-day cap; valuesglobal/europe/us; rows predating region attribution report asglobal. The schema-skill entry is intentionally left to open PR docs(openrouter-analytics-schema): sync with openrouter-web changes #112.data_region) routes the query to rawgenerations, so the 31-day cap applies even when the requested metrics and grouped dimensions would allow the 367-day daily-MV range (trends/effective-range-cap.ts).modelis not label-resolved (fix): the filter-value list implied results carry a model display name. The public query route deliberately excludesmodelfrom label substitution because the permaslug is the stable public identifier, so both the filter value and the returned value are the permaslug.date__<granularity>.TIME_CONFIG_BY_SOURCEuses thedatealias only for MV sources; raw generations and classifications usecreated_at, so rows can carrycreated_at__<granularity>. Readers are told to detect either prefix.2026-07-20 run (earlier commits on this branch):
total_usagebut excluded fromrequest_count, request-based rates, and classification/dedup counts, so spend-per-request can look inconsistent.blended_cost_per_million_tokens(openrouter-web #28910) added to the metric-interpretation list and the numeric-types note. The schema-skill entry is covered by open PR docs(openrouter-analytics-schema): sync with openrouter-web changes #88.ANALYTICS_MAX_RANGE_MS_DAILY_MV = 367 * 24 * 60 * 60 * 1000(1 year plus a 2-day buffer so the "Past 1 Year" preset survives leap days).app = -1→Unknown,api_key_id = -1→Chatroom, user labels prefer full name then email, app labels prefer title → origin URL →App #<id>. Also notes that an unresolvable label filter becomes a no-match sentinel and that CLI stdout omitscachedAt/warnings.Deliberately out of scope:
session_idin the schema skill (open PR #100), theuser/user_emailsplit andorder_by request_count(open PRs #90/#91/#92), and per-metric MV-vs-generations availability tables, which are internal detail the meta endpoint does not expose.Link to Devin session: https://openrouter.devinenterprise.com/sessions/25bbc687de7e4775a703b2f930b09c0f
Requested by: @jtcies