feat(core): support custom model aliases in config.toml

Preserve custom model alias support on the current origin/main base and collapse the branch back to a single commit for easier future restacks.
This commit is contained in:
Friel
2026-03-28 11:35:15 -07:00
parent 65f631c3d6
commit d6f8e3aeeb
28 changed files with 732 additions and 139 deletions
+10
View File
@@ -243,6 +243,11 @@ const fn default_effective_context_window_percent() -> i64 {
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, TS, JsonSchema)]
pub struct ModelInfo {
pub slug: String,
/// Provider-facing model slug to send on API requests.
///
/// When unset, `slug` is used.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub request_model: Option<String>,
pub display_name: String,
pub description: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
@@ -294,6 +299,10 @@ pub struct ModelInfo {
}
impl ModelInfo {
pub fn request_model_slug(&self) -> &str {
self.request_model.as_deref().unwrap_or(self.slug.as_str())
}
pub fn auto_compact_token_limit(&self) -> Option<i64> {
let context_limit = self
.context_window
@@ -519,6 +528,7 @@ mod tests {
fn test_model(spec: Option<ModelMessages>) -> ModelInfo {
ModelInfo {
slug: "test-model".to_string(),
request_model: None,
display_name: "Test Model".to_string(),
description: None,
default_reasoning_level: None,