litellm/tests/unit/integrations/SlackAlerting
edvinsq b21e5305a5
fix(router): register a model_id Bedrock deployment after an ARN deployment for the same profile (#53461)
* fix(router): register a model_id Bedrock deployment after an ARN deployment for the same profile

* fix(router): price a Bedrock model_id deployment from any priced profile row and skip mode checks in the profile merge

A profile cost row now counts as priced when it sets any price field, so cache-only and per-image rows still price the deployment. The profile merge no longer validates mode, so a priced row without mode or with an image_edit mode loads. A model_id deployment whose base_model is the profile ARN now loads beside an ARN deployment

* fix(router): merge only the prices a Bedrock profile row declares

A profile cost row that sets only some prices, such as a cache price, used
to fill the rest with 0 during the profile merge, so a model_id deployment
billed input and output tokens as free. The merge now copies only the
prices the raw profile row sets, so the others come from the base model.

* fix(cost): price a deployment from its served model when its base_model cost row sets no price

* fix(cost): skip only unpriced Bedrock ARN base models, on every pricing surface

A base_model is now skipped for pricing only when it is a Bedrock ARN whose
cost-map row sets no price, the stub an ARN-only deployment registers. Every
other base_model keeps its old behavior, so subscription and Databricks rows
that set no price on purpose still bill 0

The same check now runs for /model/info, model group info, the budget
estimate, the failure spend estimate, the cost estimate endpoint and the
savings baseline, so they all agree with success spend

Request-time Bedrock profile pricing reuses the load-time declared-prices
merge, so a priced profile row with no mode or a non-chat mode bills its
prices instead of returning no cost

* fix(cost): find bare-ARN Bedrock profile rows at load and skip route-prefixed unpriced ARN base models

The load-time profile lookup now uses the bare ARN, which finds a row keyed with or without bedrock/, so a model_id deployment no longer takes a different price depending on load order. A base_model like bedrock/converse/<ARN> or bedrock/invoke/<ARN> whose row sets no price is now skipped like the bare form.

* fix(cost): skip a Bedrock ARN base_model with no price and take left-out rates from the served model

A base_model that is a Bedrock ARN with no price, because its cost row sets none or it has no row, is now skipped as if unset on every pricing path. Region prices, cache prices, the registered deployment row and the Slack model-added alert now match a deployment without that base_model

A model_id deployment now takes the cache, off-peak, service tier and tiered output rates its priced profile row leaves out from the served model, not from the profile row, so cached tokens no longer bill at the profile's full input price

* fix(cost): fill the rates a Bedrock profile row leaves out from the served model at request time

A model_id deployment with no custom prices takes the request-time profile
branch, which returned the bare profile row. A profile row with no cache
price then billed cached tokens at its full input price. The branch now
layers the served model's pricing fields under the profile's declared prices

* fix(cost): keep a flat Bedrock profile or registered price over the served model's long-context rates

The request-time profile branch put the served model's pricing fields under
the profile's declared prices with a plain merge. A flat input price from the
profile row or from register_model then kept the served model's
above-threshold rate, so long prompts billed at that rate. The served rates
now go under the profile's prices, and the registration goes on top, with
the same flat-price rule register_model uses

The Slack model-added alert test now reads the queued message instead of
mocking send_alert

* fix(cost): treat a Bedrock profile row with any declared price as priced at request time

The request-time profile branch counted a profile row as priced only when it
set a per-token or per-second rate, so a row with only a cache price was
skipped and cached tokens billed at the served model's cache price. It now
uses the same declared-price test as the load-time path

The served model's prices under the profile now come from its cost-map row as
declared, not from get_model_info, which fills an unset input or output price
with 0

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-22 22:27:56 +00:00
..
__init__.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_budget_alert_types.py feat(proxy): email alerts at configured percentages of a team member budget (#42665) 2026-09-26 02:42:45 +00:00
test_hanging_request_check.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_model_deprecation_alert.py feat(alerts): add management controls and opt-in daily summaries (#51418) 2026-11-12 10:06:07 -08:00
test_ms_teams.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_slack_alerting.py fix(router): register a model_id Bedrock deployment after an ARN deployment for the same profile (#53461) 2026-11-22 22:27:56 +00:00
test_slack_alerting_delivery.py test: replace 61 live logging and otel tests with offline unit and integration coverage (#45362) 2026-10-08 15:55:57 -07:00
test_slack_alerting_digest.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00
test_slack_alerting_utils.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
test_user_spend_alerts.py test: move tests/test_litellm integrations and secret_managers into tests/unit (#43194) 2026-09-25 12:57:07 -07:00