Price a request from plain values instead of the plugin request context
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Go
- スター
- 21
- フォーク
- 43
- 平均マージ
- 13時間 8分
- マージ済み PR(30日)
- 267
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rossoctl/cortex のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
UI shows costs for all sessions even when drilled into a session対応中かも @esnible が 16 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
rossoctl/cortex#1116 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 半日 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1週間以上 初心者へのやさしさ 18/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
rossoctl/cortex の issue をすべて見る
似ている issue
-
ux
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
evcc-io/evcc#35605 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug report
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
nightgauge/nightgauge#2732 ·
メンテナーはふだん 1 日以内に返信
-
fix below CVEsオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 5 日以内に返信
-
good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100