docs: describe forwarded_model_id as the client-facing alias, not the upstream model name

This commit is contained in:
9qeklajc
2026-10-03 18:38:44 +02:00
parent 00573a77ac
commit 7fbab107ed
2 changed files with 10 additions and 5 deletions
+5 -1
View File
@@ -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")
+5 -4
View File
@@ -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: