Skip to content

feat: add Kimi K3 pricing for openrouter and novita - #36652

Closed
zainulabidin776 wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
zainulabidin776:litellm_kimi_k3_pricing
Closed

zainulabidin776 wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
zainulabidin776:litellm_kimi_k3_pricing

Conversation

@zainulabidin776

Copy link
Copy Markdown

Kimi K3 had no entry in either model cost map, so calls routed through openrouter/moonshotai/kimi-k3 or novita/moonshotai/kimi-k3 logged $0 spend and silently under-counted budgets, spend alerts and per-key limits

Prices come from the provider APIs directly, recorded in each entry's source field. Novita quotes price_per_m in units of 1e-10 USD per token, confirmed against the three existing novita/moonshotai entries already in the map. Both providers independently report $3.00 per million input, $15.00 per million output and $0.30 per million cached input

The openrouter entry intentionally omits max_output_tokens because OpenRouter reports top_provider.max_completion_tokens as null for this model. A test pins that absence so it does not get backfilled with the context length by assumption

Refs #33921

TLDR

Problem this solves:

  • ...

How it solves it:

  • ...

User Flow

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
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • 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

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Caveats (if any)

QA runbook

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

Kimi K3 had no entry in either model cost map, so calls routed through
openrouter/moonshotai/kimi-k3 or novita/moonshotai/kimi-k3 logged $0 spend
and silently under-counted budgets, spend alerts and per-key limits

Prices come from the provider APIs directly, recorded in each entry's source
field. Novita quotes price_per_m in units of 1e-10 USD per token, confirmed
against the three existing novita/moonshotai entries already in the map. Both
providers independently report $3.00 per million input, $15.00 per million
output and $0.30 per million cached input

The openrouter entry intentionally omits max_output_tokens because OpenRouter
reports top_provider.max_completion_tokens as null for this model. A test pins
that absence so it does not get backfilled with the context length by assumption

Refs BerriAI#33921
@CLAassistant

CLAassistant commented Aug 12, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR registers Kimi K3 pricing and capabilities for OpenRouter and Novita so calls receive non-zero cost accounting.

  • Adds matching pricing entries to the canonical and backup maps.
  • Records input, output, and cached-input token rates.
  • Adds regression coverage for map parity and standard token costs.
  • Intentionally leaves OpenRouter’s unpublished output limit unset.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking gap in regression coverage for cached-input pricing.

The pricing entries resolve through the existing generic calculator and standard token costs are tested, but the tests never provide cached-token usage to prove that the new cache-read rate is applied.

Files Needing Attention: tests/test_litellm/test_kimi_k3_pricing.py

Important Files Changed

Filename Overview
model_prices_and_context_window.json Adds canonical OpenRouter and Novita Kimi K3 pricing, context limits, and capability metadata with no identified functional defect.
litellm/model_prices_and_context_window_backup.json Mirrors the new canonical pricing entries exactly for local and fallback loading.
tests/test_litellm/test_kimi_k3_pricing.py Verifies map parity and ordinary token costs but does not exercise the newly added cached-token calculation path.

Reviews (1): Last reviewed commit: "feat: add Kimi K3 pricing for openrouter..." | Re-trigger Greptile

Comment on lines +137 to +140
)

assert prompt_usd == pytest.approx(3.0)
assert completion_usd == pytest.approx(15.0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Cached pricing path remains untested

The new cost assertion supplies only aggregate token counts, so it never exercises cache_read_input_token_cost. A regression that ignores the added cached-input rate would still pass this suite and silently overcharge cached requests.

Knowledge Base Used: Cost Tracking and Budget Enforcement

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing zainulabidin776:litellm_kimi_k3_pricing (496adcd) with litellm_internal_staging (f64479e)

Open in CodSpeed

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Superseded by rolling registry audit #37902, which reverified and absorbed the provider-documented metadata changes at field level

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.

2 participants