( baseUrl?: string, path = "chat/completions", fallbackBaseUrl = "https://api.openai.com", exactRequestUrl = false, )
| 339 | } |
| 340 | |
| 341 | export function buildOpenAICompatibleUrl( |
| 342 | baseUrl?: string, |
| 343 | path = "chat/completions", |
| 344 | fallbackBaseUrl = "https://api.openai.com", |
| 345 | exactRequestUrl = false, |
| 346 | ): string { |
| 347 | const resolvedBaseUrl = resolveProviderBaseUrl( |
| 348 | "custom", |
| 349 | baseUrl || fallbackBaseUrl, |
| 350 | exactRequestUrl, |
| 351 | ); |
| 352 | if (!resolvedBaseUrl) return ""; |
| 353 | if (exactRequestUrl) return resolvedBaseUrl; |
| 354 | return `${resolvedBaseUrl}/${path.replace(/^\/+/, "")}`; |
| 355 | } |
| 356 | |
| 357 | export function getProviderConfig(providerId: string): ProviderConfig { |
| 358 | return PROVIDER_CONFIGS[providerId] || PROVIDER_CONFIGS.custom; |
no test coverage detected