@@ -267,6 +267,21 @@ describe("OpenAiNativeHandler", () => {
267267 expect ( modelInfo . info . supportsReasoningEffort ) . toEqual ( [ "low" , "medium" , "high" , "xhigh" ] )
268268 } )
269269
270+ it ( "should return GPT-5.5 model info when selected" , ( ) => {
271+ const gpt55Handler = new OpenAiNativeHandler ( {
272+ ...mockOptions ,
273+ apiModelId : "gpt-5.5" ,
274+ } )
275+
276+ const modelInfo = gpt55Handler . getModel ( )
277+ expect ( modelInfo . id ) . toBe ( "gpt-5.5" )
278+ expect ( modelInfo . info . maxTokens ) . toBe ( 128000 )
279+ expect ( modelInfo . info . contextWindow ) . toBe ( 1_050_000 )
280+ expect ( modelInfo . info . supportsVerbosity ) . toBe ( true )
281+ expect ( modelInfo . info . supportsReasoningEffort ) . toEqual ( [ "none" , "low" , "medium" , "high" , "xhigh" ] )
282+ expect ( modelInfo . info . reasoningEffort ) . toBe ( "medium" )
283+ } )
284+
270285 it ( "should return GPT-5.4 model info when selected" , ( ) => {
271286 const gpt54Handler = new OpenAiNativeHandler ( {
272287 ...mockOptions ,
@@ -430,6 +445,56 @@ describe("OpenAiNativeHandler", () => {
430445 expect ( textChunks [ 1 ] . text ) . toBe ( " world" )
431446 } )
432447
448+ it ( "should handle GPT-5.5 model with Responses API" , async ( ) => {
449+ const mockFetch = vitest . fn ( ) . mockResolvedValue ( {
450+ ok : true ,
451+ body : new ReadableStream ( {
452+ start ( controller ) {
453+ controller . enqueue (
454+ new TextEncoder ( ) . encode (
455+ 'data: {"type":"response.output_item.added","item":{"type":"text","text":"GPT-5.5 reply"}}\n\n' ,
456+ ) ,
457+ )
458+ controller . enqueue ( new TextEncoder ( ) . encode ( "data: [DONE]\n\n" ) )
459+ controller . close ( )
460+ } ,
461+ } ) ,
462+ } )
463+ global . fetch = mockFetch as any
464+
465+ mockResponsesCreate . mockRejectedValue ( new Error ( "SDK not available" ) )
466+
467+ handler = new OpenAiNativeHandler ( {
468+ ...mockOptions ,
469+ apiModelId : "gpt-5.5" ,
470+ } )
471+
472+ const stream = handler . createMessage ( systemPrompt , messages )
473+ const chunks : any [ ] = [ ]
474+ for await ( const chunk of stream ) {
475+ chunks . push ( chunk )
476+ }
477+
478+ expect ( mockFetch ) . toHaveBeenCalledWith (
479+ "https://api.openai.com/v1/responses" ,
480+ expect . objectContaining ( {
481+ body : expect . any ( String ) ,
482+ } ) ,
483+ )
484+ const body = ( mockFetch . mock . calls [ 0 ] [ 1 ] as any ) . body as string
485+ const parsedBody = JSON . parse ( body )
486+ expect ( parsedBody . model ) . toBe ( "gpt-5.5" )
487+ expect ( parsedBody . max_output_tokens ) . toBe ( 128000 )
488+ expect ( parsedBody . temperature ) . toBeUndefined ( )
489+ expect ( parsedBody . include ) . toEqual ( [ "reasoning.encrypted_content" ] )
490+ expect ( parsedBody . reasoning ?. effort ) . toBe ( "medium" )
491+ expect ( parsedBody . text ?. verbosity ) . toBe ( "medium" )
492+
493+ const textChunks = chunks . filter ( ( chunk ) => chunk . type === "text" )
494+ expect ( textChunks ) . toHaveLength ( 1 )
495+ expect ( textChunks [ 0 ] . text ) . toBe ( "GPT-5.5 reply" )
496+ } )
497+
433498 it ( "should handle GPT-5.4 model with Responses API" , async ( ) => {
434499 const mockFetch = vitest . fn ( ) . mockResolvedValue ( {
435500 ok : true ,
0 commit comments