feat(dashscope): add kimi-k3, MiniMax-M3, and deepseek-v4-pro-0813 to the cost map - #38165
Open
shivamrawat1 wants to merge 2 commits into
Open
feat(dashscope): add kimi-k3, MiniMax-M3, and deepseek-v4-pro-0813 to the cost map#38165shivamrawat1 wants to merge 2 commits into
shivamrawat1 wants to merge 2 commits into
Conversation
Contributor
Greptile SummaryThe PR adds DashScope pricing and model metadata for Kimi-K3, MiniMax-M3, and deepseek-v4-pro-0813, plus thinking-mode rate selection
Confidence Score: 5/5The PR appears safe to merge No blocking failure remains
|
| Filename | Overview |
|---|---|
| litellm/llms/dashscope/cost_calculator.py | Adds immutable thinking-rate overrides selected when usage reports reasoning tokens |
| model_prices_and_context_window.json | Registers the three new DashScope models, including both Kimi-K3 identifiers, prices, limits, and capability flags |
| litellm/model_prices_and_context_window_backup.json | Mirrors the primary cost-map additions |
| litellm/types/utils.py | Adds typed fields for DashScope thinking-mode input, cache-read, and output rates |
| litellm/utils.py | Propagates the new thinking-rate fields through model-info lookup |
| tests/test_litellm/llms/dashscope/test_dashscope_cost_calculator.py | Adds calculator behavior tests for thinking, non-thinking, and explicit-zero rates |
Reviews (2): Last reviewed commit: "feat(dashscope): bill thinking-mode requ..." | Re-trigger Greptile
Contributor
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 1 · PR risk: 0/10 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Author
Contributor
Author
|
@greptile review again! |
Contributor
Author
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.
TLDR
Problem this solves:
How it solves it:
User Flow
Before: a platform admin routing DashScope's newest models through LiteLLM gets no spend tracking and no context limits
model: dashscope/kimi-k3(ordashscope/deepseek-v4-pro-0813,dashscope/MiniMax/MiniMax-M3) to their config and start the proxyx-litellm-response-cost-original: 0.0and https://litellm-domain/ui/?page=logs shows the request at $0 spendAfter: the same models bill correctly and expose their real limits
x-litellm-response-costmatching the docs' rates to the digit; a deepseek-v4-pro-0813 response carrying reasoning tokens bills every token, input included, at the doubled thinking-mode prices from the pricing pageRelevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Captured live end to end with no mocks: real billed DashScope calls through a local proxy running
LITELLM_LOCAL_MODEL_COST_MAP=True, hittinghttps://dashscope-intl.aliyuncs.com/compatible-mode/v1with a funded key. Shared config for both runs:Each case ran the same two commands:
Before (a28f075)
kimi-k3
/v1/model/inforow:kimi-k3 0 0 null null"hello"withusage: {prompt_tokens: 91, completion_tokens: 64, reasoning_tokens: 48}but the headers carriedx-litellm-response-cost-original: 0.0, so the request logged at $0deepseek-v4-pro-0813
/v1/model/inforow:deepseek-v4-pro-0813 0 0 null null"hello"withusage: {prompt_tokens: 89, completion_tokens: 26, reasoning_tokens: 24}andx-litellm-response-cost-original: 0.0After (a481ccf)
kimi-k3
/v1/model/inforow:kimi-k3 0.000002827 - 0.000014133 -(single-rate model, no thinking keys)"Hello"withusage: {prompt_tokens: 91, completion_tokens: 52, reasoning_tokens: 35}and headersdeepseek-v4-pro-0813
/v1/model/inforow:deepseek-v4-pro-0813 6.36E-7 0.000001272 0.000001908 0.000003816"hello"withusage: {prompt_tokens: 89, completion_tokens: 25, reasoning_tokens: 23}and headersType
🆕 New Feature
Caveats (if any)
The model MiniMax/MiniMax-M3 does not exist or you do not have access to iton dashscope-intl. Entry follows its Model Studio doc page, CNY converted at the 0.14133 USD rate the docs themselves use for kimi-k3 and deepseek-v4-pro-0813; its max output (128000) comes from the vendor since Model Studio lists nonedashscope/kimi-k3anddashscope/kimi/kimi-k3: the plain id serves completions on dashscope-intl while the namespaced one (the id the docs' nav uses) is recognized but gated behind product activation, so both are real ids a customer may configureFinal Attestation