Skip to content

fix: suppress misleading register_model unresolved-cost warnings for entries without custom pricing - #38542

Merged
yassin-berriai merged 3 commits into
litellm_internal_stagingfrom
litellm_fix_register_model_unresolved_cost_warnings
Aug 27, 2026
Merged

yassin-berriai merged 3 commits into
litellm_internal_stagingfrom
litellm_fix_register_model_unresolved_cost_warnings

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Startup spams register_model unresolved-cost warnings for deployments with no custom pricing
  • Warnings name opaque sha256 deployment ids instead of the model
  • Customers read this as "cost tracking is broken" when it is not

How it solves it:

  • Warn only when the registered entry carries explicit custom pricing
  • Warning now says only cache cost fields default to 0
  • Router and per-request registrations pass the readable model name for the warning

User Flow

Before: a proxy admin with Bedrock models configured (with or without explicit pricing) sees scary unresolved-cost warnings at every boot

  1. They start the proxy with a config listing Bedrock and Azure deployments
  2. The startup log prints register_model: model=d3582bc5... not in built-in cost map ... cache cost fields will default to 0 for hashed ids and for deployments that have no custom pricing at all
  3. They check http://localhost:4000/ui/?page=models and see input/output/cache pricing configured correctly, and requests are billed correctly, so the warning is noise

After: the same boot is quiet unless a deployment genuinely has incomplete custom pricing

  1. They start the proxy with the same config
  2. No register_model warning is printed for deployments without custom pricing or whose backend model resolves in the built-in cost map
  3. If a deployment sets input/output pricing on a model the cost map does not know, one warning is printed naming the readable model (never a hash) and saying only cache cost fields default to 0
  4. POST http://localhost:4000/v1/chat/completions returns 200 with the same x-litellm-response-cost as before

Relevant issues

Fixes #32484

Linear ticket

Resolves LIT-6318

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

Shared setup: live proxy on localhost:4000, LITELLM_LOCAL_MODEL_COST_MAP=True, real AWS Bedrock credentials. Main config has a Bedrock deployment with explicit input/output/cache_read pricing plus an inference profile id, an Azure deployment with a base_model, and a plain Bedrock invoke deployment. Edge config has one Bedrock deployment with custom input/output pricing on a made-up model name (bedrock/lit6318-totally-made-up-model) so pricing is genuinely incomplete

Before (86ef1fb)

Boot with configured pricing emits opaque-hash warnings

  1. litellm --config lit6318_config.yaml --port 4000, then grep register_model proxy.log
  2. Three warnings, two naming sha256 hashes, all claiming the model is "not in built-in cost map ... cache cost fields will default to 0":
register_model: model=d3582bc536fabcb94e681e7dc4dfe2e38dd4b9fa511892c44bffe14f785cdf43 not in built-in cost map and no prefix/region variant matched; cache cost fields will default to 0. To track cache cost, add cache_creation_input_token_cost and cache_read_input_token_cost to model_info
register_model: model=azure/my-deployment-name not in built-in cost map and no prefix/region variant matched; cache cost fields will default to 0. To track cache cost, add cache_creation_input_token_cost and cache_read_input_token_cost to model_info
register_model: model=e42c3315d3a058c7b54bb3d83293c09d2f704847ff0b738bb8f6101ab4d7b310 not in built-in cost map and no prefix/region variant matched; cache cost fields will default to 0. To track cache cost, add cache_creation_input_token_cost and cache_read_input_token_cost to model_info

Live Bedrock request is billed correctly despite the warnings

  1. curl -sD - http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d '{"model":"bedrock-invoke-haiku","messages":[{"role":"user","content":"Say OK"}],"max_tokens":10}'
  2. HTTP/1.1 200 OK with x-litellm-response-cost: 3.19e-05 and the completion "OK", proving the warnings were noise

Genuinely incomplete custom pricing warns with a hash

  1. Boot the edge config, then grep register_model proxy.log
  2. Two warnings for the one deployment, one naming the opaque hash:
register_model: model=80e6f3fd188fd7605188939d27a76b6b0718158ca48b59acbef5bb46b1a2afcf not in built-in cost map and no prefix/region variant matched; cache cost fields will default to 0. ...
register_model: model=bedrock/lit6318-totally-made-up-model not in built-in cost map and no prefix/region variant matched; cache cost fields will default to 0. ...

After (d321dc6)

Boot with configured pricing emits opaque-hash warnings

  1. litellm --config lit6318_config.yaml --port 4000 (byte-identical config), then grep register_model proxy.log
  2. Zero register_model warnings

Live Bedrock request is billed correctly despite the warnings

  1. Same curl as before
  2. HTTP/1.1 200 OK with the identical x-litellm-response-cost: 3.19e-05, so per-request spend is unchanged

Genuinely incomplete custom pricing warns with a hash

  1. Boot the same edge config, then grep register_model proxy.log
  2. Exactly one precise warning, naming the readable model instead of the hash and scoping the impact to cache fields:
register_model: model=bedrock/lit6318-totally-made-up-model has custom pricing but not in built-in cost map and no prefix/region variant matched; cache_creation_input_token_cost and cache_read_input_token_cost will default to 0 for this model (input/output cost tracking is unaffected). To track cache cost, add them to model_info

Type

Bug Fix

Caveats (if any)

Low

  • Per-request re-registration of a custom-priced deployment can still warn once
  • That warning now names the readable provider/model key, not the hash

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

Link to Devin session: https://app.devin.ai/sessions/7f184ca33c3f4ac08bcbc818441b74c0
Open in Devin Desktop: https://app.devin.ai/desktop/session/7f184ca33c3f4ac08bcbc818441b74c0?variant=devin
Requested by: @yassin-berriai

…entries without custom pricing

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

No action taken on #38542 — repo and author (devin-ai-integration[bot]) match, but the PR has no labels at all, so the required enterprise label is absent. No GitHub or Linear changes made.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR suppresses unresolved-cache-pricing warnings for registrations without explicit custom pricing and replaces opaque deployment IDs with readable model names.

  • Limits warnings to unmatched entries with explicit flat input/output pricing and missing cache pricing.
  • Excludes tiered pricing, whose cache rates fall back to tier input rates.
  • Passes readable model names when router and request paths register opaque deployment IDs.
  • Adds regression coverage for silent registrations and warning display names.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
litellm/utils.py Narrows the warning condition and accurately describes the zero-valued cache pricing fallback for non-tiered custom pricing.
litellm/router.py Supplies the configured backend model as the warning display name when registering deployment IDs.
litellm/main.py Supplies the shared provider/model key as the display name during per-request router registration.
tests/test_litellm/test_register_model_custom_pricing.py Adds focused coverage for silent unpriced and tiered registrations plus readable router warning names.

Reviews (2): Last reviewed commit: "fix: do not warn about zero cache costs ..." | Re-trigger Greptile

Comment thread litellm/utils.py
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Fixed in 992b74b: tiered entries no longer warn since tiered cache reads fall back to the input rate, and a regression test covers it

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

…itellm_fix_register_model_unresolved_cost_warnings
@codspeed

codspeed Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_fix_register_model_unresolved_cost_warnings (d321dc6) with litellm_internal_staging (ca9007b)

Open in CodSpeed

@yassin-berriai
yassin-berriai merged commit f864908 into litellm_internal_staging Aug 27, 2026
78 checks passed
@yassin-berriai
yassin-berriai deleted the litellm_fix_register_model_unresolved_cost_warnings branch August 27, 2026 19:45
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.

[Bug]: Unexpected log messages about unresolved cost information with Docker image 1.90.0

3 participants