Skip to content

Commit 803d7e4

Browse files
committed
fix(subscription): accept deployed Sonnet 4.6 model ID
1 parent f8b9d49 commit 803d7e4

1 file changed

Lines changed: 49 additions & 4 deletions

File tree

‎crates/jcode-base/src/subscription_catalog.rs‎

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub struct CuratedModel {
119119
}
120120

121121
pub const CURATED_MODELS: &[CuratedModel] = &[
122-
// Only supported Claude 5.5 and GPT 6.1 models are offered.
122+
// Preserve existing selections while also accepting exact deployed router IDs.
123123
CuratedModel {
124124
id: "claude-opus-5-5",
125125
display_name: "Claude Opus 5.5",
@@ -166,6 +166,20 @@ pub const CURATED_MODELS: &[CuratedModel] = &[
166166
min_tier: JcodeTier::Plus,
167167
note: "Frontier model; routed server-side to OpenAI by the jcode router.",
168168
},
169+
CuratedModel {
170+
id: "claude-sonnet-4-6",
171+
display_name: "Claude Sonnet 4.6",
172+
aliases: &[
173+
"claude-sonnet-4-6",
174+
"sonnet-4-6",
175+
"sonnet 4.6",
176+
"claude sonnet 4.6",
177+
],
178+
default_enabled: false,
179+
routing_policy: UpstreamRoutingPolicy::ServerManaged,
180+
min_tier: JcodeTier::Plus,
181+
note: "Deployed managed model; routed server-side to Anthropic by the jcode router.",
182+
},
169183
];
170184

171185
pub fn curated_models() -> &'static [CuratedModel] {
@@ -390,6 +404,7 @@ mod tests {
390404
"claude-sonnet-5-5",
391405
"claude-haiku-5-5",
392406
"gpt-6.1-sol",
407+
"claude-sonnet-4-6",
393408
];
394409

395410
#[test]
@@ -414,14 +429,44 @@ mod tests {
414429
assert_eq!(canonical_model_id("unknown-model"), None);
415430
}
416431

432+
#[test]
433+
fn deployed_sonnet_id_is_preserved_for_managed_selection() {
434+
for selection in [
435+
"claude-sonnet-4-6",
436+
"sonnet 4.6",
437+
"Claude Sonnet 4.6",
438+
"claude-sonnet-4-6@anthropic",
439+
"claude-sonnet-4-6[1m]",
440+
] {
441+
assert_eq!(canonical_model_id(selection), Some("claude-sonnet-4-6"));
442+
assert!(is_model_allowed_for_current_tier(selection));
443+
}
444+
let model = find_curated_model("claude-sonnet-4-6").unwrap();
445+
assert_eq!(model.routing_policy, UpstreamRoutingPolicy::ServerManaged);
446+
assert_eq!(model.min_tier, JcodeTier::Plus);
447+
let route = crate::provider::ModelRoute {
448+
model: model.id.to_string(),
449+
provider: JCODE_PROVIDER_DISPLAY_NAME.to_string(),
450+
api_method: JCODE_ROUTE_API_METHOD.to_string(),
451+
available: true,
452+
detail: routing_policy_detail(model),
453+
usage: None,
454+
cheapness: None,
455+
};
456+
let selection = jcode_provider_core::RouteSelection::from_model_route(&route);
457+
assert_eq!(selection.routed_model_spec(), "claude-sonnet-4-6");
458+
assert_eq!(
459+
selection.runtime_key,
460+
jcode_provider_core::RuntimeKey::JcodeSubscription
461+
);
462+
}
463+
417464
#[test]
418465
fn retired_models_and_unsupported_generations_are_not_curated() {
419466
for model in [
420467
"claude-opus-4-8",
421468
"opus 4.8",
422469
"claude-opus-5",
423-
"claude-sonnet-4-6",
424-
"sonnet 4.6",
425470
"claude-fable-5",
426471
"gpt-5.4",
427472
"gpt-5.5",
@@ -499,7 +544,7 @@ mod tests {
499544
.iter()
500545
.all(|model| model.min_tier != JcodeTier::Flagship)
501546
);
502-
assert_eq!(CURATED_MODELS.len(), 4);
547+
assert_eq!(CURATED_MODELS.len(), 5);
503548
assert!(find_curated_model("magistral-small-1.2").is_none());
504549
assert!(find_curated_model("gemma-3-27b").is_none());
505550
assert!(find_curated_model("llama-4-maverick").is_none());

0 commit comments

Comments
 (0)