fix(provider): map 'free' model to openrouter/auto for OpenRouter free tier#954
fix(provider): map 'free' model to openrouter/auto for OpenRouter free tier#954HRronaldo wants to merge 1 commit intosipeed:mainfrom
Conversation
…e tier When using OpenRouter with model set to 'free', the API returns an error 'free is not a valid model ID' because OpenRouter requires specific model identifiers. This fix maps the 'free' alias to 'openrouter/auto' which automatically selects the best available free model. Closes sipeed#901
|
I think this should be changed in doc land but not in code, please change my mind. |
|
Hi xiaket,感谢review! 理解你的顾虑,但为什么我认为代码修复更好:
或者,如果你接受我的观点的话,我可以添加一个更温和的版本:只映射 你怎么看? |
|
@HRronaldo , in order to make this community accessible to everyone, I would strongly suggest you use English for discussions. Please translate the above into English. |
|
Hi xiaket, thanks for the review! I understand your concern, but here's why I think code fix is better:
Would you be okay with keeping both? I can add a note in the docs about "openrouter/auto" as an alternative, while keeping the code fix for better UX. |
I was looking at OpenRouter earlier and I cannot find anything that would suggest this usage. I would say the GH issue raised earlier is more of a mis-understanding, not a real issue on picoclaw. Adding this shortcut may seem fine for now, but longer term it would bring ambiguity to the project, for example, other models may be asking the same shortcut. As you can understand, shortcut is always unofficial and would increase maintenance overhead. |
|
Hi xiaket, I understand your perspective now. You're right that:
I'll close this PR and instead add a documentation note explaining that users should use Thanks for the thoughtful review - it helps keep the codebase clean and maintainable. |
Summary
model: "free"with OpenRouter providerDescription
When using OpenRouter with
model: "free", the API was returning an error:This fix adds model alias mapping in
pkg/providers/factory.go- when the model is set to "free", it's automatically converted to "openrouter/auto" which is the correct identifier for OpenRouter's free tier.Changes made in two locations:
openrouterprovider case (lines 95-108)Type of Change
🤖 AI Code Generation
Related Issue
Closes #901
Technical Context
Test Environment
go test -run TestResolveProviderSelection ./pkg/providers/