Price a request from plain values instead of the plugin request context
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Read core/cost/settle/settle.go and core/cost/settle/avoided.go, then inspect core/plugins/inferenceparser/cost.go for the current callers. Add table tests for plain Input pricing, LiteLLM cost headers, and Comparable discount and margin checks. Done means Settle and Comparable accept plain values, their context forms wrap them, and existing cost tests pass unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Part of #1437 (assessment: laptop data plane on Praxis) · prep work, useful to Cortex on its own
Status: there is no shipped Cortex–Praxis integration today (the paused
cmd/cortex-praxisconverter is not one), and the interim path is not decided (LLM traffic to praxis-ai as an inference server, or all traffic through Praxis via #1491). Nothing here depends on that choice: each item is useful to Cortex now, and would make a possible move to Praxis easier whichever path is taken.
Problem
Pricing a request needs the whole plugin request context.
settle.Settle(pctx, rates)readspctx.Host,pctx.Extensions.Inferenceandpctx.ResponseHeaders(LiteLLM cost headers, andContent-TypeviaIsEventStream);pctx.Pathonly in log lines.Avoidedreadspctx.Extensions.Custom(tool-prune's record), the request body andBodyMutated().Publishwrites the result back intopctxunder two keys;Storekeeps it in pipeline state, which litellm-budget-track reads withLoadand rewrites withAmend.
Eight exported functions take *pipeline.Context: Settle, Avoided, IsEventStream, Comparable, Store, Load, Publish, Amend.
Settle is called only from inside the inference-parser plugin (cost.go:72-112), which also calls Store, Avoided and IsEventStream; litellm-budget-track calls Comparable, Load and Amend. So pricing can run only inside Cortex's Go pipeline: not from a recorded event, not in a test without building a pctx, not from another proxy.
Proposal
This issue owns settle's input. #1497 item 3 owns recording the cost-relevant headers on the event, and #1503 depends on this one.
Settle(in Input, rates) SettledwithInput{Host, Inference, ResponseHeaders}.IsEventStreamis derived fromResponseHeaders;Pathis only for logging and can be passed separately or dropped.Comparable(in Input)the same way.Avoidedkeeps apctxform for now: it needs tool-prune's record, the forwarded body andBodyMutated(), none of which belong in a pricing input.Store,Load,PublishandAmendare how plugins exchange the result; they stay onpctx(their serialization is #1499 item 4).- Keep
Settle(pctx, rates)as a thin wrapper over the new form, so existing callers and tests don't change. No behaviour change. - Where the wrapper lives (the inference-parser plugin, or a separate cost step) is decided in #1503.
Done when
SettleandComparablehave plain-value forms, and thepctxversions are wrappers over them.- A table test prices from plain
Inputvalues, including the LiteLLM cost-header cases and theComparablechecks on the discount and margin headers. (Gateway multipliers are on the rates side,pricing/multiplier.go, and are unaffected.) - Existing cost tests pass unchanged (about 43 test calls use
Settle(pctx, …)).
Evidence read at main @ e455a04 (2026-10-25); not built.
- Lingua principale
- Go
- Stelle
- 21
- Fork
- 43
- Merge medio
- 14h 49m
- PR unite (30g)
- 236
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rossoctl/cortex
-
UI shows costs for all sessions even when drilled into a sessionForse già presa @esnible l’ha presa 13 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
rossoctl/cortex#1116 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
WebSocket turns carry only new input, so conversation-level plugins see less of a Codex sessionAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Lineage plugin records no payload for plain-HTTP exchangesForse già presa @JoshSag l’ha presa 1 giorno fa. Apertaenhancement in-progress
rossoctl/cortex#1505 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement laptop
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement laptop
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rossoctl/cortex
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 1/5 1-3 ore Idoneità per principianti 76/100
superplanehq/superplane#9007 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
yetone/magpie#3905 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno