Refactor provider resolution, add Zen provider, and gateway service install#87
Refactor provider resolution, add Zen provider, and gateway service install#87euhenriquecosta wants to merge 4 commits intosipeed:mainfrom
Conversation
|
@Zepan This PR refactors provider resolution and adds a Zen provider. However, PR #213 (Provider Refactor by Protocol — roadmap #283) is a more comprehensive approach to the same problem and is already In Progress on the board. Recommendation: Close in favor of #213. The provider refactor in #213 supersedes this approach. The Zen provider can be added as a follow-up after #213 lands. |
|
@euhenriquecosta take look my comments. |
Closure NoticeThank you for this contribution! However, I'm going to close this PR in favor of #213 (Refactor providers by protocol family). ReasonPR #213 implements a more comprehensive approach to provider refactoring based on Discussion #122 and Issue #283. It:
What happens to the Zen provider?The Zen provider can be added as a follow-up after #213 lands. Since Zen uses an OpenAI-compatible protocol, it would become a simple configuration entry in the new architecture: providers:
openai_compatible:
instances:
zen:
api_base: https://api.zen.ai/v1
api_key: xxxNext Steps
I appreciate the effort put into this PR, especially the registry-based approach and the gateway service install feature. Those ideas may still be valuable for future iterations. cc: @Leeaandrob |
|
Please open another pr just adding the Zen as provider. We are merge the #213 with the focus in to have a standard and package for providers. @euhenriquecosta |
Summary
This PR refactors provider selection to a registry-based flow, integrates the Zen provider, hardens provider resolution rules, and adds an automated
systemdinstaller command for the gateway.Problem
Provider creation was centralized in a large monolithic factory with duplicated condition branches and broad model matching heuristics. This increased change risk for each new provider and could route to the wrong backend in production. Gateway service installation was also fully manual.
Root Cause
Changes
providernow fails fast for unknown/unconfigured provideropencode/auto-prefix routeCreateProvideras a single delegated call to the registry.picoclaw gateway install:systemctl/etc/systemd/system/picoclaw.servicedaemon-reload+enable --nowproviders.zen.User Impact
Validation
go test ./pkg/providersgo test ./.../modelsand/chat/completionswith a-freemodelpicoclaw agent -m ...withprovider=zenandmodel=kimi-k2.5-free