发布

  • [BE] fix: register deepseek as a canonical provider so DeepSeek model prices load (#7434)

    frostbyte_neo 发布于 2026-07-13 11:30:12 +00:00

    Following the pattern of #7262 (azure), #7432 (perplexity) and #7433
    (xai) — deepseek is not currently in PROVIDERS_MAPPING, so all 12
    entries in model_prices_and_context_window.json tagged with
    litellm_provider: "deepseek" silently drop at load time. Every one
    publishes non-zero input+output rates: deepseek-chat, deepseek-reasoner,
    deepseek-v4-flash, deepseek-v4-pro, plus the deepseek/deepseek-coder,
    deepseek/deepseek-r1, deepseek/deepseek-v3, deepseek/deepseek-v3.2
    variants.

    9 of the 12 also publish cache_read_input_token_cost. DeepSeek's cost
    calc in LiteLLM (litellm/llms/deepseek/cost_calculator.py) is a
    one-liner that delegates directly to generic_cost_per_token — the same
    helper OpenAI/xAI use — so DeepSeek's usage payload follows OpenAI's
    shape (prompt_tokens_details.cached_tokens flattened under
    original_usage.*). Route it through the existing
    textGenerationWithCacheCostOpenAI calculator; no new cache-calc method
    needed.

    Parameterized test uses deepseek/deepseek-coder (no cache ->
    textGenerationCost) and deepseek/deepseek-chat (input 2.8e-7, output
    4.2e-7, cache_read 2.8e-8 -> textGenerationWithCacheCostOpenAI). Both
    branches exercised in regressions.

    Co-authored-by: Claude Opus 4.7 (1M context) noreply@anthropic.com

    下载附件