Skip to content

feat(decisions): bill decisions and systemone from _decisions cost map fields - #45904

Merged
klu-berri merged 19 commits into
mainfrom
litellm_decisions_evaluation_pricing
Oct 12, 2026
Merged

klu-berri merged 19 commits into
mainfrom
litellm_decisions_evaluation_pricing

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

/v1/decisions and /v1/systemone can now bill from decisions-specific rates that live on the model's own cost-map row, as <field>_decisions keys. Chat, Responses and batch never read them. Motivation: OpenAI bills gpt-6-luna Decisions at $0.10/1M input only (no output, no cache-read, no cache-write charges), but litellm priced it from the chat row (cache read 1e-08, output 5e-07), so any Decisions response with cached or output tokens was mispriced. Same pattern as the existing input_cost_per_token_batches fields, and it is backwards compatible: 1.104.3/1.105.0 proxies download main's JSON and ignore unknown keys, so they see no new models in /v1/models or the Add Model dropdown and keep billing from the plain fields until they upgrade.

Cost-map change (gpt-6-luna row, both JSON files, no new keys, no mode changes):

"input_cost_per_token_decisions": 1e-07,
"input_cost_per_token_above_272k_tokens_decisions": 2e-07,
"output_cost_per_token_decisions": 0.0,
"output_cost_per_token_above_272k_tokens_decisions": 0.0,
"cache_read_input_token_cost_decisions": 1e-07,
"cache_read_input_token_cost_above_272k_tokens_decisions": 2e-07,
"cache_creation_input_token_cost_decisions": 1e-07,
"cache_creation_input_token_cost_above_272k_tokens_decisions": 2e-07

Lookup rule, in litellm/litellm_core_utils/decisions_pricing.py:

DECISIONS_CALL_TYPES = {"decisions", "adecisions", "systemone", "asystemone"}

def decisions_pricing_fields(row):   # {"input_cost_per_token_decisions": x} -> {"input_cost_per_token": x}
def apply_decisions_pricing(row):    # plain row with the _decisions values overlaid on their base names

cost_calculator.cost_per_token applies the overlay for those call types only: it reads litellm.model_cost[model_info["key"]], overlays decisions_pricing_fields(...) onto the ModelInfo, and prices through generic_cost_per_token. A row with no _decisions keys (every decisions-only model, e.g. azure_ai/Microsoft-Decision-1, typesafe/jev-latest) falls through unchanged. infer_call_type now maps DecisionsResponse / OpenAIDecisionResponse to adecisions, so completion_cost(response) without an explicit call_type takes the same path. The typesafe pass-through logging handler applies apply_decisions_pricing to its raw row.

mode: decisions is accepted next to evaluation (litellm/types/utils.py, health-check mode lists, cost map guard output-price check, Add Model mode dropdown shows Decisions - /v1/decisions). No JSON row is flipped: 1.104.3/1.105.0 only know evaluation, and a flipped row would fail /health and drop out of the UI decision pickers there.

Effect on main for gpt-6-luna Decisions/System One: input 1e-07 (unchanged), cached 1e-07 instead of 1e-08, cache write 1e-07, output 0 instead of 5e-07, 2x above 272k input. Nothing else bills differently on any version.

Proof

Live OpenAI, branch proxy at the PR tip (~/proof/fields/after-branch-curls.txt): /v1/decisions and /v1/systemone on openai/gpt-6-luna each 171 input tokens, 0 cached, 0 output, x-litellm-response-cost: 1.71e-05; 1533-token prompt 0.0001533; chat on gpt-6-luna 13 prompt + 4 completion tokens, cost 3.3e-06 including 2e-06 output, so the chat row still prices chat. /v1/models: 205 ids, none containing decisions. Main's proxy returns the same Decisions costs because OpenAI reports 0 cached and 0 output tokens on these calls; the difference only appears with non-zero cached/output usage, which the integration cases exercise (tests/integration/cost_calculation/cases/openai.py gpt-6-luna System One case, plus the cache-read and output cases in tests/unit/litellm_core_utils/test_decisions_pricing.py).

