Support GPT-5 (Responses API) + reasoning controls #1843
      
        
          +299
        
        
          −158
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Summary
Adds GPT-5 support using the new
responses.create(...)API and keeps all existing GPT-4 / GPT-3.5 behavior working.Key changes
Added
responses_completion()inbase.pyand updatedcall()to route automatically:gpt-5,gpt-5-mini,gpt-5-nano, etc.) → Responses APIAdded
_is_responses_model/_is_responses_api_like()to detect GPT-5 models.Added new parameters for reasoning models:
reasoning_effortverbositymax_output_tokensEnsured GPT-5 requests do not send
temperature,top_p,logprobs, etc. (unsupported on reasoning models).Added
_responses_paramsinbase.pyto buildreasoning.effort,text.verbosity, andmax_output_tokens.Updated
openai.py:root_client = openai.OpenAI(...)_supported_responses_models = ["gpt-5", "gpt-5-mini", "gpt-5-nano"]self.responses_client = root_client.responses_is_responses_model = TrueUpdated
azure_openai.py:responses_clientBackward compatibility
temperature,top_p, etc.).reasoning_effort="minimal"andverbosity="low"as recommended in the migration guide.Important
Adds GPT-5 support using the Responses API, updates routing logic in
base.py, and enhancesOpenAIandAzureOpenAIclasses for new model handling.responses_completion()inbase.pyfor GPT-5 models using the Responses API.call()inbase.pyto route requests based on model type: GPT-5 to Responses API, GPT-4/3.5 to Chat Completions API, and legacy instruct to Completions API._is_responses_modeland_is_responses_api_like()inbase.pyto identify GPT-5 models.temperatureandtop_p.reasoning_effort,verbosity, andmax_output_tokensfor GPT-5 models inbase.py._responses_paramsinbase.pyto handle new parameters for the Responses API.OpenAIandAzureOpenAIto support GPT-5 models and Responses API.responses_clientinopenai.pyandazure_openai.pyfor handling GPT-5 requests.test_openai.py.This description was created by for 3380cb9. You can customize this summary. It will automatically update as commits are pushed.
 for 3380cb9. You can customize this summary. It will automatically update as commits are pushed.