From 240bbfc14ac46e30f56fa4e8c8f1ec34c4bc1cf7 Mon Sep 17 00:00:00 2001 From: ianw-oai Date: Thu, 20 Aug 2026 04:59:20 +0000 Subject: [PATCH] Add max and ultra reasoning efforts to the SDKs (#39662) ## What changed - Add `max` and `ultra` to the TypeScript `ModelReasoningEffort` type. - Add matching Python `ReasoningEffort` members and preserve them when SDK artifacts are regenerated. - Update the Python model-selection examples to rank the new effort levels. ## Testing - Cover serialization of both new Python enum members while continuing to accept unknown future values. GitOrigin-RevId: 1412b77bdbb2530f5d38921cdea971dd34458353 --- .../13_model_select_and_turn_params/async.py | 2 ++ .../13_model_select_and_turn_params/sync.py | 2 ++ sdk/python/scripts/update_sdk_artifacts.py | 2 ++ .../src/openai_codex/generated/v2_all.py | 2 ++ sdk/python/tests/test_client_rpc_methods.py | 18 +++++++++++++----- sdk/typescript/src/threadOptions.ts | 9 ++++++++- 6 files changed, 29 insertions(+), 6 deletions(-) diff --git a/sdk/python/examples/13_model_select_and_turn_params/async.py b/sdk/python/examples/13_model_select_and_turn_params/async.py index d9e706f240..64e0d21f34 100644 --- a/sdk/python/examples/13_model_select_and_turn_params/async.py +++ b/sdk/python/examples/13_model_select_and_turn_params/async.py @@ -28,6 +28,8 @@ REASONING_RANK = { "medium": 3, "high": 4, "xhigh": 5, + "max": 6, + "ultra": 7, } diff --git a/sdk/python/examples/13_model_select_and_turn_params/sync.py b/sdk/python/examples/13_model_select_and_turn_params/sync.py index 4a9afa0980..3cb2bfa868 100644 --- a/sdk/python/examples/13_model_select_and_turn_params/sync.py +++ b/sdk/python/examples/13_model_select_and_turn_params/sync.py @@ -26,6 +26,8 @@ REASONING_RANK = { "medium": 3, "high": 4, "xhigh": 5, + "max": 6, + "ultra": 7, } diff --git a/sdk/python/scripts/update_sdk_artifacts.py b/sdk/python/scripts/update_sdk_artifacts.py index 33dfae57c2..7dc4eddf9f 100755 --- a/sdk/python/scripts/update_sdk_artifacts.py +++ b/sdk/python/scripts/update_sdk_artifacts.py @@ -656,6 +656,8 @@ def _preserve_reasoning_effort_enum(out_path: Path) -> None: medium = "medium" high = "high" xhigh = "xhigh" + max = "max" + ultra = "ultra" @classmethod def _missing_(cls, value: object) -> ReasoningEffort | None: diff --git a/sdk/python/src/openai_codex/generated/v2_all.py b/sdk/python/src/openai_codex/generated/v2_all.py index 46ea852562..68215cfdf6 100644 --- a/sdk/python/src/openai_codex/generated/v2_all.py +++ b/sdk/python/src/openai_codex/generated/v2_all.py @@ -3208,6 +3208,8 @@ class ReasoningEffort(str, Enum): medium = "medium" high = "high" xhigh = "xhigh" + max = "max" + ultra = "ultra" @classmethod def _missing_(cls, value: object) -> ReasoningEffort | None: diff --git a/sdk/python/tests/test_client_rpc_methods.py b/sdk/python/tests/test_client_rpc_methods.py index 075951213f..a6ec750cd3 100644 --- a/sdk/python/tests/test_client_rpc_methods.py +++ b/sdk/python/tests/test_client_rpc_methods.py @@ -2,6 +2,8 @@ from __future__ import annotations from pathlib import Path +import pytest + from openai_codex.client import CodexClient, _params_dict from openai_codex.generated.notification_registry import notification_turn_id from openai_codex.generated.v2_all import ( @@ -73,18 +75,24 @@ def test_plan_type_accepts_business_prolite_from_newer_runtime() -> None: assert rate_limits_updated.payload.rate_limits.plan_type == PlanType(plan_type) -def test_reasoning_effort_preserves_enum_constants_and_accepts_future_values() -> None: +@pytest.mark.parametrize( + ("effort", "wire_value"), + [(ReasoningEffort.max, "max"), (ReasoningEffort.ultra, "ultra")], +) +def test_reasoning_effort_preserves_enum_constants_and_accepts_future_values( + effort: ReasoningEffort, wire_value: str +) -> None: """Known effort members and new runtime values should share the enum-style API.""" known_option = ReasoningEffortOption.model_validate( {"description": "Balanced", "reasoningEffort": "medium"} ) future_option = ReasoningEffortOption.model_validate( - {"description": "Future", "reasoningEffort": "ultra"} + {"description": "Future", "reasoningEffort": "future"} ) turn_params = TurnStartParams( thread_id="thread-1", input=[], - effort=ReasoningEffort.medium, + effort=effort, ) assert { @@ -95,8 +103,8 @@ def test_reasoning_effort_preserves_enum_constants_and_accepts_future_values() - } == { "known_member": "medium", "known_option": "medium", - "future_option": "ultra", - "turn_effort": "medium", + "future_option": "future", + "turn_effort": wire_value, } diff --git a/sdk/typescript/src/threadOptions.ts b/sdk/typescript/src/threadOptions.ts index 7bde5e4d78..0826226747 100644 --- a/sdk/typescript/src/threadOptions.ts +++ b/sdk/typescript/src/threadOptions.ts @@ -2,7 +2,14 @@ export type ApprovalMode = "never" | "on-request" | "on-failure" | "untrusted"; export type SandboxMode = "read-only" | "workspace-write" | "danger-full-access"; -export type ModelReasoningEffort = "minimal" | "low" | "medium" | "high" | "xhigh"; +export type ModelReasoningEffort = + | "minimal" + | "low" + | "medium" + | "high" + | "xhigh" + | "max" + | "ultra"; export type WebSearchMode = "disabled" | "cached" | "live";