DESIGN_READY_FOR_OPERATOR_REVIEW: OpenRouter Analytics collector + reconciliation #198
Labels
No labels
bug
design
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/starintel-auto-research#198
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Authority / state
READY_FOR_DESIGNstarintel-labs/starintel-infra#65a9de6e13ab83ba7a0d6c5994c9d8330f1271c3cfDESIGN_READY_FOR_OPERATOR_REVIEWThis design is not executable by RAGE until explicit operator approval exists.
Design goal
Add one bounded private collector that periodically queries the documented OpenRouter Analytics API, normalizes only approved accounting/performance fields, reconciles replay/corrections deterministically, and exports sanitized records into StarIntel's canonical
llmtelemetry stream.No Activity-page scraping, no prompt/completion ingestion, no parallel analytics database.
Architecture
Language boundary
No StarLang extension is justified for the provider protocol itself. This is infra/service acquisition from an external SaaS API. Keep the normalization/reconciliation core deterministic and host-language neutral; implement in the smallest language/runtime already appropriate to
starintel-infraservice tooling. If a StarLang scheduled-acquisition capability later owns invocation, it calls this adapter rather than duplicating the protocol.Collector contract
Configuration must define:
Configuration validation rejects content-bearing dimensions/fields and unknown dimension names by default.
Window algorithm
This gives restart recovery without unbounded historical rescans.
State model
Keep only what is required for restart/reconciliation:
Do not store raw API responses or prompt/content data.
State writes must be atomic (write+fsync+rename or equivalent durable primitive) so a crash cannot advance the watermark without the corresponding reconciliation state.
Normalized record
Required envelope:
Allowed metrics include documented spend/request/token/cache/performance aggregates. Missing upstream values remain missing.
Default-safe dimensions: model, provider, app/agent identifier when intentionally configured, opaque key identifier, workspace opaque identifier, finish/error class, data region, variant where useful.
User/custom-user/origin/session/generation/arbitrary classifier dimensions are disabled by default and require a separate explicit privacy review.
Secret handling
Failure behavior
Observability
Expose safe collector metrics/state:
Do not emit raw query parameters if they include sensitive dimension values.
Dependency-ordered implementation slices
All remain AWAITING_OPERATOR_IMPLEMENTATION_APPROVAL.
Mandatory RED-first targets
Slice 1
Before production mutation, add fixtures proving untouched repo lacks the contract:
Slice 2
Slice 3
Slice 4
Adversarial review
Rejected:
Acceptance
llmtelemetry;Implementation approval
PENDING / AWAITING_OPERATOR_IMPLEMENTATION_APPROVALOnly the operator may authorize implementation.