harness-providers + app: dedicated opencode (Zen) provider
OpenAiProvider gains a custom id and a chat-only mode; `OpenAiProvider::opencode` builds an OpenCode Zen provider (id `opencode`, defaults to Zen's gateway, always chat-completions so even gpt-*/o* model ids route correctly). Registered from a `providers.opencode` config block / OPENCODE_API_KEY env, so it coexists with a real `openai` provider. Models are referenced as `opencode/<model>`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -147,6 +147,19 @@ impl EngineHandle {
|
||||
};
|
||||
providers.register(Arc::new(provider));
|
||||
}
|
||||
// OpenCode Zen: OpenAI-compatible chat gateway under its own `opencode` provider id,
|
||||
// so it coexists with a real `openai` provider. `base_url` defaults to Zen's endpoint.
|
||||
if let Some(key) = config
|
||||
.providers
|
||||
.get("opencode")
|
||||
.and_then(|p| p.api_key.clone())
|
||||
{
|
||||
let base_url = config
|
||||
.providers
|
||||
.get("opencode")
|
||||
.and_then(|p| p.base_url.clone());
|
||||
providers.register(Arc::new(OpenAiProvider::opencode(key, base_url)));
|
||||
}
|
||||
|
||||
Self::build(cwd, store, config, providers)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user