Skip to content

feat(session): update models and calculate costs per request - #343

Open
upsetbit wants to merge 10 commits into
masterfrom
feat/request-aware-model-pricing
Open

upsetbit wants to merge 10 commits into
masterfrom
feat/request-aware-model-pricing

Conversation

@upsetbit

Copy link
Copy Markdown
Contributor

Current model tariffs were missing from the catalog, and session-level token totals could apply the wrong context or cache rate. This change adds the missing public models across OpenAI, Anthropic, Google, xAI, Z.AI, and Cursor, and prices measured inference requests before aggregating session and report costs.

Request facts preserve the effective model, timestamp, prompt length, tier, speed, region, and cache-write duration. Projection 14 carries those facts through SQLite, Postgres, and sync; uploads with the same raw hash preserve newer projections. Historical tariff periods remain date-sensitive, and CLI/panel output distinguishes calculated, estimated, partial, and unavailable costs.

Validation: full race suite with real Postgres, CLI integration tests, build, vet, golangci-lint, generated-code reproducibility, tidy check, and repository quality gates.

Rollout: update the server before CLI/panel clients. The next sync reimports available source files; sessions whose sources are unavailable retain aggregate estimates.

upsetbit and others added 10 commits October 14, 2026 12:22
A token_count event with info: null carries only rate limits, so it no
longer marks the session's request collection as partial.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
CombineCosts flags partial only for partial members or unpriced tokens,
InferenceGeo is lower-cased once for every model, and the unreachable
gpt-daybreak-blue clause in requestContext is gone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
RequestCost is the single pricing formula; the former CostUSD tests now
exercise it through the aggregate-usage path.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A failed ListChildren call is logged and the parent sorts by its own cost
instead of failing the whole page. Session rows keep a single cost
summary rather than pricing twice.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
RequestProjectionVersion and LegacyProjectionVersion replace the bare 14
and 13 literals in the push validators.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant