Skip to content

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
litellm_internal_stagingfrom
litellm_dashscope_kimi_minimax_dsv4pro0813
Open

feat(dashscope): add kimi-k3, MiniMax-M3, and deepseek-v4-pro-0813 to the cost map#38165
shivamrawat1 wants to merge 2 commits into
litellm_internal_stagingfrom
litellm_dashscope_kimi_minimax_dsv4pro0813

Conversation

@shivamrawat1

@shivamrawat1 shivamrawat1 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • DashScope's Kimi-K3, MiniMax-M3, deepseek-v4-pro-0813 missing from cost map
  • Calls to them log $0 spend
  • Model Hub shows no context limits for them
  • Dual-mode models bill thinking-mode input at the cheaper rate

How it solves it:

  • Adds all three with prices, limits, capability flags
  • kimi-k3 added under both ids Model Studio documents
  • New thinking-rate keys bill thinking-mode requests at their real prices

User Flow

Before: a platform admin routing DashScope's newest models through LiteLLM gets no spend tracking and no context limits

  1. They add model: dashscope/kimi-k3 (or dashscope/deepseek-v4-pro-0813, dashscope/MiniMax/MiniMax-M3) to their config and start the proxy
  2. They GET https://litellm-domain/v1/model/info and the entries come back with zero prices and null max input and output tokens
  3. They POST https://litellm-domain/v1/chat/completions against the model; it answers, but the response carries x-litellm-response-cost-original: 0.0 and https://litellm-domain/ui/?page=logs shows the request at $0 spend
  4. The Model Hub page shows "- / -" for the model's token limits, the same symptom this customer thread opened with

After: the same models bill correctly and expose their real limits

  1. They add the same models to their config and start the proxy
  2. They GET https://litellm-domain/v1/model/info and see input, output, and cache read prices plus real max input and output tokens
  3. The same POST https://litellm-domain/v1/chat/completions returns x-litellm-response-cost matching 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 page
  4. The Model Hub shows the real context limits

Relevant issues

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. 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
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to 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, hitting https://dashscope-intl.aliyuncs.com/compatible-mode/v1 with a funded key. Shared config for both runs:

model_list:
  - model_name: kimi-k3
    litellm_params:
      model: dashscope/kimi-k3
      api_key: os.environ/DASHSCOPE_API_KEY
      api_base: https://dashscope-intl.aliyuncs.com/compatible-mode/v1
  - model_name: deepseek-v4-pro-0813
    litellm_params:
      model: dashscope/deepseek-v4-pro-0813
      api_key: os.environ/DASHSCOPE_API_KEY
      api_base: https://dashscope-intl.aliyuncs.com/compatible-mode/v1

Each case ran the same two commands:

curl -s http://localhost:4010/v1/model/info -H "Authorization: Bearer sk-1234" | jq -r \
    '.data[] | [.model_name, .model_info.input_cost_per_token, .model_info.input_cost_per_token_thinking,
                .model_info.output_cost_per_token, .model_info.output_cost_per_token_thinking] | @tsv'

curl -s http://localhost:4010/v1/chat/completions -H "Authorization: Bearer sk-1234" \
    -H "Content-Type: application/json" -D - \
    -d '{"model": "<model>", "messages": [{"role": "user", "content": "Reply with one word: hello"}], "max_tokens": 500}'

Before (a28f075)

kimi-k3

  1. /v1/model/info row: kimi-k3 0 0 null null
  2. Completion answered "hello" with usage: {prompt_tokens: 91, completion_tokens: 64, reasoning_tokens: 48} but the headers carried x-litellm-response-cost-original: 0.0, so the request logged at $0

deepseek-v4-pro-0813

  1. /v1/model/info row: deepseek-v4-pro-0813 0 0 null null
  2. Completion answered "hello" with usage: {prompt_tokens: 89, completion_tokens: 26, reasoning_tokens: 24} and x-litellm-response-cost-original: 0.0

After (a481ccf)

kimi-k3

  1. /v1/model/info row: kimi-k3 0.000002827 - 0.000014133 - (single-rate model, no thinking keys)
  2. Completion answered "Hello" with usage: {prompt_tokens: 91, completion_tokens: 52, reasoning_tokens: 35} and headers
x-litellm-response-cost: 0.0009921729999999998
x-litellm-response-cost-input: 0.000257257
x-litellm-response-cost-output: 0.000734916
  1. Matches the entry exactly: 91 x 2.827e-06 = $0.000257257 in, 52 x 1.4133e-05 = $0.000734916 out

deepseek-v4-pro-0813

  1. /v1/model/info row: deepseek-v4-pro-0813 6.36E-7 0.000001272 0.000001908 0.000003816
  2. Completion answered "hello" with usage: {prompt_tokens: 89, completion_tokens: 25, reasoning_tokens: 23} and headers
x-litellm-response-cost: 0.000208608
x-litellm-response-cost-input: 0.000113208
x-litellm-response-cost-output: 9.54e-05
x-litellm-response-cost-reasoning: 8.7768e-05
  1. The response carried reasoning tokens, so every token billed at the thinking rates: 89 x 1.272e-06 = $0.000113208 in (double the non-thinking rate) and 25 x 3.816e-06 = $0.0000954 out, matching the pricing page's CNY 9 / CNY 27 thinking column

Type

🆕 New Feature

Caveats (if any)

  • MiniMax-M3 is Beijing-only, so not live verifiable from an international account: The model MiniMax/MiniMax-M3 does not exist or you do not have access to it on 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 none
  • kimi-k3 is registered under both dashscope/kimi-k3 and dashscope/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 configure
  • Thinking mode is detected from reasoning tokens in the usage, the only signal visible at billing time; a thinking-mode request that emits zero reasoning tokens would bill at base rates

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds DashScope pricing and model metadata for Kimi-K3, MiniMax-M3, and deepseek-v4-pro-0813, plus thinking-mode rate selection

  • Adds both documented Kimi-K3 identifiers and the MiniMax-M3 and deepseek-v4-pro-0813 catalog entries
  • Extends model-info types and lookup propagation with thinking-mode input, cache-read, and output rates
  • Selects alternate DashScope rates when returned usage contains reasoning tokens

Confidence Score: 5/5

The PR appears safe to merge

No blocking failure remains

Important Files Changed

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

Comment thread model_prices_and_context_window.json
Comment thread model_prices_and_context_window.json
@veria-ai

veria-ai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@shivamrawat1

Copy link
Copy Markdown
Contributor Author

@greptileai

@shivamrawat1

Copy link
Copy Markdown
Contributor Author

@greptile review again!

@shivamrawat1

Copy link
Copy Markdown
Contributor Author

@BugBot

@codspeed-hq

codspeed-hq Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_dashscope_kimi_minimax_dsv4pro0813 (a481ccf) with litellm_internal_staging (fde3075)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (8f6de53) during the generation of this report, so fde3075 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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.

1 participant