mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:50:49 +00:00
18 lines
534 B
TypeScript
18 lines
534 B
TypeScript
import { normalizeOptionalString } from "openclaw/plugin-sdk/text-runtime";
|
|
|
|
export function isOpenAIApiBaseUrl(baseUrl?: string): boolean {
|
|
const trimmed = normalizeOptionalString(baseUrl);
|
|
if (!trimmed) {
|
|
return false;
|
|
}
|
|
return /^https?:\/\/api\.openai\.com(?:\/v1)?\/?$/i.test(trimmed);
|
|
}
|
|
|
|
export function isOpenAICodexBaseUrl(baseUrl?: string): boolean {
|
|
const trimmed = normalizeOptionalString(baseUrl);
|
|
if (!trimmed) {
|
|
return false;
|
|
}
|
|
return /^https?:\/\/chatgpt\.com\/backend-api\/?$/i.test(trimmed);
|
|
}
|