Long context, live OpenAI /v1/decisions on gpt-6-luna through the branch proxy: 235,162 input tokens billed 0.0235162 (235,162 x 1e-07) and 320,162 input tokens billed 0.0640324 (320,162 x 2e-07, 0 cached, 0 output), so above 272k every input token moves to the _above_272k_tokens_decisions rate. The same numbers are pinned by two integration cases, openai-gpt-6-luna-decisions-above-272k-pricing and openai-gpt-6-luna-systemone-above-272k-pricing (320,162 input, 100,000 cached, 10,000 cache write, 3 output, expected 0.0640324 with output 0); the fixture row carries the above-272k chat and _decisions fields, so the cases fail if the overlay stops applying (cached tokens would price at the chat row's 2e-08).

Integration cost suite (tests/integration/cost_calculation, fixture cost map served through LITELLM_MODEL_COST_MAP_URL): 466 passed at 7a9d315894. Focused unit tests: 847 passed. UI tests: 160 passed. Cost map guard, ci_cd/generate_model_prices_schema.py and scripts/type_discipline_gate.py pass at the tip.

Caveats

  • Low: the schema generator describes _decisions keys only by their base field; a cost_description for the suffix was dropped because cost-map-guard runs main's generator (pull_request_target) and would report the committed schema out of sync. Can follow in a JSON-free PR.
  • Low: anything other than price that differs for Decisions (e.g. a different context window) has no _decisions twin yet. gpt-6-luna's chat row already says max_input_tokens: 922000, so nothing is needed today.
  • Low: the pricing-sync bots do not write _decisions keys; they are hand-maintained until a provider sync learns them.

Link to Devin session: https://app.devin.ai/sessions/35ac59e44abe4d6e807d960e31c85924
Open in Devin Desktop: https://app.devin.ai/desktop/session/35ac59e44abe4d6e807d960e31c85924?variant=devin
Requested by: @kerry-berri

kerry-berri and others added 2 commits October 11, 2026 00:10
…ns/<model> cost map rows

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@CLAassistant

CLAassistant commented Oct 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@codspeed

codspeed Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_decisions_evaluation_pricing (03ae38e) with main (fead47f)

Open in CodSpeed

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@codecov

codecov Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

kerry-berri and others added 8 commits October 11, 2026 01:22
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…luation_pricing

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	tests/integration/cost_calculation/cost_map.py
#	tests/integration/cost_calculation/test_cost_tracking.py
…ap rows

Restore both cost maps to main. Tests inject their own
<provider>/decisions/<model> rows. The Add Model dropdown hides those
pricing keys and offers mode decisions instead of evaluation.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration devin-ai-integration Bot changed the title feat(decisions): bill decisions and systemone from provider/decisions/model cost map rows feat(decisions): look up provider/decisions/model cost map rows for decisions and systemone Oct 12, 2026
kerry-berri and others added 2 commits October 12, 2026 17:47
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…p fields

Replace the provider/decisions/model pricing rows with <field>_decisions
fields on the model's own row. cost_per_token overlays them for the
decisions, adecisions, systemone and asystemone call types and prices
through generic_cost_per_token; chat, responses and batch keep the plain
fields. gpt-6-luna gains its Decisions rates (input 1e-07, output 0,
cached and cache-write input 1e-07, 2x above 272k tokens).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…for _decisions fields

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration devin-ai-integration Bot changed the title feat(decisions): look up provider/decisions/model cost map rows for decisions and systemone feat(decisions): bill decisions and systemone from _decisions cost map fields Oct 12, 2026
kerry-berri and others added 5 commits October 12, 2026 19:50
…nknown-variable count flat

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…e test cost rows for the type gate

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… 272k tier

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… stale azure comment

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.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.

3 participants