Skip to content

Commit 437268b

Browse files
authored
Merge pull request #55 from rexlunae/feat/opencode-provider
feat: Add OpenCode Zen as a provider
2 parents 94b450f + 5317a31 commit 437268b

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ struct OnboardArgs {
198198
/// OpenRouter API key
199199
#[arg(long, value_name = "KEY", env = "OPENROUTER_API_KEY")]
200200
openrouter_api_key: Option<String>,
201+
/// OpenCode Zen API key
202+
#[arg(long, value_name = "KEY", env = "OPENCODE_API_KEY")]
203+
opencode_api_key: Option<String>,
201204
/// Gemini API key
202205
#[arg(long, value_name = "KEY", env = "GEMINI_API_KEY")]
203206
gemini_api_key: Option<String>,
@@ -1449,6 +1452,7 @@ fn run_import(args: &ImportArgs, config: &mut Config) -> Result<()> {
14491452
("anthropic.key", "Anthropic"),
14501453
("openai.key", "OpenAI"),
14511454
("openrouter.key", "OpenRouter"),
1455+
("opencode.key", "OpenCode Zen"),
14521456
("gemini.key", "Gemini"),
14531457
("xai.key", "xAI"),
14541458
];
@@ -1598,6 +1602,7 @@ fn run_import(args: &ImportArgs, config: &mut Config) -> Result<()> {
15981602
("anthropic.key", "ANTHROPIC_API_KEY"),
15991603
("openai.key", "OPENAI_API_KEY"),
16001604
("openrouter.key", "OPENROUTER_API_KEY"),
1605+
("opencode.key", "OPENCODE_API_KEY"),
16011606
("gemini.key", "GEMINI_API_KEY"),
16021607
("xai.key", "XAI_API_KEY"),
16031608
];

src/providers.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,54 @@ pub const PROVIDERS: &[ProviderDef] = &[
195195
help_url: None,
196196
help_text: Some("No key needed — exo cluster. Default port 52415. Install: github.com/exo-explore/exo"),
197197
},
198+
ProviderDef {
199+
id: "opencode",
200+
display: "OpenCode Zen",
201+
auth_method: AuthMethod::ApiKey,
202+
secret_key: Some("OPENCODE_API_KEY"),
203+
device_flow: None,
204+
// OpenAI-compatible chat/completions endpoint for most models.
205+
// Claude models also work here via OpenCode's OpenAI-compatible layer.
206+
base_url: Some("https://opencode.ai/zen/v1"),
207+
models: &[
208+
// Free models
209+
"big-pickle",
210+
"minimax-m2.5-free",
211+
"kimi-k2.5-free",
212+
// Claude models (via OpenAI-compatible API)
213+
"claude-opus-4-6",
214+
"claude-opus-4-5",
215+
"claude-sonnet-4-5",
216+
"claude-sonnet-4",
217+
"claude-haiku-4-5",
218+
"claude-3-5-haiku",
219+
// GPT models
220+
"gpt-5.2",
221+
"gpt-5.2-codex",
222+
"gpt-5.1",
223+
"gpt-5.1-codex",
224+
"gpt-5.1-codex-max",
225+
"gpt-5.1-codex-mini",
226+
"gpt-5",
227+
"gpt-5-codex",
228+
"gpt-5-nano",
229+
// Gemini models
230+
"gemini-3-pro",
231+
"gemini-3-flash",
232+
// Other models
233+
"minimax-m2.5",
234+
"minimax-m2.1",
235+
"glm-5",
236+
"glm-4.7",
237+
"glm-4.6",
238+
"kimi-k2.5",
239+
"kimi-k2-thinking",
240+
"kimi-k2",
241+
"qwen3-coder",
242+
],
243+
help_url: Some("https://opencode.ai/auth"),
244+
help_text: Some("Get a key at opencode.ai/auth — includes free models (Big Pickle, MiniMax, Kimi)"),
245+
},
198246
ProviderDef {
199247
id: "custom",
200248
display: "Custom / OpenAI-compatible endpoint",

tests/golden/help_gateway.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Commands:
77
stop Stop a running gateway
88
restart Restart the gateway
99
status Show gateway status
10+
reload Reload gateway configuration without restarting
1011
run Run the gateway in the foreground (like `rustyclaw-gateway`)
1112
help Print this message or the help of the given subcommand(s)
1213

0 commit comments

Comments
 (0)