litellm/tests/unit/proxy/management_endpoints
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
..
management_v1 feat(proxy): add app groups with shared budgets and usage (#53232) 2026-11-21 12:50:58 -08:00
policy_endpoints fix(policy): drop refused temperatures on policy template enrichment calls (#53311) 2026-11-21 14:01:06 -08:00
scim refactor(auth_cache_invalidation): move the invalidation channel to the native client (#51135) 2026-11-21 18:58:27 +09:00
search_endpoints refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
sso ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
usage_endpoints feat(ui): unify gateway and usage assistance as Aria Agent (#48082) 2026-10-23 20:24:19 +00:00
__init__.py ci: move tests/proxy_unit_tests to tests/unit/proxy and run the proxy-db shards from litellm-tests (#42903) 2026-09-24 22:59:11 +00:00
jwt_key_mapping_doubles.py feat(auth): read virtual keys, jwt key mappings and model access groups through rust repositories (#52173) 2026-11-18 03:53:37 +00:00
test_access_group_endpoints.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_access_group_management.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_activity_tenant_scoping.py feat(proxy): bounded daily activity routes for all usage entities (#43408) 2026-10-01 16:57:23 -07:00
test_auto_router_endpoints.py feat(auth): read teams, team memberships and organizations through rust repositories (#52176) 2026-11-18 22:32:05 +00:00
test_budget_endpoints.py feat(proxy)!: carry unused budget into the next period with a cap (#53309) 2026-11-22 02:05:03 -08:00
test_cache_settings_endpoints.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_callback_management_endpoints.py feat(otel): let team and key Arize callbacks choose the OTLP transport (#44492) 2026-10-06 14:46:50 -05:00
test_common_daily_activity.py feat(customer-portal): show token usage and cache costs (#52601) 2026-11-18 18:49:08 -08:00
test_common_utils.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_compliance_endpoints.py test(proxy): move management_endpoints, management_helpers and guardrails tests into tests/unit/proxy (#44003) 2026-10-01 10:52:03 -07:00
test_config_override_endpoints.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_coordination_redis_endpoints.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_cost_estimate_endpoint.py refactor(router): move router callers onto the entry points and invert the proxy imports (#48847) 2026-10-29 17:26:33 +00:00
test_cost_tracking_settings.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_credential_migration.py fix(proxy): rotate all database secrets with the master key (#52998) 2026-11-20 10:02:59 -08:00
test_customer_budget.py fix(proxy): /customer/new budgets reset on the same schedule as other budgets (#51689) 2026-11-13 19:22:14 +00:00
test_customer_endpoints.py refactor(auth_cache_invalidation): move the invalidation channel to the native client (#51135) 2026-11-21 18:58:27 +09:00
test_daily_activity_routes.py feat(skills): export download history as streamed CSV (#52569) 2026-11-21 21:14:46 +00:00
test_delete_callbacks_endpoint.py fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
test_delete_verification_tokens_failed.py feat(auth): read virtual keys, jwt key mappings and model access groups through rust repositories (#52173) 2026-11-18 03:53:37 +00:00
test_encryption_endpoints.py test: migrate tests/proxy_behavior into integration and unit tiers (#45939) 2026-10-11 08:28:42 -07:00
test_entraid_app_roles.py test(proxy): move management_endpoints, management_helpers and guardrails tests into tests/unit/proxy (#44003) 2026-10-01 10:52:03 -07:00
test_gateway_request_endpoints.py refactor(proxy): inject gateway activity through a typed repository (#49116) 2026-10-30 16:25:11 -07:00
test_id_jag_assertion_capture.py feat(sso): retain the SAML assertion at login as the saml2 subject token for oauth2_id_jag (#46745) 2026-10-16 12:16:56 -07:00
test_internal_user_endpoints.py feat(proxy)!: carry unused budget into the next period with a cap (#53309) 2026-11-22 02:05:03 -08:00
test_jwt_key_mapping.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_key_budget_change.py feat(auth): read teams, team memberships and organizations through rust repositories (#52176) 2026-11-18 22:32:05 +00:00
test_key_generate_prisma.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_key_management_endpoints.py fix(proxy): read per-model key limits after they move into metadata (#53447) 2026-11-21 22:06:11 +00:00
test_management_route_coverage.py test: migrate tests/proxy_behavior into integration and unit tiers (#45939) 2026-10-11 08:28:42 -07:00
test_mcp_connector_import.py feat(mcp)!: disable stdio MCP servers by default (#44066) 2026-10-02 10:28:04 -07:00
test_mcp_management_endpoints.py test(mcp): give the pin test's proxy_server stub the general settings reader (#53295) 2026-11-20 19:56:03 -08:00
test_mcp_servers.py refactor(mcp): drop the experimental label from the MCP server and client paths (#48513) 2026-10-27 17:47:50 +00:00
test_model_deprecation_alerts.py feat(proxy): add model deprecation alerts with daily requests by key (#50022) 2026-11-05 04:03:42 +00:00
test_model_insights_endpoints.py feat(alerts): detect daily changes in recorded usage (#50666) 2026-11-11 18:23:02 -08:00
test_model_management_endpoints.py fix(proxy): preserve explicit model prices when metadata echoes null (#48746) 2026-11-16 08:33:45 -08:00
test_org_admin_team_access.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_organization_endpoints.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_password_endpoints.py feat(proxy): hash UI passwords with PBKDF2 in FIPS mode (#49874) 2026-11-06 01:31:59 -08:00
test_policy_endpoints.py fix(guardrails): log requests that a guardrail blocks on /apply_guardrail (#51014) 2026-11-16 15:18:08 -08:00
test_project_org_authz.py test(proxy): move management_endpoints, management_helpers and guardrails tests into tests/unit/proxy (#44003) 2026-10-01 10:52:03 -07:00
test_prompt_cache_prediction.py feat(callbacks-parallel-request-limiter): port parallel request limiter v3 to a rust callback (#51537) 2026-11-16 22:56:38 -08:00
test_prompt_caching_requests.py fix(proxy): cancel the Admin UI's raw spend-log reads in Postgres after 30s (#49965) 2026-11-03 16:07:00 -08:00
test_ptu_consumption.py fix(router): serve a team's wildcard deployment before a proxy-wide wildcard (#48490) 2026-10-26 17:06:09 -07:00
test_ptu_model_settings.py refactor(router): delete the python router core, the rust core is the only core (#50178) 2026-11-05 10:40:46 -08:00
test_request_error_endpoints.py feat(proxy): track failed requests by HTTP status and caller (#45244) 2026-10-09 14:27:56 -07:00
test_roi_calculator_endpoints.py feat(roi): measure shipping velocity, quality, and recorded spend (#44426) 2026-10-03 23:07:34 +00:00
test_router_settings_endpoints.py fix(security): remove the publicly known master key from the repo (#44718) 2026-10-06 10:55:24 -07:00
test_saml_sso.py refactor(mcp): drop the experimental label from the MCP server and client paths (#48513) 2026-10-27 17:47:50 +00:00
test_session_endpoints.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_sso_helper_utils.py refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
test_subscription_accounts.py feat(auth): decide key and JWT authentication in a Rust core (#51374) 2026-11-17 14:07:47 +09:00
test_tag_management_endpoints.py feat(proxy)!: carry unused budget into the next period with a cap (#53309) 2026-11-22 02:05:03 -08:00
test_team_admin_field_permissions.py feat(proxy): require customer headers by gateway, team, or key (#53045) 2026-11-21 20:20:26 +00:00
test_team_callback_endpoints.py feat(otel): let a team or key excluded_services override the global setting for its OTel v2 destination (#45880) 2026-10-12 19:25:52 -04:00
test_team_default_params.py feat(team): let default_team_params attach access_group_ids to every new team (#49908) 2026-11-05 19:58:51 -08:00
test_team_endpoints.py feat(proxy)!: carry unused budget into the next period with a cap (#53309) 2026-11-22 02:05:03 -08:00
test_team_model_alias_merge.py refactor(proxy): expose public names for private proxy helpers (#45170) 2026-10-07 18:59:27 -07:00
test_tool_management_endpoints.py test(proxy): move management_endpoints, management_helpers and guardrails tests into tests/unit/proxy (#44003) 2026-10-01 10:52:03 -07:00
test_ui_sso.py refactor(auth_cache): type auth cache keys and keep the cache always native (#51130) 2026-11-21 17:20:30 +09:00
test_user_agent_analytics_endpoints.py refactor(typing): clear about 1,100 basedpyright Any errors across 303 files (#49986) 2026-11-06 13:31:15 -08:00
test_workflow_management_endpoints.py feat(control_plane): dataplane registry, credential strategies and client (#49655) 2026-11-16 17:36:23 +00:00