mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 00:50:27 +00:00
fix(providers): preserve openrouter/ prefix for native models (#12942)
* fix(providers): preserve openrouter/ prefix for native models (#12924) OpenRouter-native models like 'openrouter/aurora-alpha' need the full 'openrouter/<name>' as the model ID in API requests. The existing parseModelRef() stripped the prefix, sending just 'aurora-alpha' which OpenRouter rejects with 400. Fix: normalizeProviderModelId() now re-adds the 'openrouter/' prefix for models without a slash (native models), while passing through external provider models (e.g. 'anthropic/claude-sonnet-4-5') as-is. Closes #12924 * Changelog: add OpenRouter note for #12942 --------- Co-authored-by: Luna AI <luna@coredirection.ai> Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
@@ -111,6 +111,13 @@ function normalizeProviderModelId(provider: string, model: string): string {
|
||||
if (provider === "google") {
|
||||
return normalizeGoogleModelId(model);
|
||||
}
|
||||
// OpenRouter-native models (e.g. "openrouter/aurora-alpha") need the full
|
||||
// "openrouter/<name>" as the model ID sent to the API. Models from external
|
||||
// providers already contain a slash (e.g. "anthropic/claude-sonnet-4-5") and
|
||||
// are passed through as-is (#12924).
|
||||
if (provider === "openrouter" && !model.includes("/")) {
|
||||
return `openrouter/${model}`;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user