fix(usage): record the resolved provider, price managed ASR by host and model, and let live conformance reach the managed adapter (#502) #503
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/502-usage-pricing-live"
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?
Refs #502 — items 1–4 (item 5, the synthetic ASR leg, follows the #433 harness merge).
What
record_llm_callalready recordedprovider.capabilities.name; only the two fallbacks were wrong — the ASR identity unconditionally, and the LLM identity on runs that died before their first LLM call, which is exactly the population that has already paid for ASR. Newusage_service.resolve_asr_identity()/resolve_llm_identity()return(adapter name, model, host); the ASR model goes through the adapter's own default resolution so a blank model on Groq is billed aswhisper-large-v3-turbo, which is what the row now says. Migratione9fa0b1c2d3e(afterd8e9fa0b1c2d, one head, round-tripped): three nullable columnsasr_model,asr_endpoint_host,llm_endpoint_host; nothing backfilled. Host isprovider_slots.endpoint_host, the same string the concurrency limiter keys on, so there is one notion of "which box".ASR_HOURLY_USDis now{host: {model-prefix: rate}}with the same longest-prefix rule as the token table (sogpt-4o-mini-transcribeis not matched bygpt-4o-transcribe);estimate_asr_costchecks self-hosted first so a bundled server behind a vendor-looking hostname is never billed at that vendor's rate; subdomain matching mirrors the registry sniff so routing and pricing cannot disagree. Rates:api.openai.comwhisper-1 / gpt-4o-transcribe $0.36/hr, gpt-4o-mini-transcribe $0.18/hr;api.groq.comwhisper-large-v3-turbo $0.04/hr. Groq's 10-second per-request minimum is documented as making the estimate a floor (~1.77× on VAD-cut spans), not modelled — the row has no request count, and adding one changes a transcription signature;whisper-large-v3is omitted because its rate could not be confirmed.PRICING_AS_OFbumped. Longest-prefix keepsclaude-sonnet-5andclaude-sonnet-4-5apart — Sonnet 5 is the cheaper one, so the near-miss is expensive either way.--liveconformance can drive the managed ASR adapter (item 4):QB_CONFORMANCE_ASR_PROVIDER/QB_CONFORMANCE_ASR_MODELrouted throughresolve_asr_provider; two named skips; no case's assertions changed; Makefile and DEVELOPMENT updated with a worked Groq example. Seven wiring tests run without--liveso a mis-pointed harness cannot fail silently.Rebased over #501 with no conflicts; the rebase created two Alembic heads, re-chained in its own commit.
Verification
alembic heads→e9fa0b1c2d3e; version sync OK.🤖 Generated with Claude Code