Commit ce8a33d
committed
fix(api): autoDetectProvider prioritizes openrouter over openai
AUTO_DETECT_ORDER listed openai before openrouter, but both the
function's documented priority comment and the provider-defaults.test
assertion "prefers openrouter over openai when both are set" pin the
opposite order. The probe array had drifted from the stated design,
so any call site that auto-detected a provider with both keys present
silently picked openai and never went through the OpenRouter
aggregator the user configured.
Fix: move the OPENROUTER_API_KEY probe to the head of the array.
Matches the // Priority: openrouter → openai → anthropic → … comment
directly above the function definition. Aligns with user intent —
keys for an aggregator plus a direct provider usually mean "route
through the aggregator for failover / cost / pooling".
Also fixes one of two pre-existing CI failures on the AgentOS test
suite. 19/19 provider-defaults tests now pass. Second pre-existing
failure (generateImage Replicate body.version resolution) left to a
dedicated session — deeper trace through the image-provider chain.1 parent cf6f081 commit ce8a33d
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
119 | 126 | | |
120 | 127 | | |
121 | | - | |
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| |||
0 commit comments