Repository navigation
feat(decisions): bill decisions and systemone from _decisions cost map fields - #45904
Merged
Merged
Conversation
…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
Bot
requested review from
klu-berri,
mateo-berri and
ryan-crabbe-berri
as code owners
October 11, 2026 01:03
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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>
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>
8 tasks done
…for _decisions fields Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…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>
klu-berri
approved these changes
Oct 12, 2026
Closed
4 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/v1/decisionsand/v1/systemonecan now bill from decisions-specific rates that live on the model's own cost-map row, as<field>_decisionskeys. 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 existinginput_cost_per_token_batchesfields, 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/modelsor the Add Model dropdown and keep billing from the plain fields until they upgrade.Cost-map change (
gpt-6-lunarow, both JSON files, no new keys, no mode changes):Lookup rule, in
litellm/litellm_core_utils/decisions_pricing.py:cost_calculator.cost_per_tokenapplies the overlay for those call types only: it readslitellm.model_cost[model_info["key"]], overlaysdecisions_pricing_fields(...)onto theModelInfo, and prices throughgeneric_cost_per_token. A row with no_decisionskeys (every decisions-only model, e.g.azure_ai/Microsoft-Decision-1,typesafe/jev-latest) falls through unchanged.infer_call_typenow mapsDecisionsResponse/OpenAIDecisionResponsetoadecisions, socompletion_cost(response)without an explicitcall_typetakes the same path. The typesafe pass-through logging handler appliesapply_decisions_pricingto its raw row.mode: decisionsis accepted next toevaluation(litellm/types/utils.py, health-check mode lists, cost map guard output-price check, Add Model mode dropdown showsDecisions - /v1/decisions). No JSON row is flipped: 1.104.3/1.105.0 only knowevaluation, and a flipped row would fail/healthand 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/decisionsand/v1/systemoneonopenai/gpt-6-lunaeach 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 containingdecisions. 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.pygpt-6-luna System One case, plus the cache-read and output cases intests/unit/litellm_core_utils/test_decisions_pricing.py).Long context, live OpenAI
/v1/decisionson 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_decisionsrate. The same numbers are pinned by two integration cases,openai-gpt-6-luna-decisions-above-272k-pricingandopenai-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_decisionsfields, 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 throughLITELLM_MODEL_COST_MAP_URL): 466 passed at7a9d315894. Focused unit tests: 847 passed. UI tests: 160 passed. Cost map guard,ci_cd/generate_model_prices_schema.pyandscripts/type_discipline_gate.pypass at the tip.Caveats
_decisionskeys only by their base field; acost_descriptionfor the suffix was dropped becausecost-map-guardruns main's generator (pull_request_target) and would report the committed schema out of sync. Can follow in a JSON-free PR._decisionstwin yet. gpt-6-luna's chat row already saysmax_input_tokens: 922000, so nothing is needed today._decisionskeys; 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