When the config has:
[provider]
default_model = "deepseek-v4-pro"
default_provider = "deepseek"
And DEEPSEEK_API_KEY is set (but no OPENROUTER_API_KEY), jcode silently ignores the DeepSeek default and starts with claude-sonnet-4 instead.
Root Cause:
In crates/jcode-base/src/provider/mod.rs, set_config_default_model (line 1301) resolves the config provider selection to OpenAiCompatibleProfile("deepseek"), whose active_provider() is ActiveProvider::OpenRouter. It then calls set_model_on_provider_with_credential_modes(OpenRouter, ...) which triggers the generic OpenRouter rebind logic (line 1006-1026). This logic decides the current DeepSeek profile runtime needs to be replaced with a plain OpenRouter API-key runtime — and fails because OPENROUTER_API_KEY is not set. The error is silently caught, so the active provider stays as the auto-detected default (Claude).
Fix location: crates/jcode-base/src/provider/mod.rs:1330-1378
When ConfigProviderSelection::OpenAiCompatibleProfile(profile_id), the code should short-circuit to set_model_on_openai_compatible_profile(profile, model) instead of going through the generic set_model_on_provider_with_credential_modes(ActiveProvider::OpenRouter, ...) path.
• resolve_config_provider_selection (in selection.rs:441) determines the selection
• ConfigProviderSelection::active_provider() (in selection.rs:13) maps all OpenAiCompatibleProfile to ActiveProvider::OpenRouter
• set_model_on_provider_with_credential_modes (line 885) for OpenRouter has complex rebind logic at lines 1006-1026 that tries to replace profile runtimes
Release Information: v0.36.0 (commit e18e983) – released July 5, 2026
When the config has:
And
DEEPSEEK_API_KEYis set (but noOPENROUTER_API_KEY), jcode silently ignores the DeepSeek default and starts withclaude-sonnet-4instead.Root Cause:
In
crates/jcode-base/src/provider/mod.rs,set_config_default_model(line 1301) resolves the config provider selection toOpenAiCompatibleProfile("deepseek"), whoseactive_provider()isActiveProvider::OpenRouter. It then callsset_model_on_provider_with_credential_modes(OpenRouter, ...)which triggers the generic OpenRouter rebind logic (line 1006-1026). This logic decides the current DeepSeek profile runtime needs to be replaced with a plain OpenRouter API-key runtime — and fails because OPENROUTER_API_KEY is not set. The error is silently caught, so the active provider stays as the auto-detected default (Claude).Fix location:
crates/jcode-base/src/provider/mod.rs:1330-1378When
ConfigProviderSelection::OpenAiCompatibleProfile(profile_id), the code should short-circuit toset_model_on_openai_compatible_profile(profile, model)instead of going through the genericset_model_on_provider_with_credential_modes(ActiveProvider::OpenRouter, ...)path.•
resolve_config_provider_selection(inselection.rs:441) determines the selection•
ConfigProviderSelection::active_provider()(inselection.rs:13) maps allOpenAiCompatibleProfiletoActiveProvider::OpenRouter•
set_model_on_provider_with_credential_modes(line 885) for OpenRouter has complex rebind logic at lines 1006-1026 that tries to replace profile runtimesRelease Information: v0.36.0 (commit e18e983) – released July 5, 2026