Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions crates/aisix-core/src/models/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,24 @@ pub struct Model {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub provider: Option<String>,

/// Upstream model id sent to the provider (e.g. "gpt-4o",
/// "claude-sonnet-4-5"). None for routing models.
/// Upstream model id sent to the provider — the literal string
/// the upstream LLM API expects in its `model` field
/// (e.g. `"gpt-4o"`, `"claude-sonnet-4-5"`,
/// `"gpt-4o-mini-2024-08-06"`). `None` for routing models.
Comment on lines +220 to +223
///
/// **NOTE — this field name is a known footgun.** Some other proxy
/// gateways define a `model_name` field that holds the
/// *customer-facing alias* (the name a client SDK sends), with a
/// separate `model` sub-field holding the upstream id. In this
/// codebase the convention is reversed: `display_name` (above)
/// is the customer-facing alias, and **`model_name` is the
/// upstream id**. When reading or writing this struct, do not
/// assume the field name alone disambiguates the role — read
/// the docs.
///
/// Renaming this field to `upstream_id` to remove the ambiguity
/// is tracked at api7/AISIX-Cloud#470 but deferred behind a
/// coordinated wire-format change across cp-api + dashboard.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub model_name: Option<String>,

Expand Down
2 changes: 1 addition & 1 deletion schemas/resources/model.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"type": "string"
},
"model_name": {
"description": "Upstream model id sent to the provider (e.g. \"gpt-4o\", \"claude-sonnet-4-5\"). None for routing models.",
"description": "Upstream model id sent to the provider — the literal string the upstream LLM API expects in its `model` field (e.g. `\"gpt-4o\"`, `\"claude-sonnet-4-5\"`, `\"gpt-4o-mini-2024-08-06\"`). `None` for routing models.\n\n**NOTE — this field name is a known footgun.** Some other proxy gateways define a `model_name` field that holds the *customer-facing alias* (the name a client SDK sends), with a separate `model` sub-field holding the upstream id. In this codebase the convention is reversed: `display_name` (above) is the customer-facing alias, and **`model_name` is the upstream id**. When reading or writing this struct, do not assume the field name alone disambiguates the role — read the docs.\n\nRenaming this field to `upstream_id` to remove the ambiguity is tracked at api7/AISIX-Cloud#470 but deferred behind a coordinated wire-format change across cp-api + dashboard.",
"type": [
"string",
"null"
Expand Down
Loading