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
9 changes: 7 additions & 2 deletions crates/jcode-provider-core/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ pub fn open_weight_family_context_limit(model: &str) -> Option<usize> {
return Some(204_800);
}

// --- Celeris celeris-1: 8,192 total (prompt + completion) window ---
// --- Celeris celeris-1: 131,072 total (prompt + completion) window ---
if m.contains("celeris") {
return Some(8_192);
return Some(131_072);
}

// --- Xiaomi MiMo V2 family: 256K context ---
Expand Down Expand Up @@ -506,6 +506,11 @@ mod tests {
);
}

#[test]
fn celeris_family_resolves_to_131k_context() {
assert_eq!(open_weight_family_context_limit("celeris-1"), Some(131_072));
}

#[test]
fn context_limit_handles_claude_1m_aliases() {
assert_eq!(
Expand Down
10 changes: 1 addition & 9 deletions crates/jcode-provider-openrouter-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ impl OpenRouterProvider {
}
}

fn configured_max_tokens(profile_id: Option<&str>) -> Option<u32> {
fn configured_max_tokens(_profile_id: Option<&str>) -> Option<u32> {
if let Ok(raw) = std::env::var("JCODE_OPENROUTER_MAX_TOKENS") {
let trimmed = raw.trim();
if trimmed.is_empty() || trimmed.eq_ignore_ascii_case("auto") {
Expand All @@ -1098,14 +1098,6 @@ impl OpenRouterProvider {
}
}

// Celeris rejects `max_tokens` values that are not a positive multiple
// of 256, and requires prompt + max_tokens <= 8,192. Its own default
// (2,048) leaves only ~6K of prompt room, so ask for a smaller
// completion budget to keep more of the context window usable.
if profile_id.is_some_and(|id| id.eq_ignore_ascii_case("celeris")) {
return Some(1_024);
}

None
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ fn openai_compatible_profiles_with_unverified_live_catalogs_have_static_fallback
}

#[test]
fn comtegra_profile_uses_endpoint_default_max_tokens() {
fn profiles_use_endpoint_default_max_tokens() {
let _lock = ENV_LOCK.lock();
let _override = EnvVarGuard::remove("JCODE_OPENROUTER_MAX_TOKENS");

Expand All @@ -818,6 +818,10 @@ fn comtegra_profile_uses_endpoint_default_max_tokens() {
OpenRouterProvider::configured_max_tokens(Some("deepseek")),
None
);
assert_eq!(
OpenRouterProvider::configured_max_tokens(Some("celeris")),
None
);
}

#[test]
Expand Down
Loading