mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 21:03:19 +00:00
fix(ai): respect codex baseUrl (closes #1244)
This commit is contained in:
parent
b23e6ea21e
commit
150aeebf7d
1 changed files with 10 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ import { buildBaseOptions, clampReasoning } from "./simple-options.js";
|
|||
// Configuration
|
||||
// ============================================================================
|
||||
|
||||
const CODEX_URL = "https://chatgpt.com/backend-api/codex/responses";
|
||||
const DEFAULT_CODEX_BASE_URL = "https://chatgpt.com/backend-api";
|
||||
const JWT_CLAIM_PATH = "https://api.openai.com/auth" as const;
|
||||
const MAX_RETRIES = 3;
|
||||
const BASE_DELAY_MS = 1000;
|
||||
|
|
@ -147,7 +147,7 @@ export const streamOpenAICodexResponses: StreamFunction<"openai-codex-responses"
|
|||
}
|
||||
|
||||
try {
|
||||
response = await fetch(CODEX_URL, {
|
||||
response = await fetch(resolveCodexUrl(model.baseUrl), {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: bodyJson,
|
||||
|
|
@ -288,6 +288,14 @@ function clampReasoningEffort(modelId: string, effort: string): string {
|
|||
return effort;
|
||||
}
|
||||
|
||||
function resolveCodexUrl(baseUrl?: string): string {
|
||||
const raw = baseUrl && baseUrl.trim().length > 0 ? baseUrl : DEFAULT_CODEX_BASE_URL;
|
||||
const normalized = raw.replace(/\/+$/, "");
|
||||
if (normalized.endsWith("/codex/responses")) return normalized;
|
||||
if (normalized.endsWith("/codex")) return `${normalized}/responses`;
|
||||
return `${normalized}/codex/responses`;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Response Processing
|
||||
// ============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue