Skip to content

Commit 4c69ef6

Browse files
committed
fix(catalog): advertise GPT-5.6 reasoning efforts
1 parent 7b0b6f6 commit 4c69ef6

10 files changed

Lines changed: 72 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## Unreleased
44

5+
- Advertise model-specific provider-native reasoning efforts through the credential-scoped client catalog.
56
- Add tenant-global monthly provider budgets with preflight enforcement, dual-ledger settlement, retry-safe accounting, and console spend controls.
67
- Fix console pages loading scrolled past the header; view changes now reset scroll and the Access tab strip scrolls only itself.
78

‎providers/README.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ billing:
8383
per million tokens. Change `pricingRef` whenever rates or effective dates
8484
change. Declare `longContext` when a model changes rates above an input-token
8585
threshold; omit `pricing` when a model cannot be priced safely.
86+
- `models.entries[].supportedReasoningEfforts` advertises the model's exact
87+
provider-native OpenAI-compatible wire efforts. Values are unique and limited
88+
to `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
8689

8790
## Edge Support Rules
8891

‎providers/_schema/service-provider.schema.json‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,13 @@
396396
"id": { "type": "string" },
397397
"upstream": { "type": "string" },
398398
"capabilities": { "type": "array", "items": { "type": "string" } },
399+
"supportedReasoningEfforts": {
400+
"type": "array",
401+
"items": { "enum": ["none", "minimal", "low", "medium", "high", "xhigh", "max"] },
402+
"minItems": 1,
403+
"maxItems": 7,
404+
"uniqueItems": true
405+
},
399406
"pricingRef": { "type": "string" },
400407
"pricing": { "$ref": "#/$defs/modelPricing" }
401408
}

‎providers/openai.provider.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ models:
149149
- id: openai/gpt-5.6
150150
upstream: gpt-5.6
151151
capabilities: [llm.responses, llm.chat]
152+
supportedReasoningEfforts: [none, low, medium, high, xhigh, max]
152153
pricingRef: openai-gpt-5.6-standard-2026-07-09
153154
pricing:
154155
effectiveAt: "2026-07-09"

‎scripts/compile-providers.mjs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export function compileProviderSnapshot(manifests) {
3737
provider: provider.id,
3838
upstream: model.upstream,
3939
capabilities: model.capabilities,
40+
...(model.supportedReasoningEfforts ? { supportedReasoningEfforts: model.supportedReasoningEfforts } : {}),
4041
pricing_ref: model.pricing_ref,
4142
pricing: model.pricing,
4243
};
@@ -106,6 +107,7 @@ function compileProvider(manifest, ids) {
106107
id: model.id,
107108
upstream: model.upstream,
108109
capabilities: model.capabilities ?? [],
110+
...(model.supportedReasoningEfforts ? { supportedReasoningEfforts: model.supportedReasoningEfforts } : {}),
109111
pricing_ref: model.pricingRef ?? null,
110112
pricing: model.pricing ? normalizePricing(model.pricing) : null,
111113
}));
@@ -212,6 +214,14 @@ function validateManifest(manifest) {
212214
for (const capability of manifest.capabilities) {
213215
if (!manifest.endpoints[capability.endpoint]) throw new Error(`provider ${manifest.id} capability ${capability.id} references missing endpoint ${capability.endpoint}`);
214216
}
217+
const reasoningEfforts = new Set(["none", "minimal", "low", "medium", "high", "xhigh", "max"]);
218+
for (const model of manifest.models?.entries ?? []) {
219+
const efforts = model.supportedReasoningEfforts;
220+
if (efforts === undefined) continue;
221+
if (!Array.isArray(efforts) || efforts.length === 0 || efforts.length > reasoningEfforts.size) throw new Error(`provider ${manifest.id} model ${model.id} supportedReasoningEfforts must contain 1-${reasoningEfforts.size} entries`);
222+
if (efforts.some((effort) => !reasoningEfforts.has(effort))) throw new Error(`provider ${manifest.id} model ${model.id} supportedReasoningEfforts contains an unsupported effort`);
223+
if (new Set(efforts).size !== efforts.length) throw new Error(`provider ${manifest.id} model ${model.id} supportedReasoningEfforts must contain unique entries`);
224+
}
215225
for (const [id, endpoint] of Object.entries(manifest.endpoints)) {
216226
if (!endpoint.path?.startsWith("/")) throw new Error(`provider ${manifest.id} endpoint ${id} path must start with /`);
217227
for (const placeholder of endpoint.path.matchAll(/\$\{([^}]+)\}/g)) {

‎worker/discovery.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ export function catalogModels(provider: CompiledProvider, endpoints: string[], p
203203
// Budgeted proxy keys fail closed at discovery instead of per-request pricing_required.
204204
if (requiresPricing && model.pricing == null) return [];
205205
const capabilities = executableCapabilities(provider, model.capabilities, endpoints);
206-
return capabilities.length ? [{ id: model.id, upstream: model.upstream, capabilities, pricing_ref: model.pricing_ref, pricing: model.pricing }] : [];
206+
return capabilities.length ? [{ id: model.id, upstream: model.upstream, capabilities, ...(model.supportedReasoningEfforts ? { supportedReasoningEfforts: model.supportedReasoningEfforts } : {}), pricing_ref: model.pricing_ref, pricing: model.pricing }] : [];
207207
});
208208
}
209209

‎worker/generated/provider-snapshot.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎worker/test/discovery.test.mjs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ const { catalogModels } = await import("../discovery.ts");
2222
const fireworks = providerById("fireworks");
2323
assert.ok(fireworks);
2424
const endpoints = fireworks.endpoints.map((endpoint) => endpoint.id);
25+
const openai = providerById("openai");
26+
assert.ok(openai);
27+
const openaiEndpoints = openai.endpoints.map((endpoint) => endpoint.id);
28+
29+
test("catalog models preserve declared reasoning efforts without adding sibling metadata", () => {
30+
const models = catalogModels(openai, openaiEndpoints, null);
31+
const gpt56 = models.find((model) => model.id === "openai/gpt-5.6");
32+
const gpt55 = models.find((model) => model.id === "openai/gpt-5.5");
33+
34+
assert.deepEqual(gpt56.supportedReasoningEfforts, ["none", "low", "medium", "high", "xhigh", "max"]);
35+
assert.equal("supportedReasoningEfforts" in gpt55, false);
36+
});
2537

2638
test("budgeted proxy-key catalogs omit unpriced models without fixed request pricing", () => {
2739
const models = catalogModels(fireworks, endpoints, {

‎worker/test/provider-compiler.test.mjs‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ test("TypeScript provider compiler is deterministic and preserves the catalog co
1919
const gpt56 = openai.models.find((model) => model.id === "openai/gpt-5.6");
2020
assert.equal(gpt56.upstream, "gpt-5.6");
2121
assert.deepEqual(gpt56.capabilities, ["llm.responses", "llm.chat"]);
22+
assert.deepEqual(gpt56.supportedReasoningEfforts, ["none", "low", "medium", "high", "xhigh", "max"]);
23+
assert.deepEqual(compiled.model_index["openai/gpt-5.6"].supportedReasoningEfforts, gpt56.supportedReasoningEfforts);
24+
assert.equal("supportedReasoningEfforts" in openai.models.find((model) => model.id === "openai/gpt-5.5"), false);
2225
assert.deepEqual(gpt56.pricing, {
2326
effectiveAt: "2026-07-09",
2427
source: "https://developers.openai.com/api/docs/models/gpt-5.6-sol",
@@ -50,6 +53,17 @@ test("TypeScript provider compiler is deterministic and preserves the catalog co
5053
assert.ok(compiled.capability_index["llm.chat"].length >= 10);
5154
});
5255

56+
test("provider schema bounds reasoning efforts to canonical wire values", () => {
57+
const schema = JSON.parse(readFileSync("providers/_schema/service-provider.schema.json", "utf8"));
58+
assert.deepEqual(schema.$defs.model.properties.supportedReasoningEfforts, {
59+
type: "array",
60+
items: { enum: ["none", "minimal", "low", "medium", "high", "xhigh", "max"] },
61+
minItems: 1,
62+
maxItems: 7,
63+
uniqueItems: true,
64+
});
65+
});
66+
5367
test("compiled providers have unique ids, models, capabilities, and executable endpoint references", () => {
5468
const snapshot = JSON.parse(readFileSync("worker/generated/provider-snapshot.json", "utf8"));
5569
assert.equal(new Set(snapshot.providers.map((provider) => provider.id)).size, snapshot.providers.length);
@@ -85,3 +99,22 @@ test("quota header sources must retain their declared array shape", () => {
8599
rmSync(directory, { recursive: true, force: true });
86100
}
87101
});
102+
103+
test("reasoning effort metadata rejects empty, duplicate, and unsupported values", () => {
104+
const directory = mkdtempSync(join(tmpdir(), "clawrouter-provider-"));
105+
const manifest = join(directory, "openai.provider.yaml");
106+
const source = readFileSync("providers/openai.provider.yaml", "utf8");
107+
const cases = [
108+
["[]", /must contain 1-7 entries/],
109+
["[none, low, low]", /must contain unique entries/],
110+
["[none, ultra]", /contains an unsupported effort/],
111+
];
112+
try {
113+
for (const [value, expected] of cases) {
114+
writeFileSync(manifest, source.replace("[none, low, medium, high, xhigh, max]", value));
115+
assert.throws(() => execFileSync(process.execPath, ["scripts/compile-providers.mjs", manifest], { encoding: "utf8", stdio: "pipe" }), expected);
116+
}
117+
} finally {
118+
rmSync(directory, { recursive: true, force: true });
119+
}
120+
});

‎worker/types.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export interface ProviderSnapshot {
22
version: string;
33
providers: CompiledProvider[];
44
capability_index: Record<string, Array<{ provider: string; endpoint: string; methods: string[] }>>;
5-
model_index: Record<string, { provider: string; upstream: string; capabilities: string[]; pricing_ref: string | null; pricing: ModelPricing | null }>;
5+
model_index: Record<string, { provider: string; upstream: string; capabilities: string[]; supportedReasoningEfforts?: ProviderReasoningEffort[]; pricing_ref: string | null; pricing: ModelPricing | null }>;
66
}
77

88
export interface CompiledProvider {
@@ -59,7 +59,8 @@ export interface AuthorizationConfig { authorizeUrl: string; tokenUrl: string; c
5959
export interface RefreshConfig { tokenUrl: string; clientId: string | null; clientIdConfig: string | null; clientSecretConfig: string | null; extraParams: Record<string, string> }
6060
export interface LongContextPricing { thresholdInputTokens: number; inputMicrosPerMillion: number; outputMicrosPerMillion: number; cachedInputMicrosPerMillion: number | null; cacheWriteInputMicrosPerMillion: number | null; cacheWrite5mInputMicrosPerMillion: number | null; cacheWrite1hInputMicrosPerMillion: number | null }
6161
export interface ModelPricing { effectiveAt: string; source: string; inputMicrosPerMillion: number; outputMicrosPerMillion: number; cachedInputMicrosPerMillion: number | null; cacheWriteInputMicrosPerMillion: number | null; cacheWrite5mInputMicrosPerMillion: number | null; cacheWrite1hInputMicrosPerMillion: number | null; maxInputTokens: number; maxRequestInputTokens: number | null; defaultMaxOutputTokens: number; inputTokenOverhead: number; longContext: LongContextPricing | null }
62-
export interface CompiledModel { id: string; upstream: string; capabilities: string[]; pricing_ref: string | null; pricing: ModelPricing | null }
62+
export type ProviderReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
63+
export interface CompiledModel { id: string; upstream: string; capabilities: string[]; supportedReasoningEfforts?: ProviderReasoningEffort[]; pricing_ref: string | null; pricing: ModelPricing | null }
6364
export interface CompiledEndpoint { id: string; method: string; methods: string[]; path: string; native_proxy: boolean; auth: string | null; headers: Record<string, string>; request_headers: string[]; response_headers: string[]; query: Record<string, string>; path_params: string[]; path_param_styles: Record<string, string>; request_format: string; response_format: string; streaming: string | null; timeout_ms: number | null }
6465

6566
export interface Env {

0 commit comments

Comments
 (0)