Skip to content
Merged
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
36 changes: 20 additions & 16 deletions crates/opencode/src/opencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ pub enum Model {
Gemini3_1Pro,
#[serde(rename = "gemini-3-flash")]
Gemini3Flash,
#[serde(rename = "gemini-3.5-flash")]
Gemini3_5Flash,

// -- OpenAI Chat Completions protocol models --
#[serde(rename = "deepseek-v4-pro")]
Expand All @@ -123,12 +125,12 @@ pub enum Model {
DeepSeekV4Flash,
#[serde(rename = "minimax-m2.5")]
MiniMaxM2_5,
#[serde(rename = "minimax-m2.5-free")]
MiniMaxM2_5Free,
#[serde(rename = "glm-5")]
Glm5,
#[serde(rename = "glm-5.1")]
Glm5_1,
#[serde(rename = "grok-build-0.1")]
GrokBuild0_1,
#[serde(rename = "kimi-k2.5")]
KimiK2_5,
#[serde(rename = "kimi-k2.6")]
Expand Down Expand Up @@ -180,7 +182,7 @@ impl Model {
}

pub fn default_free_fast() -> Self {
Self::MiniMaxM2_5Free
Self::Nemotron3SuperFree
}

pub fn available_subscriptions(&self) -> &'static [OpenCodeSubscription] {
Expand All @@ -202,9 +204,7 @@ impl Model {
| Self::DeepSeekV4Flash => &[OpenCodeSubscription::Go],

// Free models
Self::MiniMaxM2_5Free | Self::Nemotron3SuperFree | Self::BigPickle => {
&[OpenCodeSubscription::Free]
}
Self::Nemotron3SuperFree | Self::BigPickle => &[OpenCodeSubscription::Free],

// Custom models get their subscription from settings, not from here
Self::Custom { .. } => &[],
Expand Down Expand Up @@ -245,13 +245,14 @@ impl Model {

Self::Gemini3_1Pro => "gemini-3.1-pro",
Self::Gemini3Flash => "gemini-3-flash",
Self::Gemini3_5Flash => "gemini-3.5-flash",

Self::DeepSeekV4Pro => "deepseek-v4-pro",
Self::DeepSeekV4Flash => "deepseek-v4-flash",
Self::MiniMaxM2_5 => "minimax-m2.5",
Self::MiniMaxM2_5Free => "minimax-m2.5-free",
Self::Glm5 => "glm-5",
Self::Glm5_1 => "glm-5.1",
Self::GrokBuild0_1 => "grok-build-0.1",
Self::KimiK2_5 => "kimi-k2.5",
Self::KimiK2_6 => "kimi-k2.6",
Self::MiniMaxM2_7 => "minimax-m2.7",
Expand Down Expand Up @@ -297,13 +298,14 @@ impl Model {

Self::Gemini3_1Pro => "Gemini 3.1 Pro",
Self::Gemini3Flash => "Gemini 3 Flash",
Self::Gemini3_5Flash => "Gemini 3.5 Flash",

Self::DeepSeekV4Pro => "DeepSeek V4 Pro",
Self::DeepSeekV4Flash => "DeepSeek V4 Flash",
Self::MiniMaxM2_5 => "MiniMax M2.5",
Self::MiniMaxM2_5Free => "MiniMax M2.5 Free",
Self::Glm5 => "GLM 5",
Self::Glm5_1 => "GLM 5.1",
Self::GrokBuild0_1 => "Grok Build 0.1",
Self::KimiK2_5 => "Kimi K2.5",
Self::KimiK2_6 => "Kimi K2.6",
Self::MiniMaxM2_7 => "MiniMax M2.7",
Expand Down Expand Up @@ -359,11 +361,11 @@ impl Model {
| Self::Gpt5Codex
| Self::Gpt5Nano => ApiProtocol::OpenAiResponses,

Self::Gemini3_1Pro | Self::Gemini3Flash => ApiProtocol::Google,
Self::Gemini3_1Pro | Self::Gemini3Flash | Self::Gemini3_5Flash => ApiProtocol::Google,

Self::MiniMaxM2_5Free
| Self::Glm5
Self::Glm5
| Self::Glm5_1
| Self::GrokBuild0_1
| Self::KimiK2_5
| Self::KimiK2_6
| Self::MimoV2_5Pro
Expand Down Expand Up @@ -426,10 +428,11 @@ impl Model {
// Google models
Self::Gemini3_1Pro => 1_048_576,
Self::Gemini3Flash => 1_048_576,
Self::Gemini3_5Flash => 1_048_576,

// OpenAI-compatible models
Self::MiniMaxM2_7 => 204_800,
Self::MiniMaxM2_5 | Self::MiniMaxM2_5Free => 204_800,
Self::MiniMaxM2_5 => 204_800,
Self::Glm5 | Self::Glm5_1 => {
if subscription == OpenCodeSubscription::Go {
202_752
Expand All @@ -438,6 +441,7 @@ impl Model {
}
}
Self::KimiK2_6 | Self::KimiK2_5 => 262_144,
Self::GrokBuild0_1 => 256_000,
Self::MimoV2_5Pro => 1_048_576,
Self::MimoV2_5 => 1_000_000,
Self::Qwen3_5Plus | Self::Qwen3_6Plus => 262_144,
Expand Down Expand Up @@ -480,11 +484,10 @@ impl Model {
| Self::Gpt5Nano => Some(128_000),

// Google models
Self::Gemini3_1Pro | Self::Gemini3Flash => Some(65_536),
Self::Gemini3_1Pro | Self::Gemini3Flash | Self::Gemini3_5Flash => Some(65_536),

// OpenAI-compatible models
Self::MiniMaxM2_7 => Some(131_072),
Self::MiniMaxM2_5Free => Some(131_072),
Self::MiniMaxM2_5 => {
if subscription == OpenCodeSubscription::Go {
Some(65_536)
Expand All @@ -501,6 +504,7 @@ impl Model {
}
Self::BigPickle => Some(128_000),
Self::KimiK2_6 | Self::KimiK2_5 => Some(65_536),
Self::GrokBuild0_1 => Some(256_000),
Self::Qwen3_5Plus | Self::Qwen3_6Plus => Some(65_536),
Self::DeepSeekV4Pro | Self::DeepSeekV4Flash => Some(384_000),
Self::Nemotron3SuperFree => Some(128_000),
Expand Down Expand Up @@ -550,18 +554,18 @@ impl Model {
Self::Gpt5_3Spark => false,

// Google models support images
Self::Gemini3_1Pro | Self::Gemini3Flash => true,
Self::Gemini3_1Pro | Self::Gemini3Flash | Self::Gemini3_5Flash => true,

// OpenAI-compatible models with image support
Self::KimiK2_6
| Self::KimiK2_5
| Self::GrokBuild0_1
| Self::MimoV2_5
| Self::Qwen3_5Plus
| Self::Qwen3_6Plus => true,

// OpenAI-compatible models without image support
Self::MiniMaxM2_5
| Self::MiniMaxM2_5Free
| Self::Glm5
| Self::Glm5_1
| Self::MiniMaxM2_7
Expand Down
Loading