fix(provider): map 'free' model to openrouter/auto for OpenRouter free 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 #901
This commit is contained in:
parent
f7136b6a5d
commit
352f4005f2
1 changed files with 8 additions and 0 deletions
|
|
@ -101,6 +101,10 @@ func resolveProviderSelection(cfg *config.Config) (providerSelection, error) {
|
|||
} else {
|
||||
sel.apiBase = "https://openrouter.ai/api/v1"
|
||||
}
|
||||
// Map "free" model alias to openrouter/auto for free tier access
|
||||
if model == "free" {
|
||||
sel.model = "openrouter/auto"
|
||||
}
|
||||
}
|
||||
case "zhipu", "glm":
|
||||
if cfg.Providers.Zhipu.APIKey != "" {
|
||||
|
|
@ -304,6 +308,10 @@ func resolveProviderSelection(cfg *config.Config) (providerSelection, error) {
|
|||
} else {
|
||||
sel.apiBase = "https://openrouter.ai/api/v1"
|
||||
}
|
||||
// Map "free" model alias to openrouter/auto for free tier access
|
||||
if model == "free" {
|
||||
sel.model = "openrouter/auto"
|
||||
}
|
||||
} else {
|
||||
return providerSelection{}, fmt.Errorf("no API key configured for model: %s", model)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue