From 7fbab107edc071ff68ea8dfb518a0adbbba07ab7 Mon Sep 17 00:00:00 2001 From: 9qeklajc Date: Sat, 3 Oct 2026 18:38:44 +0200 Subject: [PATCH] docs: describe forwarded_model_id as the client-facing alias, not the upstream model name --- routstr/core/db.py | 6 +++++- routstr/upstream/model_paths.py | 9 +++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/routstr/core/db.py b/routstr/core/db.py index 84307a7e..c17a1093 100644 --- a/routstr/core/db.py +++ b/routstr/core/db.py @@ -435,7 +435,11 @@ class ModelRow(SQLModel, table=True): # type: ignore enabled: bool = Field(default=True, description="Whether this model is enabled") forwarded_model_id: str | None = Field( default=None, - description="Model ID to use when forwarding requests to upstream provider. Defaults to id if not set.", + description=( + "Client-facing alias advertised by /v1/models and accepted on " + "requests in place of id. JSON request bodies sent upstream carry " + "id (via the provider's transform_model_name), not this value." + ), ) upstream_provider: "UpstreamProviderRow" = Relationship(back_populates="models") diff --git a/routstr/upstream/model_paths.py b/routstr/upstream/model_paths.py index bcda8d39..f984fd77 100644 --- a/routstr/upstream/model_paths.py +++ b/routstr/upstream/model_paths.py @@ -228,10 +228,11 @@ def openrouter_author_slug(model: object) -> str | None: """Return a canonical ``author/slug`` for the OpenRouter endpoints API. Prefer ``canonical_slug``, then a slash-containing ``id``, then a - slash-containing ``forwarded_model_id``. The forwarded id is exactly what - the proxy sends upstream for admin-created alias rows (``base.py`` forwards - ``forwarded_model_id or id``), so it is a valid OpenRouter id when the - bare ``id`` is a local alias with no slash. + slash-containing ``forwarded_model_id``. That field is the client-facing + alias: JSON request bodies sent upstream carry + ``transform_model_name(model.id)``, not it (``base.py``). It is used here + only as a last-resort guess at an ``author/slug`` when neither + ``canonical_slug`` nor ``id`` carries one. """ canonical = getattr(model, "canonical_slug", None) if canonical and "/" in canonical: