feat(providers): add GPT-5 model family support for OpenAI provider

Enable GPT-5 models (gpt-5, gpt-5.4, gpt-5.4-mini, etc.) to work
correctly with the OpenAI-compatible provider by:

- Setting `supports_max_completion_tokens=True` on the OpenAI provider
  spec so `max_completion_tokens` is sent instead of the deprecated
  `max_tokens` parameter that GPT-5 rejects.
- Adding `_supports_temperature()` to conditionally omit the
  `temperature` parameter for reasoning models (o1/o3/o4) and when
  `reasoning_effort` is active, matching the existing Azure provider
  behaviour.

Both changes are backward-compatible: older GPT-4 models continue to
work as before since `max_completion_tokens` is accepted by all recent
OpenAI models and temperature is only omitted when reasoning is active.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
UbuntuandClaude Opus 4.6 authored and Xubin Ren committed 2026-04-04 20:18:22 +08:00
1 parent 11c84f21a6
commit 7dc8c9409c
2 files changed
+21 -1

No files matched your search

+1
View File
@@ -200,6 +200,7 @@ PROVIDERS: tuple[ProviderSpec, ...] = (
env_key="OPENAI_API_KEY",
display_name="OpenAI",
backend="openai_compat",
supports_max_completion_tokens=True,
),
# OpenAI Codex: OAuth-based, dedicated provider
ProviderSpec(