@@ -60,7 +60,6 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
6060 this . client = new OpenAI ( { baseURL : this . options . openAiNativeBaseUrl , apiKey } )
6161 }
6262
63- // Review comment 1: Extract usage normalization helper
6463 private normalizeGpt5Usage ( usage : any , model : OpenAiNativeModel ) : ApiStreamUsageChunk | undefined {
6564 if ( ! usage ) return undefined
6665
@@ -87,7 +86,6 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
8786 }
8887 }
8988
90- // Review comment 3: Deduplicate response ID resolver logic
9189 private resolveResponseId ( responseId : string | undefined ) : void {
9290 if ( responseId ) {
9391 this . lastResponseId = responseId
@@ -362,7 +360,6 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
362360
363361 private formatInputForResponsesAPI ( systemPrompt : string , messages : Anthropic . Messages . MessageParam [ ] ) : string {
364362 // Format the conversation for the Responses API input field
365- // Review comment 8: Add clarifying comment for Developer prefix
366363 // Use Developer role format for GPT-5 (aligning with o1/o3 Developer role usage per GPT-5 Responses guidance)
367364 // This ensures consistent instruction handling across reasoning models
368365 let formattedInput = `Developer: ${ systemPrompt } \n\n`
@@ -1239,6 +1236,13 @@ export class OpenAiNativeHandler extends BaseProvider implements SingleCompletio
12391236 const { id, temperature, reasoning, verbosity } = this . getModel ( )
12401237 const isGpt5 = this . isGpt5Model ( id )
12411238
1239+ if ( isGpt5 ) {
1240+ // GPT-5 uses the Responses API, not Chat Completions. Avoid undefined behavior here.
1241+ throw new Error (
1242+ "completePrompt is not supported for GPT-5 models. Use createMessage (Responses API) instead." ,
1243+ )
1244+ }
1245+
12421246 const params : any = {
12431247 model : id ,
12441248 messages : [ { role : "user" , content : prompt } ] ,
0 commit comments