opencode: Support interleaved_reasoning and fix DeepSeek (#55574)
OpenCode API endpoints for DeepSeek were [moved from Anthropic-compatible to OpenAI-compatible](https://github.com/anomalyco/opencode/pull/24500) and DeepSeek requires interleaved reasoning enabled to work. I ran a _"rename this variable to potato"_ test and I can confirm DeepSeek V4 Flash and Pro both work now 🎉 Some other OpenCode Go models were marked [on models.dev](https://github.com/anomalyco/models.dev/tree/dev/providers/opencode-go/models) as supporting `interleaved_reasoning` so they too got that enabled. Kimi K2.5 and Kimi K2.6 continue to fail with https://github.com/zed-industries/zed/issues/51743 (https://github.com/zed-industries/zed/pull/55085 seems to hint at this being [an OpenCode issue](https://github.com/zed-industries/zed/issues/51743#issuecomment-4336785765)?), but all other models seem to work fine both with `interleaved_reasoning` and without it 🤷 I assume it's better to have that turned on? Again, the intersection of OpenAI Chat Completions API, different models, different inference providers, how they all work together is something I know nothing about! Self-Review Checklist: - [X] I've reviewed my own diff for quality, security, and reliability - [X] Unsafe blocks (if any) have justifying comments - [X] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [X] Performance impact has been considered and is acceptable Release Notes: - OpenCode Go: use correct DeepSeek endpoints - OpenCode: add support for interleaved_reasoning
This commit is contained in:
1 parent
8dbf86466a
commit
81e34fe751
4 files changed
+34
-9
No files matched your search
@@ -168,6 +168,7 @@ pub enum Model {
|
||||
protocol: ApiProtocol,
|
||||
reasoning_effort_levels: Option<Vec<ReasoningEffort>>,
|
||||
custom_model_api_url: Option<String>,
|
||||
interleaved_reasoning: bool,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -385,8 +386,6 @@ impl Model {
|
||||
|
||||
Self::Gemini3_1Pro | Self::Gemini3Flash => ApiProtocol::Google,
|
||||
|
||||
Self::DeepSeekV4Pro | Self::DeepSeekV4Flash => ApiProtocol::Anthropic,
|
||||
|
||||
Self::MiniMaxM2_5Free
|
||||
| Self::Glm5
|
||||
| Self::Glm5_1
|
||||
@@ -398,6 +397,8 @@ impl Model {
|
||||
| Self::MimoV2_5
|
||||
| Self::Qwen3_5Plus
|
||||
| Self::Qwen3_6Plus
|
||||
| Self::DeepSeekV4Pro
|
||||
| Self::DeepSeekV4Flash
|
||||
| Self::BigPickle
|
||||
| Self::Nemotron3SuperFree
|
||||
| Self::Ling2_6FlashFree
|
||||
@@ -407,6 +408,27 @@ impl Model {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn interleaved_reasoning(&self) -> bool {
|
||||
match self {
|
||||
Self::DeepSeekV4Pro
|
||||
| Self::DeepSeekV4Flash
|
||||
| Self::KimiK2_5
|
||||
| Self::KimiK2_6
|
||||
| Self::MimoV2Omni
|
||||
| Self::MimoV2_5
|
||||
| Self::MimoV2_5Pro
|
||||
| Self::Glm5
|
||||
| Self::Glm5_1 => true,
|
||||
|
||||
Self::Custom {
|
||||
interleaved_reasoning,
|
||||
..
|
||||
} => *interleaved_reasoning,
|
||||
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn max_token_count(&self) -> u64 {
|
||||
match self {
|
||||
// Anthropic models
|
||||
@@ -487,9 +509,6 @@ impl Model {
|
||||
// Google models
|
||||
Self::Gemini3_1Pro | Self::Gemini3Flash => Some(65_536),
|
||||
|
||||
// Anthropic-compatible models
|
||||
Self::DeepSeekV4Pro | Self::DeepSeekV4Flash => Some(384_000),
|
||||
|
||||
// OpenAI-compatible models
|
||||
Self::MiniMaxM2_7 => Some(131_072),
|
||||
Self::MiniMaxM2_5 | Self::MiniMaxM2_5Free => Some(131_072),
|
||||
@@ -497,6 +516,7 @@ impl Model {
|
||||
Self::BigPickle => Some(128_000),
|
||||
Self::KimiK2_6 | Self::KimiK2_5 => Some(65_536),
|
||||
Self::Qwen3_5Plus | Self::Qwen3_6Plus => Some(65_536),
|
||||
Self::DeepSeekV4Pro | Self::DeepSeekV4Flash => Some(384_000),
|
||||
Self::Nemotron3SuperFree => Some(128_000),
|
||||
Self::MimoV2_5Pro | Self::MimoV2_5 | Self::MimoV2Pro | Self::MimoV2Omni => {
|
||||
Some(128_000)
|
||||
@@ -565,14 +585,13 @@ impl Model {
|
||||
| Self::MiniMaxM2_7
|
||||
| Self::MimoV2Pro
|
||||
| Self::MimoV2_5Pro
|
||||
| Self::DeepSeekV4Pro
|
||||
| Self::DeepSeekV4Flash
|
||||
| Self::BigPickle
|
||||
| Self::Nemotron3SuperFree
|
||||
| Self::Ling2_6FlashFree
|
||||
| Self::Hy3PreviewFree => false,
|
||||
|
||||
// DeepSeek models (Anthropic protocol) don't support images
|
||||
Self::DeepSeekV4Pro | Self::DeepSeekV4Flash => false,
|
||||
|
||||
Self::Custom { protocol, .. } => matches!(
|
||||
protocol,
|
||||
ApiProtocol::Anthropic
|
||||
|
||||
Reference in new issue
Block a user