Skip to content

default_provider = "deepseek" with default_model = "deepseek-v4-pro" silently falls back to Claude on startup #448

Description

@wushilong

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions