Add provider field support for explicit provider selection#48
Merged
yinwm merged 1 commit intosipeed:mainfrom Feb 12, 2026
Merged
Add provider field support for explicit provider selection#48yinwm merged 1 commit intosipeed:mainfrom
yinwm merged 1 commit intosipeed:mainfrom
Conversation
- Add Provider field to AgentDefaults struct - Modify CreateProvider to use explicit provider field first, fallback to model name detection - Allows using models without provider prefix (e.g., llama-3.1-8b-instant instead of groq/llama-3.1-8b-instant) - Supports all providers: groq, openai, anthropic, openrouter, zhipu, gemini, vllm - Backward compatible with existing configs Fixes issue where models without provider prefix could not use configured API keys.
|
Great change! Can we take this in? |
Contributor
Author
Yes! It's my first contribution... 🥉 |
Collaborator
|
thanks for the pr |
Contributor
|
Thanks for your contribution! We are forming the PicoClaw Dev Group to accelerate the evolution of the project. Any developer with more than one merged PR is invited to join. Would you like to join the PicoClaw Dev Group? If so, please send an email to |
emadomedher
pushed a commit
to emadomedher/picoclaw
that referenced
this pull request
Feb 17, 2026
…upport Add provider field support for explicit provider selection
This was referenced Feb 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an automated message generated during a code contribution process.
Issue/Demand
When using the
providerfield in the configuration file, the picoclaw agent was unable to use the configured API keys unless the model name included the provider prefix (e.g.,groq/llama-3.1-8b-instant). This prevented users from using clean model names likellama-3.1-8b-instanteven when explicitly setting the provider in the config.Problem Summary
The
agent.defaults.providerfield existed in the JSON configuration schema but was not being used by the code. The provider was only detected from the model name string, which caused issues because the prefix was being sent to the API as part of the model name, resulting in errors like:Solution Implemented
Providerfield toAgentDefaultsstruct inpkg/config/config.goCreateProvider()function inpkg/providers/http_provider.goto:cfg.Agents.Defaults.Providerif explicitly setopenai/gpt,anthropic/claude,google/gemini,zhipu/glmFiles Changed
pkg/config/config.go: AddedProviderfield to struct and default configpkg/providers/http_provider.go: ModifiedCreateProvider()to use explicit provider fieldTesting
✅ Successfully reads API key from
providers.groq.api_keywhenprovider: "groq"is set✅ Correct API base:
https://api.groq.com/openai/v1✅ Model name sent without prefix:
llama-3.1-8b-instant✅ Successfully makes API calls (only error was rate limit, not configuration)
✅ Existing tests continue to pass
Benefits
providerfield from config as originally intended