fix: resolve base URL in createLanguageModel for API gateway support#565
Conversation
createLanguageModel() resolved API keys from env vars but not base URLs. This caused dedup LLM calls to bypass API gateways (GOOGLE_API_URL, etc.) and hit provider endpoints directly, failing with "API key not valid" when using gateway-issued keys. Add resolveBaseUrl() mirroring the env-var resolution already used by ProbeAgent and FallbackManager, and pass it to createProviderInstance(). Fixes #564 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR OverviewSummaryThis PR fixes a critical bug where Problem StatementWhen Technical ChangesFile Modified:
Architecture & ImpactComponent Flow: Affected Systems:
Before/After Behavior:
Scope & ContextDirect Impact:
Related Components (inferred from codebase structure):
Testing Considerations:
References
Metadata
Powered by Visor from Probelabs Last updated: 2026-05-21T13:32:54.473Z | Triggered by: pr_opened | Commit: 5fef1e0 💡 TIP: You can chat with Visor using |
Security Issues (3)
✅ Performance Check PassedNo performance issues found – changes LGTM. Quality Issues (4)
Powered by Visor from Probelabs Last updated: 2026-05-21T13:28:13.568Z | Triggered by: pr_opened | Commit: 5fef1e0 💡 TIP: You can chat with Visor using |
Summary
createLanguageModel()innpm/src/utils/provider.jsresolved API keys but not base URLs from env varsresolveBaseUrl()mirroring the env-var pattern already used byProbeAgentandFallbackManagerProblem
When
GOOGLE_API_URLpoints to an API gateway andGOOGLE_API_KEYis a gateway-issued key (not a raw Google key), the main AI calls work fine (they passbaseURL), but dedup calls fail becausecreateLanguageModel()only passedapiKeywithoutbaseURL. Every dedup failure silently falls back toallow, letting all redundant searches through — causing tasks to run 5-6x longer than necessary.Test plan
GOOGLE_API_URLwhen setGOOGLE_API_URLis not set (hits provider default)LLM_BASE_URLfallback works for all providersFixes #564
🤖 Generated with Claude Code