发布

  • [BE] fix: register azure as a canonical provider so Azure model prices load (#7262)

    frostbyte_neo 发布于 2026-07-02 11:44:05 +00:00

    The PROVIDERS_MAPPING currently registers microsoft -> azure, but no entry
    in model_prices_and_context_window.json uses microsoft as its
    litellm_provider — the mapping was added for a single override-file row
    (azure/multilingual-e5-large). Meanwhile 199 entries in the main JSON use
    the literal azure litellm_provider (the full azure/gpt-4o*,
    azure/gpt-5*, azure/codex-mini, azure/command-r-plus, etc. lineup),
    and every one of them is silently dropped at load time because
    buildModelPrice returns null when the provider is not in PROVIDERS_MAPPING.

    Register azure -> azure alongside the existing microsoft entry (which we
    keep for backward compatibility with the override row), and route azure
    through the existing OpenAI cache calculator since Azure-hosted OpenAI
    models share OpenAI's usage shape (cached_tokens flattened under
    prompt_tokens_details.cached_tokens).

    Tested in CostServiceTest with azure/command-r-plus (no cache rates ->
    textGenerationCost path) and azure/gpt-4.1 (cache rates ->
    textGenerationWithCacheCostOpenAI path). Both branches green.

    Co-authored-by: Andres Cruz andresc@comet.com

    下载附件