useResponsesAPI method

OpenAIBuilder useResponsesAPI([
  1. bool use = true
])

Enables the new Responses API instead of Chat Completions API

The Responses API combines the simplicity of Chat Completions with the tool-use capabilities of the Assistants API. It supports built-in tools like web search, file search, and computer use.

Example:

final provider = await ai()
    .openai((openai) => openai
        .useResponsesAPI()
        .webSearchTool())
    .apiKey(apiKey)
    .model('gpt-4o')
    .build();

Implementation

OpenAIBuilder useResponsesAPI([bool use = true]) {
  _baseBuilder.extension('useResponsesAPI', use);
  return this;
}