From 34d1e4b041c76547d8b070da0a4ad1261a508e39 Mon Sep 17 00:00:00 2001 From: Shroominic Date: Tue, 9 Dec 2025 15:03:16 +0800 Subject: [PATCH] populate upstream_provider_id --- routstr/algorithm.py | 7 ++++++- routstr/payment/models.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/routstr/algorithm.py b/routstr/algorithm.py index ccdc7088..a1b6babd 100644 --- a/routstr/algorithm.py +++ b/routstr/algorithm.py @@ -254,7 +254,12 @@ def create_model_mappings( # Add to unique models base_id = get_base_model_id(model_to_use.id) if not is_openrouter or base_id not in unique_models: - unique_model = model_to_use.copy(update={"id": base_id}) + unique_model = model_to_use.copy( + update={ + "id": base_id, + "upstream_provider_id": upstream.provider_type, + } + ) unique_models[base_id] = unique_model # Get all aliases for this model diff --git a/routstr/payment/models.py b/routstr/payment/models.py index 4fd398ea..765e73a5 100644 --- a/routstr/payment/models.py +++ b/routstr/payment/models.py @@ -67,7 +67,7 @@ class Model(BaseModel): per_request_limits: dict | None = None top_provider: TopProvider | None = None enabled: bool = True - upstream_provider_id: int | None = None + upstream_provider_id: int | str | None = None canonical_slug: str | None = None alias_ids: list[str] | None = None