mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
feat(sse): restore GPT-6 Astra effort aliases and Codex 0.153.4 pin (#13026)
Three related things that genuinely belong together: the registry and suffix splitter not knowing Astra while the live catalog serves it, the Codex client pin Astra requires, and dropping `next/font/google` so a production image build does not reach fonts.googleapis.com. --- Validated in one consolidated worktree cut from `release/v3.8.51`, boarded with the other 19 PRs of this batch. Two in-batch conflicts, both additive and resolved by keeping each side: the `ENVIRONMENT.md` table (#13035 + #13011) and the `chatHelpers.ts` import block (#12975 on the tip + #13017). - `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK; `check:docs-counts` migrations ✓ - complexity 2816 / baseline 3218 and cognitive-complexity 1271 / baseline 1437 — both under baseline - 531 of 532 focused assertions green across the batch's 46 test files - `check-file-size` rebaselined for the batch's real growth (annotation `_rebaseline_2026_09_11_mergebatch_v3851_houminxi`, landed on #13038), attributed per PR The single red is **not this batch**: `tests/unit/combo/quota-weighted-strategy.test.ts` → "A/B isolation: 7 hard-empty + 2 at 0.5% + 1 at 40%, floor=1" asserts an order between two connections of identical weight and flakes on the pure tip too — 2 failures in 4 runs at `origin/release/v3.8.51` with nothing from this batch applied. ⚠️ base-red inherited: #12732 — `Docs Gates`, `Merge integrity`, `No new ESLint warnings`, `Unit Tests fast-path` and `Fast Quality Gates` reproduce on the pure tip (provider count 356 vs the 358 the modules define, SKILL.md drift, and `open-sse/utils/stream.ts` at 3115 > frozen 3098, untouched here). Thanks @HouMinXi — the live evidence on these (X500 logs, `storage.sqlite` state, real `/v1/models` probes, the 36-minute outage write-up) is what let a 20-PR batch be reviewed as a unit.
This commit is contained in:
@@ -1311,7 +1311,8 @@ CLAUDE_USER_AGENT="claude-cli/2.1.258 (external, cli)"
|
||||
# stream with a misleading 400 out-of-extra-usage placeholder. Set to true to
|
||||
# forward the original names verbatim (debugging only).
|
||||
# CLAUDE_DISABLE_TOOL_NAME_CLOAK=false
|
||||
CODEX_USER_AGENT="codex-cli/0.144.1 (Windows 10.0.26200; x64)"
|
||||
# Optional override; leave unset to follow the shared Codex client version.
|
||||
# CODEX_USER_AGENT="codex-cli/0.153.4 (Windows 10.0.26200; x64)"
|
||||
GITHUB_USER_AGENT="GitHubCopilotChat/0.54.0"
|
||||
ANTIGRAVITY_USER_AGENT="antigravity/2.0.1 linux/arm64 google-api-nodejs-client/10.3.0"
|
||||
KIRO_USER_AGENT="AWS-SDK-JS/3.0.0 kiro-ide/1.0.0"
|
||||
@@ -1331,7 +1332,7 @@ CURSOR_USER_AGENT="Cursor/3.4"
|
||||
|
||||
# Override Codex client version sent in headers independently of the
|
||||
# CODEX_USER_AGENT string. Used by: open-sse/config/codexClient.ts.
|
||||
# CODEX_CLIENT_VERSION=0.144.1
|
||||
# CODEX_CLIENT_VERSION=0.153.4
|
||||
#
|
||||
# Override the advertised Claude Code client version independently of
|
||||
# CLAUDE_USER_AGENT. Anthropic gates some models (Fable 5.1) on this
|
||||
|
||||
@@ -340,7 +340,7 @@ RUN --mount=type=cache,id=s/92ca8a61-c1ba-421f-a389-d48ac7258c2d-apt-cache,targe
|
||||
# build, not the floating `@latest`.
|
||||
RUN --mount=type=cache,id=s/92ca8a61-c1ba-421f-a389-d48ac7258c2d-npm-cache,target=/root/.npm \
|
||||
npm install -g --no-audit --no-fund \
|
||||
@openai/codex@0.153.2 \
|
||||
@openai/codex@0.153.4 \
|
||||
@anthropic-ai/claude-code@2.1.260 \
|
||||
droid@0.212.0 \
|
||||
openclaw@2026.9.1
|
||||
|
||||
1
changelog.d/features/codex-gpt-6-astra.md
Normal file
1
changelog.d/features/codex-gpt-6-astra.md
Normal file
@@ -0,0 +1 @@
|
||||
- **feat(sse):** Codex and OpenAI catalogs list GPT-6 Astra with effort aliases (`-low` through `-ultra`); Codex CLI identity pins `@openai/codex@0.153.4` in lockstep with the image ([#13026](https://github.com/diegosouzapw/OmniRoute/pull/13026))
|
||||
1
changelog.d/maintenance/layout-no-google-fonts.md
Normal file
1
changelog.d/maintenance/layout-no-google-fonts.md
Normal file
@@ -0,0 +1 @@
|
||||
- **build:** root layout no longer loads Inter from `next/font/google`, so a production image build does not need fonts.googleapis.com ([#13026](https://github.com/diegosouzapw/OmniRoute/pull/13026))
|
||||
@@ -1,14 +1,14 @@
|
||||
---
|
||||
title: "Provider Reference"
|
||||
version: 3.8.51
|
||||
lastUpdated: 2026-09-03
|
||||
lastUpdated: 2026-09-05
|
||||
---
|
||||
|
||||
# Provider Reference
|
||||
|
||||
> **Auto-generated** from `src/shared/constants/providers.ts` — do not edit by hand.
|
||||
> Regenerate with: `npm run gen:provider-reference`
|
||||
> **Last generated:** 2026-09-03
|
||||
> **Last generated:** 2026-09-05
|
||||
|
||||
Total providers: **356**. See category breakdown below.
|
||||
|
||||
|
||||
@@ -28,6 +28,25 @@ export const codexProvider: RegistryEntry = {
|
||||
tokenUrl: "https://auth.openai.com/oauth/token",
|
||||
},
|
||||
models: [
|
||||
// Astra shares GPT-5.6's Codex limits: the live OAuth catalog reports
|
||||
// max_context_window=872000 (context_window=272000 is the pricing tier).
|
||||
{ id: "gpt-6-astra", name: "GPT 6 Astra", ...GPT_5_6_CODEX_CAPABILITIES },
|
||||
{ id: "gpt-6-astra-ultra", name: "GPT 6 Astra (Ultra)", ...GPT_5_6_CODEX_CAPABILITIES },
|
||||
{ id: "gpt-6-astra-max", name: "GPT 6 Astra (Max)", ...GPT_5_6_CODEX_CAPABILITIES },
|
||||
{
|
||||
id: "gpt-6-astra-xhigh",
|
||||
name: "GPT 6 Astra (xHigh)",
|
||||
...GPT_5_6_CODEX_CAPABILITIES,
|
||||
timeoutMs: 1200000,
|
||||
},
|
||||
{
|
||||
id: "gpt-6-astra-high",
|
||||
name: "GPT 6 Astra (High)",
|
||||
...GPT_5_6_CODEX_CAPABILITIES,
|
||||
timeoutMs: 1200000,
|
||||
},
|
||||
{ id: "gpt-6-astra-medium", name: "GPT 6 Astra (Medium)", ...GPT_5_6_CODEX_CAPABILITIES },
|
||||
{ id: "gpt-6-astra-low", name: "GPT 6 Astra (Low)", ...GPT_5_6_CODEX_CAPABILITIES },
|
||||
{
|
||||
id: "gpt-5.6-sol",
|
||||
name: "GPT 5.6 Sol",
|
||||
|
||||
@@ -12,6 +12,15 @@ export const openaiProvider: RegistryEntry = {
|
||||
authHeader: "bearer",
|
||||
defaultContextLength: 128000,
|
||||
models: [
|
||||
// Astra shares the public GPT-5.6 limits; tool calling requires Responses.
|
||||
// https://developers.openai.com/api/docs/guides/latest-model
|
||||
{
|
||||
id: "gpt-6-astra",
|
||||
name: "GPT-6 Astra",
|
||||
...GPT_5_6_API_CAPABILITIES,
|
||||
supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
|
||||
unsupportedParams: ["temperature", "top_p", "top_logprobs", "logprobs"],
|
||||
},
|
||||
// #11489: per OpenAI's model reference `gpt-5.6` is an ALIAS of `gpt-5.6-sol`,
|
||||
// not a distinct model — quality scores point forward, which no suffix
|
||||
// stripper can express. Siblings `-terra`/`-luna` are their own models.
|
||||
|
||||
@@ -54,7 +54,7 @@ export {
|
||||
import { isCodexFreePlan, normalizeCodexTools } from "./codex/tools.ts";
|
||||
import {
|
||||
CODEX_EFFORT_ORDER as EFFORT_ORDER,
|
||||
GPT_5_6_ULTRA_ALIAS_MODELS,
|
||||
CODEX_ULTRA_ALIAS_MODELS,
|
||||
splitCodexReasoningSuffix,
|
||||
type CodexEffortLevel as EffortLevel,
|
||||
} from "./codex/reasoningSuffix.ts";
|
||||
@@ -167,13 +167,13 @@ function isCodexResponsesLiteRequest(
|
||||
);
|
||||
}
|
||||
|
||||
// GPT-5.6 ultra-tier (sol/terra at "ultra") and luna at "max" coordinate delegation to
|
||||
// Astra/Sol/Terra at "ultra" and Luna at "max" coordinate delegation to
|
||||
// sub-agents via parallel tool calls (see the effort-clamp comment near clampEffort()).
|
||||
// Responses Lite must not strip parallel_tool_calls for those model/effort combos, or
|
||||
// delegation silently breaks while the request still returns HTTP 200 (issue #7821).
|
||||
function isCodexDelegationDependentModel(model: unknown): boolean {
|
||||
const { baseModel, effort } = splitCodexReasoningSuffix(model);
|
||||
if (effort === "ultra" && GPT_5_6_ULTRA_ALIAS_MODELS.has(baseModel)) return true;
|
||||
if (effort === "ultra" && CODEX_ULTRA_ALIAS_MODELS.has(baseModel)) return true;
|
||||
if (effort === "max" && baseModel === "gpt-5.6-luna") return true;
|
||||
return false;
|
||||
}
|
||||
@@ -324,12 +324,9 @@ function normalizeServiceTierValue(value: unknown): string | undefined {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Maximum reasoning effort allowed per Codex model.
|
||||
* Models not listed here retain the legacy xhigh cap.
|
||||
* Update this table when Codex releases new models with different caps.
|
||||
*/
|
||||
/** Maximum reasoning effort per Codex model; unlisted models keep the xhigh cap. */
|
||||
const MAX_EFFORT_BY_MODEL: Record<string, EffortLevel> = {
|
||||
"gpt-6-astra": "ultra",
|
||||
"gpt-5.6-sol": "ultra",
|
||||
"gpt-5.6-terra": "ultra",
|
||||
"gpt-5.6-luna": "max",
|
||||
|
||||
@@ -8,25 +8,28 @@ export const CODEX_EFFORT_ORDER = [
|
||||
"ultra",
|
||||
] as const;
|
||||
export type CodexEffortLevel = (typeof CODEX_EFFORT_ORDER)[number];
|
||||
export const GPT_5_6_MAX_ALIAS_MODELS = new Set(["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"]);
|
||||
export const GPT_5_6_ULTRA_ALIAS_MODELS = new Set(["gpt-5.6-sol", "gpt-5.6-terra"]);
|
||||
export const CODEX_MAX_ALIAS_MODELS = new Set([
|
||||
"gpt-5.6-sol",
|
||||
"gpt-5.6-terra",
|
||||
"gpt-5.6-luna",
|
||||
"gpt-6-astra",
|
||||
]);
|
||||
export const CODEX_ULTRA_ALIAS_MODELS = new Set(["gpt-5.6-sol", "gpt-5.6-terra", "gpt-6-astra"]);
|
||||
|
||||
export function splitCodexReasoningSuffix(model: unknown): {
|
||||
baseModel: string;
|
||||
effort: CodexEffortLevel | null;
|
||||
} {
|
||||
const modelId = typeof model === "string" ? model : "";
|
||||
const gpt56Match = /^(gpt-5\.6-(?:sol|terra|luna))(?:-(max|ultra)|\((max|ultra)\))$/.exec(
|
||||
modelId
|
||||
);
|
||||
if (gpt56Match) {
|
||||
const [, baseModel, hyphenEffort, parenthesizedEffort] = gpt56Match;
|
||||
const maxTierMatch = /^(.+?)(?:-(max|ultra)|\((max|ultra)\))$/.exec(modelId);
|
||||
if (maxTierMatch) {
|
||||
const [, baseModel, hyphenEffort, parenthesizedEffort] = maxTierMatch;
|
||||
const effort = hyphenEffort ?? parenthesizedEffort;
|
||||
const supportedModels = parenthesizedEffort
|
||||
? GPT_5_6_MAX_ALIAS_MODELS
|
||||
? CODEX_MAX_ALIAS_MODELS
|
||||
: effort === "ultra"
|
||||
? GPT_5_6_ULTRA_ALIAS_MODELS
|
||||
: GPT_5_6_MAX_ALIAS_MODELS;
|
||||
? CODEX_ULTRA_ALIAS_MODELS
|
||||
: CODEX_MAX_ALIAS_MODELS;
|
||||
if (supportedModels.has(baseModel)) {
|
||||
return { baseModel, effort: effort as CodexEffortLevel };
|
||||
}
|
||||
|
||||
@@ -50,8 +50,8 @@ export function imageUrlToText(value: unknown): string {
|
||||
return toString(record.url);
|
||||
}
|
||||
|
||||
const CODEX_GPT_5_6_MODEL_PATTERN =
|
||||
/^gpt-5\.6-(?:sol|terra|luna)(?:-(?:none|low|medium|high|xhigh|max|ultra))?$/;
|
||||
const CODEX_MAX_EFFORT_MODEL_PATTERN =
|
||||
/^(?:gpt-5\.6-(?:sol|terra|luna)|gpt-6-astra)(?:-(?:none|low|medium|high|xhigh|max|ultra))?$/;
|
||||
const KIRO_GPT_5_6_MODEL_PATTERN =
|
||||
/^(?:kiro|kr)\/gpt-5\.6-(?:sol|terra|luna)(?:-(?:none|low|medium|high|xhigh|max))?$/;
|
||||
|
||||
@@ -61,7 +61,7 @@ function supportsNativeMaxReasoningEffort(model: unknown): boolean {
|
||||
.toLowerCase()
|
||||
.replace(/^(?:codex|cx)\//, "");
|
||||
return (
|
||||
CODEX_GPT_5_6_MODEL_PATTERN.test(normalizedModel) ||
|
||||
CODEX_MAX_EFFORT_MODEL_PATTERN.test(normalizedModel) ||
|
||||
KIRO_GPT_5_6_MODEL_PATTERN.test(toString(model).trim().toLowerCase())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Inter } from "next/font/google";
|
||||
import "./globals.css";
|
||||
import { ThemeProvider } from "@/shared/components/ThemeProvider";
|
||||
import { NextIntlClientProvider } from "next-intl";
|
||||
@@ -11,11 +10,6 @@ import { PwaRegister } from "@/shared/components/PwaRegister";
|
||||
import { LocaleAutoDetect } from "@/shared/components/LocaleAutoDetect";
|
||||
import { BasePathNetworkProvider } from "@/shared/components/BasePathNetworkProvider";
|
||||
|
||||
const inter = Inter({
|
||||
subsets: ["latin"],
|
||||
variable: "--font-inter",
|
||||
});
|
||||
|
||||
export const viewport: Viewport = {
|
||||
themeColor: "#0b0f1a",
|
||||
viewportFit: "cover",
|
||||
@@ -135,7 +129,7 @@ export default async function RootLayout({ children }) {
|
||||
}}
|
||||
/>
|
||||
</head>
|
||||
<body className={`${inter.variable} font-sans antialiased`} suppressHydrationWarning>
|
||||
<body className="font-sans antialiased" suppressHydrationWarning>
|
||||
<a
|
||||
href="#main-content"
|
||||
className="sr-only focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-50 focus:px-4 focus:py-2 focus:bg-[#6366f1] focus:text-white focus:rounded-lg focus:text-sm focus:font-semibold focus:shadow-lg"
|
||||
|
||||
@@ -101,6 +101,8 @@ export function getCodexFastCostMultiplier(
|
||||
|
||||
const modelKey = stripCodexEffortSuffix(normalizeModelName(String(model || "")).toLowerCase());
|
||||
const compactModelKey = modelKey.replace(/-/g, "");
|
||||
// Codex Astra Fast is 2.5x Standard (https://developers.openai.com/codex/pricing).
|
||||
if (modelKey === "gpt-6-astra" || compactModelKey === "gpt6astra") return 2.5;
|
||||
if (
|
||||
/^gpt-5\.6-(?:sol|terra|luna)$/.test(modelKey) ||
|
||||
/^gpt5\.6(?:sol|terra|luna)$/.test(compactModelKey)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// refresh this so the fingerprint OpenAI sees from the OAuth/Responses face
|
||||
// matches the real client version. Overridable per-deployment via
|
||||
// CODEX_CLIENT_VERSION.
|
||||
export const DEFAULT_CODEX_CLIENT_VERSION = "0.153.2";
|
||||
export const DEFAULT_CODEX_CLIENT_VERSION = "0.153.4";
|
||||
export const CODEX_CLI_RS_ORIGINATOR = "codex_cli_rs";
|
||||
|
||||
export function getCodexCliRsHeaders(
|
||||
|
||||
@@ -118,6 +118,12 @@ const GEMINI_36_FLASH_MODEL_SPEC = {
|
||||
} satisfies ModelSpec;
|
||||
|
||||
export const MODEL_SPECS: Record<string, ModelSpec> = {
|
||||
// Public model limits; the Codex registry supplies its smaller OAuth window.
|
||||
// https://developers.openai.com/api/docs/models/gpt-6-astra
|
||||
"gpt-6-astra": {
|
||||
...GPT_5_6_MODEL_SPEC,
|
||||
aliases: ["openai/gpt-6-astra"],
|
||||
},
|
||||
"gpt-5.6": {
|
||||
...GPT_5_6_MODEL_SPEC,
|
||||
aliases: ["openai/gpt-5.6"],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Pure data; merged by default-pricing.ts via spread (god-file decomposition; semantic split).
|
||||
*/
|
||||
import {
|
||||
GPT_6_ASTRA_PRICING,
|
||||
GEMINI_3_7_FLASH_PROMO_PRICING,
|
||||
GPT_5_5_PRICING,
|
||||
GPT_5_6_LUNA_PRICING,
|
||||
@@ -20,6 +21,7 @@ import {
|
||||
|
||||
export const DEFAULT_PRICING_FRONTIER = {
|
||||
openai: {
|
||||
"gpt-6-astra": GPT_6_ASTRA_PRICING,
|
||||
"gpt-5.6": GPT_5_6_SOL_PRICING,
|
||||
"gpt-5.6-sol": GPT_5_6_SOL_PRICING,
|
||||
"gpt-5.6-terra": GPT_5_6_TERRA_PRICING,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Pure data; merged by default-pricing.ts via spread (god-file decomposition; semantic split).
|
||||
*/
|
||||
import {
|
||||
GPT_6_ASTRA_PRICING,
|
||||
CLAUDE_FABLE_5_1_PRICING,
|
||||
CLAUDE_OPUS_5_PRICING,
|
||||
GEMINI_3_7_FLASH_PROMO_PRICING,
|
||||
@@ -19,6 +20,10 @@ const ANTIGRAVITY_GEMINI_3_7_PRICING = {
|
||||
"gemini-3.7-flash-high": GEMINI_3_7_FLASH_PROMO_PRICING,
|
||||
};
|
||||
|
||||
// Codex Standard: 250 / 25 / 1250 credits per MTok, at 25 credits per USD.
|
||||
// https://developers.openai.com/codex/pricing
|
||||
const GPT_6_ASTRA_CODEX_PRICING = GPT_6_ASTRA_PRICING;
|
||||
|
||||
export const DEFAULT_PRICING_OAUTH = {
|
||||
cc: {
|
||||
"claude-fable-5-1": CLAUDE_FABLE_5_1_PRICING,
|
||||
@@ -88,6 +93,13 @@ export const DEFAULT_PRICING_OAUTH = {
|
||||
},
|
||||
},
|
||||
cx: {
|
||||
"gpt-6-astra": GPT_6_ASTRA_CODEX_PRICING,
|
||||
"gpt-6-astra-ultra": GPT_6_ASTRA_CODEX_PRICING,
|
||||
"gpt-6-astra-max": GPT_6_ASTRA_CODEX_PRICING,
|
||||
"gpt-6-astra-xhigh": GPT_6_ASTRA_CODEX_PRICING,
|
||||
"gpt-6-astra-high": GPT_6_ASTRA_CODEX_PRICING,
|
||||
"gpt-6-astra-medium": GPT_6_ASTRA_CODEX_PRICING,
|
||||
"gpt-6-astra-low": GPT_6_ASTRA_CODEX_PRICING,
|
||||
"codex-auto-review": GPT_5_5_PRICING,
|
||||
// Codex uses credits per 1M tokens. OmniRoute stores the dollar-equivalent
|
||||
// values below at the documented conversion of 25 credits per USD.
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
/**
|
||||
* Pricing data — shared per-MTok tier constants (god-file decomposition). Pure data; merged by the barrel.
|
||||
*/
|
||||
// OpenAI API Standard; Codex Standard has the same dollar-equivalent rates.
|
||||
// https://openai.com/index/gpt-6-astra/
|
||||
export const GPT_6_ASTRA_PRICING = {
|
||||
input: 10.0,
|
||||
output: 50.0,
|
||||
cached: 1.0,
|
||||
reasoning: 50.0,
|
||||
cache_creation: 12.5,
|
||||
};
|
||||
|
||||
export const GPT_5_3_CODEX_PRICING = {
|
||||
input: 5.0,
|
||||
output: 20.0,
|
||||
|
||||
@@ -1311,16 +1311,16 @@
|
||||
"Authorization": "Bearer <TOK>",
|
||||
"Content-Type": "application/json",
|
||||
"Openai-Beta": "responses=experimental",
|
||||
"User-Agent": "codex-cli/0.153.2 (<OS>; <ARCH>)",
|
||||
"Version": "0.153.2",
|
||||
"User-Agent": "codex-cli/0.153.4 (<OS>; <ARCH>)",
|
||||
"Version": "0.153.4",
|
||||
"X-Codex-Beta-Features": "responses_websockets"
|
||||
},
|
||||
"nonStream": {
|
||||
"Authorization": "Bearer <TOK>",
|
||||
"Content-Type": "application/json",
|
||||
"Openai-Beta": "responses=experimental",
|
||||
"User-Agent": "codex-cli/0.153.2 (<OS>; <ARCH>)",
|
||||
"Version": "0.153.2",
|
||||
"User-Agent": "codex-cli/0.153.4 (<OS>; <ARCH>)",
|
||||
"Version": "0.153.4",
|
||||
"X-Codex-Beta-Features": "responses_websockets"
|
||||
},
|
||||
"oauth": {
|
||||
@@ -1328,8 +1328,8 @@
|
||||
"Authorization": "Bearer <TOK>",
|
||||
"Content-Type": "application/json",
|
||||
"Openai-Beta": "responses=experimental",
|
||||
"User-Agent": "codex-cli/0.153.2 (<OS>; <ARCH>)",
|
||||
"Version": "0.153.2",
|
||||
"User-Agent": "codex-cli/0.153.4 (<OS>; <ARCH>)",
|
||||
"Version": "0.153.4",
|
||||
"X-Codex-Beta-Features": "responses_websockets"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -112,7 +112,7 @@ test("AgentRouter Responses requests automatically use the native Responses prot
|
||||
body: structuredClone(body),
|
||||
headers: new Headers({ accept: "application/json", originator: "codex_cli_rs" }),
|
||||
},
|
||||
userAgent: "codex_cli_rs/0.149.0",
|
||||
userAgent: "codex_cli_rs/0.153.4",
|
||||
});
|
||||
|
||||
assert.ok(captured);
|
||||
@@ -176,7 +176,7 @@ test("AgentRouter OpenAI Chat requests automatically use the native Chat protoco
|
||||
body: structuredClone(body),
|
||||
headers: new Headers({ accept: "application/json" }),
|
||||
},
|
||||
userAgent: "codex_cli_rs/0.149.0",
|
||||
userAgent: "codex_cli_rs/0.153.4",
|
||||
});
|
||||
|
||||
assert.equal(result.success, true);
|
||||
@@ -304,7 +304,7 @@ test("AgentRouter Responses streaming stays native without a connection protocol
|
||||
body: structuredClone(body),
|
||||
headers: new Headers({ accept: "text/event-stream", originator: "codex_cli_rs" }),
|
||||
},
|
||||
userAgent: "codex_cli_rs/0.149.0",
|
||||
userAgent: "codex_cli_rs/0.153.4",
|
||||
});
|
||||
|
||||
assert.equal(result.success, true);
|
||||
@@ -383,7 +383,7 @@ test("AgentRouter OpenAI Chat streaming stays native without a connection protoc
|
||||
body: structuredClone(body),
|
||||
headers: new Headers({ accept: "text/event-stream" }),
|
||||
},
|
||||
userAgent: "codex_cli_rs/0.149.0",
|
||||
userAgent: "codex_cli_rs/0.153.4",
|
||||
});
|
||||
|
||||
assert.equal(result.success, true);
|
||||
|
||||
@@ -127,3 +127,39 @@ test("test 7: live-empty GitHub catalog path does not call persist", () => {
|
||||
const liveWindow = src.slice(liveIdx, start);
|
||||
assert.match(liveWindow, /buildApiDiscoveryResponse\s*\(/);
|
||||
});
|
||||
|
||||
test("Codex client version locksteps Dockerfile @openai/codex and env override", () => {
|
||||
const dockerfile = fs.readFileSync(path.join(process.cwd(), "Dockerfile"), "utf8");
|
||||
const match = dockerfile.match(/@openai\/codex@([0-9]+\.[0-9]+\.[0-9]+)/);
|
||||
assert.ok(match, "Dockerfile must pin @openai/codex@x.y.z");
|
||||
const pinned = match[1];
|
||||
assert.notEqual(pinned, "0.149.0");
|
||||
assert.equal(codexCfg.DEFAULT_CODEX_CLIENT_VERSION, pinned);
|
||||
assert.equal(codexCfg.getCodexClientVersion(), pinned);
|
||||
assert.equal(codexCfg.getCodexDefaultHeaders().Version, pinned);
|
||||
assert.equal(
|
||||
codexCfg.getCodexCliRsHeaders()["User-Agent"],
|
||||
`codex_cli_rs/${pinned}`,
|
||||
);
|
||||
});
|
||||
|
||||
test("test 7: live-empty GitHub catalog path does not call persist", () => {
|
||||
const src = fs.readFileSync(
|
||||
path.join(process.cwd(), "src/app/api/providers/[id]/models/route.ts"),
|
||||
"utf8",
|
||||
);
|
||||
// The githubCatalogModels fallback must use buildResponse, not buildApiDiscoveryResponse.
|
||||
const idx = src.indexOf("Codex live catalog unavailable — using GitHub model catalog");
|
||||
assert.ok(idx > 0);
|
||||
const start = src.lastIndexOf("if (githubCatalogModels", idx);
|
||||
const end = src.indexOf("if (cachedDiscoveryModels", idx);
|
||||
assert.ok(start > 0 && end > start);
|
||||
const window = src.slice(start, end);
|
||||
assert.match(window, /buildResponse\s*\(/);
|
||||
assert.doesNotMatch(window, /buildApiDiscoveryResponse\s*\(/);
|
||||
|
||||
const liveIdx = src.lastIndexOf("if (liveModels && liveModels.length > 0)");
|
||||
assert.ok(liveIdx > 0 && liveIdx < start);
|
||||
const liveWindow = src.slice(liveIdx, start);
|
||||
assert.match(liveWindow, /buildApiDiscoveryResponse\s*\(/);
|
||||
});
|
||||
|
||||
109
tests/unit/codex-astra.test.ts
Normal file
109
tests/unit/codex-astra.test.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
import { getModelsByProviderId } from "../../open-sse/config/providerModels.ts";
|
||||
import { CodexExecutor } from "../../open-sse/executors/codex.ts";
|
||||
import { openaiToOpenAIResponsesRequest } from "../../open-sse/translator/request/openai-responses/toResponses.ts";
|
||||
import { getModelSpec } from "../../src/shared/constants/modelSpecs.ts";
|
||||
import { getPricingForModel } from "../../src/shared/constants/pricing.ts";
|
||||
import { getCodexFastCostMultiplier } from "../../src/lib/usage/costCalculator.ts";
|
||||
|
||||
const MODEL = "gpt-6-astra";
|
||||
const EFFORTS = ["ultra", "max", "xhigh", "high", "medium", "low"] as const;
|
||||
|
||||
test.after(async () => {
|
||||
const { resetDbInstance } = await import("../../src/lib/db/core.ts");
|
||||
resetDbInstance();
|
||||
});
|
||||
|
||||
test("Codex exposes Astra and its effort variants with live OAuth limits", () => {
|
||||
const ids = [MODEL, ...EFFORTS.map((effort) => `${MODEL}-${effort}`)];
|
||||
for (const provider of ["codex", "codex-app-server"]) {
|
||||
const models = getModelsByProviderId(provider);
|
||||
assert.deepEqual(
|
||||
models.filter((model) => model.id.startsWith(MODEL)).map((model) => model.id),
|
||||
ids
|
||||
);
|
||||
for (const id of ids) {
|
||||
const model = models.find((entry) => entry.id === id);
|
||||
assert.ok(model, `${provider}/${id}`);
|
||||
assert.equal(model.contextLength, 872000);
|
||||
assert.equal(model.maxInputTokens, 872000);
|
||||
assert.equal(model.maxOutputTokens, 128000);
|
||||
assert.equal(model.targetFormat, "openai-responses");
|
||||
assert.equal(model.toolCalling, true);
|
||||
assert.equal(model.supportsReasoning, true);
|
||||
assert.equal(model.supportsVision, true);
|
||||
assert.equal(model.supportsXHighEffort, true);
|
||||
}
|
||||
assert.deepEqual(
|
||||
models.slice(0, ids.length).map((model) => model.id),
|
||||
ids
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("Astra specs retain the public context window separately from Codex limits", () => {
|
||||
const spec = getModelSpec(MODEL);
|
||||
assert.equal(spec?.contextWindow, 1050000);
|
||||
assert.equal(spec?.maxOutputTokens, 128000);
|
||||
assert.equal(spec?.supportsTools, true);
|
||||
assert.equal(spec?.supportsVision, true);
|
||||
assert.equal(spec?.supportsThinking, true);
|
||||
});
|
||||
|
||||
test("Astra effort aliases reach Codex as the base model and supported wire effort", () => {
|
||||
const executor = new CodexExecutor();
|
||||
for (const effort of EFFORTS) {
|
||||
const model = `${MODEL}-${effort}`;
|
||||
const result = executor.transformRequest(model, { model, input: [] }, false, {
|
||||
requestEndpointPath: "/responses",
|
||||
});
|
||||
assert.equal(result.model, MODEL, effort);
|
||||
assert.equal(result.reasoning.effort, effort === "ultra" ? "max" : effort, effort);
|
||||
}
|
||||
});
|
||||
|
||||
test("Chat-to-Codex translation preserves Astra max reasoning", () => {
|
||||
const translated = openaiToOpenAIResponsesRequest(
|
||||
MODEL,
|
||||
{ model: MODEL, messages: [{ role: "user", content: "test" }], reasoning_effort: "max" },
|
||||
true,
|
||||
{}
|
||||
);
|
||||
const result = new CodexExecutor().transformRequest(MODEL, translated, true, {
|
||||
requestEndpointPath: "/chat/completions",
|
||||
});
|
||||
assert.equal(result.model, MODEL);
|
||||
assert.equal(result.reasoning.effort, "max");
|
||||
});
|
||||
|
||||
test("Astra parenthesized effort overrides preserve the reasoning summary", () => {
|
||||
for (const effort of ["max", "ultra"]) {
|
||||
const model = `${MODEL}(${effort})`;
|
||||
const result = new CodexExecutor().transformRequest(
|
||||
model,
|
||||
{ model, input: [], reasoning: { effort: "low", summary: "detailed" } },
|
||||
false,
|
||||
{ requestEndpointPath: "/responses" }
|
||||
);
|
||||
assert.equal(result.model, MODEL);
|
||||
assert.equal(result.reasoning.effort, "max");
|
||||
assert.equal(result.reasoning.summary, "detailed");
|
||||
}
|
||||
});
|
||||
|
||||
test("Astra Codex pricing and Fast multiplier match the Codex credit rate card", () => {
|
||||
for (const model of [MODEL, ...EFFORTS.map((effort) => `${MODEL}-${effort}`)]) {
|
||||
const pricing = getPricingForModel("cx", model);
|
||||
assert.ok(pricing, model);
|
||||
assert.equal(pricing.input, 10);
|
||||
assert.equal(pricing.cached, 1);
|
||||
assert.equal(pricing.output, 50);
|
||||
assert.equal(pricing.reasoning, 50);
|
||||
assert.equal(getCodexFastCostMultiplier("codex", model, "priority"), 2.5);
|
||||
assert.equal(getCodexFastCostMultiplier("cx", model, "fast"), 2.5);
|
||||
assert.equal(getCodexFastCostMultiplier("codex", model, "default"), 1);
|
||||
}
|
||||
assert.equal(getCodexFastCostMultiplier("openai", MODEL, "priority"), 1);
|
||||
});
|
||||
@@ -29,7 +29,7 @@ test("Codex catalog exposes the GPT-5.6 lineup in configured priority order", ()
|
||||
];
|
||||
|
||||
assert.deepEqual(
|
||||
models.slice(0, expectedIds.length).map((model) => model.id),
|
||||
models.filter((model) => model.id.startsWith("gpt-5.6-")).map((model) => model.id),
|
||||
expectedIds
|
||||
);
|
||||
|
||||
|
||||
@@ -70,6 +70,12 @@ test("Responses Lite must not strip parallel_tool_calls for GPT-5.6 luna max-tie
|
||||
assert.equal(capturedBodies[0].parallel_tool_calls, true);
|
||||
});
|
||||
|
||||
test("Responses Lite preserves parallel tool calls for Astra ultra delegation", async () => {
|
||||
const capturedBodies = await runLiteRequest("gpt-6-astra-ultra");
|
||||
assert.equal(capturedBodies.length, 1);
|
||||
assert.equal(capturedBodies[0].parallel_tool_calls, true);
|
||||
});
|
||||
|
||||
test("Responses Lite still forces parallel_tool_calls:false for non-delegation GPT-5.5", async () => {
|
||||
const capturedBodies = await runLiteRequest("gpt-5.5");
|
||||
assert.equal(
|
||||
|
||||
@@ -184,10 +184,10 @@ test("CodexExecutor.buildHeaders binds workspace ids and disables SSE accept for
|
||||
assert.equal(standardHeaders.Authorization, "Bearer codex-token");
|
||||
assert.equal(standardHeaders.Accept, "text/event-stream");
|
||||
assert.equal(standardHeaders["chatgpt-account-id"], "workspace-1");
|
||||
assert.equal(standardHeaders.Version, "0.153.2");
|
||||
assert.equal(standardHeaders.Version, "0.153.4");
|
||||
assert.equal(standardHeaders["Openai-Beta"], "responses=experimental");
|
||||
assert.equal(standardHeaders["X-Codex-Beta-Features"], "responses_websockets");
|
||||
assert.equal(standardHeaders["User-Agent"], "codex-cli/0.153.2 (Windows 10.0.26200; x64)");
|
||||
assert.equal(standardHeaders["User-Agent"], "codex-cli/0.153.4 (Windows 10.0.26200; x64)");
|
||||
assert.equal(compactHeaders.Accept, "application/json");
|
||||
});
|
||||
|
||||
@@ -213,7 +213,7 @@ test("CodexExecutor.buildHeaders honors safe env overrides for Version and User-
|
||||
},
|
||||
() => {
|
||||
const headers = executor.buildHeaders({ accessToken: "codex-token" }, true);
|
||||
assert.equal(headers.Version, "0.153.2");
|
||||
assert.equal(headers.Version, "0.153.4");
|
||||
assert.equal(headers["User-Agent"], "custom-codex/9.9.9");
|
||||
}
|
||||
);
|
||||
|
||||
@@ -4,10 +4,14 @@ import assert from "node:assert/strict";
|
||||
import { getModelsByProviderId } from "../../open-sse/config/providerModels.ts";
|
||||
import { getModelSpec } from "../../src/shared/constants/modelSpecs.ts";
|
||||
import { getPricingForModel } from "../../src/shared/constants/pricing.ts";
|
||||
import { getUnsupportedParams } from "../../open-sse/config/providerRegistry.ts";
|
||||
import { DefaultExecutor } from "../../open-sse/executors/default.ts";
|
||||
import { resolveChatCoreTargetFormat } from "../../open-sse/handlers/chatCore/targetFormat.ts";
|
||||
import { openaiToOpenAIResponsesRequest } from "../../open-sse/translator/request/openai-responses/toResponses.ts";
|
||||
|
||||
const EXPECTED_MODELS = ["gpt-5.6", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"];
|
||||
const EXPECTED_MODELS = ["gpt-6-astra", "gpt-5.6", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"];
|
||||
|
||||
test("OpenAI API catalog exposes the public GPT-5.6 family and keeps GPT-5.4", () => {
|
||||
test("OpenAI API catalog puts Astra before GPT-5.6 and keeps GPT-5.4", () => {
|
||||
const models = getModelsByProviderId("openai");
|
||||
|
||||
assert.deepEqual(
|
||||
@@ -38,8 +42,9 @@ test("OpenAI API catalog exposes the public GPT-5.6 family and keeps GPT-5.4", (
|
||||
}
|
||||
});
|
||||
|
||||
test("OpenAI API GPT-5.6 pricing matches the published standard tier", () => {
|
||||
test("OpenAI API Astra and GPT-5.6 pricing matches the published standard tier", () => {
|
||||
const expectedPricing = {
|
||||
"gpt-6-astra": { input: 10, cached: 1, cache_creation: 12.5, output: 50 },
|
||||
"gpt-5.6": { input: 5, cached: 0.5, cache_creation: 6.25, output: 30 },
|
||||
"gpt-5.6-sol": { input: 5, cached: 0.5, cache_creation: 6.25, output: 30 },
|
||||
"gpt-5.6-terra": { input: 2.5, cached: 0.25, cache_creation: 3.125, output: 15 },
|
||||
@@ -55,3 +60,72 @@ test("OpenAI API GPT-5.6 pricing matches the published standard tier", () => {
|
||||
assert.equal(pricing.output, expected.output, `${modelId} output`);
|
||||
}
|
||||
});
|
||||
|
||||
test("OpenAI Astra declares unsupported sampling parameters for the chat pipeline", () => {
|
||||
assert.deepEqual(getUnsupportedParams("openai", "gpt-6-astra"), [
|
||||
"temperature",
|
||||
"top_p",
|
||||
"top_logprobs",
|
||||
"logprobs",
|
||||
]);
|
||||
});
|
||||
|
||||
test("OpenAI Astra tool requests use Responses and retain each supported reasoning effort", async () => {
|
||||
const model = "gpt-6-astra";
|
||||
assert.equal(
|
||||
resolveChatCoreTargetFormat({
|
||||
provider: "openai",
|
||||
resolvedModel: model,
|
||||
apiFormat: undefined,
|
||||
customModelTargetFormat: undefined,
|
||||
providerSpecificData: null,
|
||||
}).targetFormat,
|
||||
"openai-responses"
|
||||
);
|
||||
const originalFetch = globalThis.fetch;
|
||||
const captured: Array<{ url: string; body: Record<string, unknown> }> = [];
|
||||
globalThis.fetch = async (url, init) => {
|
||||
captured.push({ url: String(url), body: JSON.parse(String(init?.body || "{}")) });
|
||||
return new Response(JSON.stringify({ id: "resp_astra", object: "response", output: [] }), {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
};
|
||||
try {
|
||||
for (const effort of ["low", "medium", "high", "xhigh", "max", "none", "minimal"]) {
|
||||
const body = openaiToOpenAIResponsesRequest(
|
||||
model,
|
||||
{
|
||||
model,
|
||||
messages: [{ role: "user", content: "Call the test tool." }],
|
||||
reasoning_effort: effort,
|
||||
tools: [
|
||||
{
|
||||
type: "function",
|
||||
function: { name: "test_tool", parameters: { type: "object", properties: {} } },
|
||||
},
|
||||
],
|
||||
},
|
||||
false,
|
||||
{}
|
||||
);
|
||||
await new DefaultExecutor("openai").execute({
|
||||
model,
|
||||
body,
|
||||
stream: false,
|
||||
credentials: { apiKey: "test-openai-key" },
|
||||
});
|
||||
const request = captured.at(-1)!;
|
||||
assert.equal(request.url, "https://api.openai.com/v1/responses");
|
||||
assert.equal(request.body.model, model);
|
||||
assert.equal(
|
||||
(request.body.reasoning as { effort: string }).effort,
|
||||
effort === "none" || effort === "minimal" ? "low" : effort
|
||||
);
|
||||
assert.ok(Array.isArray(request.body.input));
|
||||
assert.equal((request.body.tools as Array<{ name: string }>)[0].name, "test_tool");
|
||||
}
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user