From a7835056c9880cb2e5a157d54106bddb770774f8 Mon Sep 17 00:00:00 2001 From: Bentlybro Date: Fri, 13 Feb 2026 15:10:09 +0000 Subject: [PATCH] fix(llm): key migration cost overrides by targetModelSlug The override dict should be keyed by the TARGET model slug (where nodes migrated TO), not the source model slug. This ensures the custom cost is applied when building costs for the model that nodes are actually using. --- autogpt_platform/backend/backend/data/block_cost_config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autogpt_platform/backend/backend/data/block_cost_config.py b/autogpt_platform/backend/backend/data/block_cost_config.py index b39ea48d8a..76f02ffa0a 100644 --- a/autogpt_platform/backend/backend/data/block_cost_config.py +++ b/autogpt_platform/backend/backend/data/block_cost_config.py @@ -94,8 +94,10 @@ async def _build_llm_costs_from_registry() -> list[BlockCost]: "customCreditCost": {"not": None}, } ) + # Key by targetModelSlug since that's the model nodes are now using + # after migration. The custom cost applies to the target model. migration_overrides = { - migration.sourceModelSlug: migration.customCreditCost + migration.targetModelSlug: migration.customCreditCost for migration in active_migrations if migration.customCreditCost is not None }