fix: ensure api field is set for inline provider models
When a model is found in the inline provider config (models.providers.*.models), the api field was not being set, causing "Unhandled API in mapOptionsForApi: undefined" errors when using custom OpenAI-compatible providers like Ollama or LM Studio. This fix ensures the api field is inherited from: 1. The model config itself (if specified) 2. The provider config's api field 3. Falls back to "openai-responses" (consistent with the fallback model behavior) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1a947a21d6
commit
f6bfcfa5c6
@ -58,7 +58,13 @@ export function resolveModel(
|
|||||||
(entry) => normalizeProviderId(entry.provider) === normalizedProvider && entry.id === modelId,
|
(entry) => normalizeProviderId(entry.provider) === normalizedProvider && entry.id === modelId,
|
||||||
);
|
);
|
||||||
if (inlineMatch) {
|
if (inlineMatch) {
|
||||||
const normalized = normalizeModelCompat(inlineMatch as Model<Api>);
|
// Ensure the api field is set from the provider config if not specified in the model
|
||||||
|
const providerCfg = providers[inlineMatch.provider];
|
||||||
|
const modelWithApi = {
|
||||||
|
...inlineMatch,
|
||||||
|
api: inlineMatch.api ?? providerCfg?.api ?? "openai-responses",
|
||||||
|
} as Model<Api>;
|
||||||
|
const normalized = normalizeModelCompat(modelWithApi);
|
||||||
return {
|
return {
|
||||||
model: normalized,
|
model: normalized,
|
||||||
authStorage,
|
authStorage,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user