发布

  • [issue-5621] [BE] fix: strip provider prefix in findModelPrice() for LiteLLM OTel (#5622)

    frostbyte_neo 发布于 2026-03-13 18:32:40 +00:00

    • [issue-5621] [BE] fix: strip provider prefix in findModelPrice() for LiteLLM OTel model names

    LiteLLM sends model names with provider prefix via gen_ai.request.model
    (e.g. "openai/gpt-4o"). The pricing map stores keys without the prefix
    (e.g. "gpt-4o/openai") because parseModelName() strips it at load time,
    but findModelPrice() was not stripping it at lookup time, causing all
    four fallback attempts to fail and returning zero cost.

    Apply parseModelName() at the top of findModelPrice() before any lookup.

    Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

    • [issue-5621] [BE] address review: clarify prefix-stripping safety and extend test coverage
    • Expand inline comment on parseModelName() call to explain the invariant:
      parseModelPrices() already strips prefixes when building the map, so
      all subsequent normalization steps operate on the same prefix-free name.
    • Add Fixes #5621 note to findModelPrice() Javadoc.
    • Extend provideModelNamesForNormalization to cover provider-prefix +
      dot-notation and provider-prefix + case-variation combinations.
    • Extend provideModelNamesWithDateSuffixes to cover provider-prefix +
      date-suffix combinations, verifying the normalizations compose correctly.

    Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com


    Co-authored-by: Douglas Blank doug@comet.com
    Co-authored-by: Claude Sonnet 4.6 noreply@anthropic.com

    下载附件