@@ -37,9 +37,10 @@ const CATALOG = {
3737 ] ,
3838 models : [
3939 {
40- id : "openai/gpt-5.5 " ,
41- upstream : "gpt-5.5 " ,
40+ id : "openai/gpt-5.6 " ,
41+ upstream : "gpt-5.6 " ,
4242 capabilities : [ "llm.responses" , "llm.chat" ] ,
43+ supportedReasoningEfforts : [ "none" , "low" , "medium" , "high" , "xhigh" , "max" ] ,
4344 pricing : PRICING ,
4445 } ,
4546 ] ,
@@ -157,9 +158,10 @@ describe("ClawRouter provider catalog", () => {
157158 "anthropic/claude-sonnet-4-6" ,
158159 "deepseek/deepseek-v4-flash" ,
159160 "google/gemini-3.5-flash" ,
160- "openai/gpt-5.5 " ,
161+ "openai/gpt-5.6 " ,
161162 ] ) ;
162- expect ( provider . models . find ( ( model ) => model . id === "openai/gpt-5.5" ) ) . toMatchObject ( {
163+ const openai = provider . models . find ( ( model ) => model . id === "openai/gpt-5.6" ) ;
164+ expect ( openai ) . toMatchObject ( {
163165 api : "openai-responses" ,
164166 baseUrl : "https://clawrouter.example/v1" ,
165167 reasoning : true ,
@@ -168,9 +170,23 @@ describe("ClawRouter provider catalog", () => {
168170 contextWindow : 1_000_000 ,
169171 maxTokens : 64_000 ,
170172 } ) ;
171- expect (
172- provider . models . find ( ( model ) => model . id === "deepseek/deepseek-v4-flash" ) ,
173- ) . toMatchObject ( { api : "openai-completions" } ) ;
173+ expect ( openai ?. thinkingLevelMap ) . toEqual ( {
174+ off : "none" ,
175+ minimal : null ,
176+ low : "low" ,
177+ medium : "medium" ,
178+ high : "high" ,
179+ xhigh : "xhigh" ,
180+ max : "max" ,
181+ } ) ;
182+ expect ( openai ?. compat ) . toEqual ( {
183+ supportsReasoningEffort : true ,
184+ supportedReasoningEfforts : [ "none" , "low" , "medium" , "high" , "xhigh" , "max" ] ,
185+ } ) ;
186+ const deepseek = provider . models . find ( ( model ) => model . id === "deepseek/deepseek-v4-flash" ) ;
187+ expect ( deepseek ) . toMatchObject ( { api : "openai-completions" } ) ;
188+ expect ( deepseek ?. compat ) . toBeUndefined ( ) ;
189+ expect ( deepseek ?. thinkingLevelMap ) . toBeUndefined ( ) ;
174190 expect (
175191 provider . models . find ( ( model ) => model . id === "anthropic/claude-sonnet-4-6" ) ,
176192 ) . toMatchObject ( {
@@ -206,17 +222,71 @@ describe("ClawRouter provider catalog", () => {
206222 params : undefined ,
207223 } ) ;
208224
209- const openai = provider . models . find ( ( model ) => model . id === "openai/gpt-5.5 " ) ;
225+ const openaiModel = provider . models . find ( ( model ) => model . id === "openai/gpt-5.6 " ) ;
210226 const normalizedOpenAi = normalizeClawRouterResolvedModel ( {
211- ...openai ,
227+ ...openaiModel ,
212228 baseUrl : provider . baseUrl ,
213229 provider : "clawrouter" ,
214230 } as ProviderRuntimeModel ) ;
215231 expect ( prepareClawRouterRequestModel ( normalizedOpenAi as ProviderRuntimeModel ) . id ) . toBe (
216- "openai/gpt-5.5 " ,
232+ "openai/gpt-5.6 " ,
217233 ) ;
218234 } ) ;
219235
236+ it ( "bounds reasoning effort metadata to exact canonical wire values" , async ( ) => {
237+ const catalog = structuredClone ( CATALOG ) ;
238+ const model = expectDefined ( catalog . providers [ 0 ] ?. models [ 0 ] , "OpenAI ClawRouter model" ) ;
239+ ( model as unknown as Record < string , unknown > ) . supportedReasoningEfforts = [
240+ "max" ,
241+ "none" ,
242+ "ultra" ,
243+ "low" ,
244+ "low" ,
245+ null ,
246+ "xhigh" ,
247+ ] ;
248+ const provider = await buildClawRouterProviderConfig ( {
249+ apiKey : "clawrouter-test-key" ,
250+ fetchGuard : buildFetchGuard ( catalog ) . fetchGuard ,
251+ } ) ;
252+ const bounded = provider . models . find ( ( entry ) => entry . id === "openai/gpt-5.6" ) ;
253+
254+ expect ( bounded ?. compat ?. supportedReasoningEfforts ) . toEqual ( [ "none" , "low" , "xhigh" , "max" ] ) ;
255+ expect ( bounded ?. thinkingLevelMap ) . toEqual ( {
256+ off : "none" ,
257+ minimal : null ,
258+ low : "low" ,
259+ medium : null ,
260+ high : null ,
261+ xhigh : "xhigh" ,
262+ max : "max" ,
263+ } ) ;
264+
265+ const malformedCatalog = structuredClone ( CATALOG ) ;
266+ const malformed = expectDefined (
267+ malformedCatalog . providers [ 0 ] ?. models [ 0 ] ,
268+ "OpenAI ClawRouter model" ,
269+ ) ;
270+ ( malformed as unknown as Record < string , unknown > ) . supportedReasoningEfforts = [
271+ "none" ,
272+ "minimal" ,
273+ "low" ,
274+ "medium" ,
275+ "high" ,
276+ "xhigh" ,
277+ "max" ,
278+ "ultra" ,
279+ ] ;
280+ clearLiveCatalogCacheForTests ( ) ;
281+ const rejected = await buildClawRouterProviderConfig ( {
282+ apiKey : "clawrouter-test-key" ,
283+ fetchGuard : buildFetchGuard ( malformedCatalog ) . fetchGuard ,
284+ } ) ;
285+ const rejectedModel = rejected . models . find ( ( entry ) => entry . id === "openai/gpt-5.6" ) ;
286+ expect ( rejectedModel ?. compat ) . toBeUndefined ( ) ;
287+ expect ( rejectedModel ?. thinkingLevelMap ) . toBeUndefined ( ) ;
288+ } ) ;
289+
220290 it ( "caches catalog rows per credential scope" , async ( ) => {
221291 const { fetchGuard, fetchGuardMock } = buildFetchGuard ( ) ;
222292 const params = {
0 commit comments