You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
accounting: legacy completions (/v1/completions) get no record at all #2076
wire.FormatOf deliberately returns (0, false) for legacy completions
(/v1/completions, /v1/engines/<id>/completions): their body has no messages array and never carries cache_control, so the wire/facts
packages have no cache positions to read either way (see the doc comment on FormatOf, core/accounting/wire/parse.go).
But Cortex's request parser does accept and forward these paths
(inference.dialectFor's completionsSuffix matches /completions with no /v1/chat requirement), and the provider bills them. Once this accounting
layer is wired into the proxy (#2055 and later), a legacy-completions
request gets no accounting record at all — not even an input-only spend
op — because Host.end has nothing to parse when FormatOf says not-ok.
"No record" is indistinguishable from "no traffic" in the reports, which
understates real spend for any caller still using the legacy endpoint.
Suggested fix
The request body does carry model and prompt, so an input-only accountant.KindSpend op should be derivable without any of wire's
position parsing — a separate, narrower path for this one endpoint shape,
not a wire.Format for a body this package can't otherwise read.
Context
Raised in review on #2054: #2054 (comment)
(core/accounting/wire/parse.go:47 — FormatOf's doc comment now states the
gap explicitly; this issue tracks closing it before the accounting layer
goes live.)
PR #2152 (merged 2026-11-26) closes the "no record at all" gap this issue raised.
What changed
Host.bill (core/accounting/host.go:681) now books Tier 1 metrics for any request Compute gives no Result. This covers a path wire.FormatOf cannot read, legacy completions included.
bill reads the usage straight from pctx.Extensions.Inference (the response). It needs no accounting record, so it does not depend on wire.Parse or a new accountant.KindSpend op.
It books llm.inference.tokens, cost_usd, estimated_cost_usd, and llm.cache.misses / miss_cost_usd.
docs/laptop-service.md:874-878 names /v1/completions by name as one of the paths now covered.
What is still true, by design
wire.FormatOf still returns (0, false) for legacy completions. The doc comment at core/accounting/wire/parse.go:43-49 is unchanged.
There is still no accountant.KindSpend op and no llm.savings.* entry for these requests. This issue's suggested fix (an input-only KindSpend op from model and prompt) was not built. It is not needed: legacy completions carry no cache_control, so they have no saving to compute either way.
Net effect
A legacy-completions request now shows up in llm.inference.tokens / cost_usd reporting. It no longer reads as "no traffic." Closing this issue in favor of #2152.
Activity
boazdavid commentedon Nov 29, 2026
This issue is fixed
PR #2152 (merged 2026-11-26) closes the "no record at all" gap this issue raised.
What changed
Host.bill(core/accounting/host.go:681) now books Tier 1 metrics for any requestComputegives noResult. This covers a pathwire.FormatOfcannot read, legacy completions included.billreads the usage straight frompctx.Extensions.Inference(the response). It needs no accounting record, so it does not depend onwire.Parseor a newaccountant.KindSpendop.llm.inference.tokens,cost_usd,estimated_cost_usd, andllm.cache.misses/miss_cost_usd.docs/laptop-service.md:874-878names/v1/completionsby name as one of the paths now covered.What is still true, by design
wire.FormatOfstill returns(0, false)for legacy completions. The doc comment atcore/accounting/wire/parse.go:43-49is unchanged.accountant.KindSpendop and nollm.savings.*entry for these requests. This issue's suggested fix (an input-onlyKindSpendop frommodelandprompt) was not built. It is not needed: legacy completions carry nocache_control, so they have no saving to compute either way.Net effect
A legacy-completions request now shows up in
llm.inference.tokens/cost_usdreporting. It no longer reads as "no traffic." Closing this issue in favor of #2152.