mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-27 01:09:32 +00:00
Repairs a batch of narrow model/provider edge cases:
- honor OpenAI and Anthropic base URL environment overrides when provider config does not set an explicit base URL
- preserve OpenRouter Anthropic cache retention while stripping unsupported transport options
- allow apply_patch for non-OpenAI providers when the tool config otherwise permits it
- prune stale same-provider model selections from configure/model picker state
- expose GitHub Copilot bundled thinking policy metadata to offline/provider-policy lookups
- repair additive SQLite shared-state upgrades for existing databases
- keep same-size rotated log readers from reusing stale content in CI tooling
Proof:
- GitHub PR checks green on exact head 46514909b0
- Crabbox delegated Blacksmith Testbox tbx_01kt3em5r9vd7g0bnykrff6jdk exited 0
- Focused local Vitest/oxlint/format proof recorded in PR body and land-ready comment
Fixes #80347.
Fixes #88357.
Fixes #45269.
Supersedes #74427, #74432, #79370, #79894, #80366, and #88359.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
|
|
export const OPENAI_CODEX_RESPONSES_BASE_URL = "https://chatgpt.com/backend-api/codex";
|
|
export const OPENAI_API_BASE_URL = "https://api.openai.com/v1";
|
|
|
|
export function resolveOpenAIDefaultBaseUrl(
|
|
env: Record<string, string | undefined> = process.env,
|
|
): string {
|
|
return normalizeOptionalString(env.OPENAI_BASE_URL) ?? OPENAI_API_BASE_URL;
|
|
}
|
|
|
|
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(?:\/codex)?(?:\/v1)?\/?$/i.test(trimmed);
|
|
}
|
|
|
|
export function canonicalizeCodexResponsesBaseUrl(baseUrl?: string): string | undefined {
|
|
return isOpenAICodexBaseUrl(baseUrl) ? OPENAI_CODEX_RESPONSES_BASE_URL : baseUrl;
|
|
}
|