@@ -804,8 +804,13 @@ describe("OpenAI Responses passthrough sanitization", () => {
804804 expect ( body . prompt_cache_key ) . toBe ( "project-cache-v1" ) ;
805805 } ) ;
806806
807- test ( "preserves prompt_cache_retention in the raw Responses passthrough body" , ( ) => {
808- const adapter = createResponsesPassthroughAdapter ( provider ) ;
807+ test ( "preserves prompt_cache_retention for OpenAI API-key Responses requests" , ( ) => {
808+ const adapter = createResponsesPassthroughAdapter ( {
809+ adapter : "openai-responses" ,
810+ baseUrl : "https://api.openai.com/v1" ,
811+ authMode : "key" ,
812+ apiKey : "sk-test" ,
813+ } ) ;
809814 const request = adapter . buildRequest ( {
810815 modelId : "gpt-5.5" ,
811816 context : { messages : [ ] } ,
@@ -822,6 +827,24 @@ describe("OpenAI Responses passthrough sanitization", () => {
822827 expect ( body . prompt_cache_retention ) . toBe ( "24h" ) ;
823828 } ) ;
824829
830+ test ( "strips prompt_cache_retention from ChatGPT forward requests" , ( ) => {
831+ const adapter = createResponsesPassthroughAdapter ( provider ) ;
832+ const request = adapter . buildRequest ( {
833+ modelId : "gpt-5.5" ,
834+ context : { messages : [ ] } ,
835+ stream : true ,
836+ options : { } ,
837+ _rawBody : {
838+ model : "gpt-5.5" ,
839+ input : "hi" ,
840+ prompt_cache_retention : "24h" ,
841+ } ,
842+ } , { headers : new Headers ( { authorization : "Bearer token" } ) } ) ;
843+ const body = JSON . parse ( request . body ) as { prompt_cache_retention ?: string } ;
844+
845+ expect ( body ) . not . toHaveProperty ( "prompt_cache_retention" ) ;
846+ } ) ;
847+
825848 const expandedRawBody = {
826849 model : "gpt-5.5" ,
827850 previous_response_id : "resp_1" ,
0 commit comments