官方更新 OpenAI Codex Releases 2026-09-10T19:51 正文 ok 224 words

OpenAI Codex Python SDK 0.154.0 发布

英文标题:OpenAI Codex Python SDK 0.154.0

OpenAI 发布了 openai-codex Python SDK 0.154.0,要求 Python 3.10 或更高版本,并配套提供 openai-codex-cli-bin 0.154.0 运行时。该版本新增 `max` 和 `ultra` 推理强度选项,并让同步和异步的 `run()`、`turn()` 调用支持 `ExternalMessage`。更新还加入了恢复或分叉线程时的历史选择、单轮服务层级及来源元数据等能力。开发者升级时需调整 `HookMetadata` 访问方式、通知负载读取逻辑,以及对回合句柄事件历史的处理。
打开原文相关 11 · 机会 2
media3.6 KB media63.9 KB

中文

使用 pip install --upgrade openai-codex==0.154.0 安装(要求 Python 3.10 或更高版本)。此版本包含配套的 openai-codex-cli-bin==0.154.0 运行时。

  • 新增 max 和 ultra 推理强度值。#39662
  • 为同步和异步 run() 及 turn() 调用新增 ExternalMessage。外部内容可以启动一个回合,或以工具级权限加入一个正在进行的常规回合;它不会授予用户授权。消费者会收到彼此独立的事件流。#44086
  • 在恢复/分叉操作中新增 include_turns,为一个新启动的回合新增 turn_service_tier,并新增 source 元数据。历史记录选择会改变返回的响应,而不会改变模型上下文。省略这些选项时,将保留现有默认行为。#44084
  • 更新自动生成的协议模型和通知,并保留在回合启动响应之前到达的完成事件。#44032、#44400

升级时请检查以下迁移事项:

  • HookMetadata 现在将其处理器封装在 .root 中。将诸如 hook.command 的访问方式替换为 hook.root.command,并在读取特定于处理器的字段前检查 hook.root.handler_type。
  • 此前一些未知通知现在具有类型化负载。请读取具名字段,而非 .params;未知或无效的负载仍使用 UnknownNotification。
  • 手动构造或中途加入的回合句柄,会从其附加点开始接收事件。此前输出不会被重放,因此收集到的结果可能不完整;在完成后附加可能引发 TransportClosedError。如需读取已保存的历史记录,请使用 thread.read(include_turns=True)。由 thread.turn(...) 直接返回的句柄会保留从其请求发送时开始的事件。

自定义 codex_bin 覆盖配置如需使用 ExternalMessage 以及新的历史记录/单回合选项,要求 CLI 版本为 0.151.0 或更高。

English / 原文

Install with pip install --upgrade openai-codex==0.154.0 (Python 3.10 or later). This release includes the matching openai-codex-cli-bin==0.154.0 runtime.

  • Add max and ultra reasoning-effort values. #39662
  • Add ExternalMessage to synchronous and asynchronous run() and turn() calls. External content can start a turn or join an active regular turn with tool-level authority; it does not grant user authorization. Consumers receive independent event streams. #44086
  • Add include_turns on resume/fork, turn_service_tier for one newly started turn, and source metadata. History selection changes the returned response, not model context. Existing defaults are preserved when these options are omitted. #44084
  • Refresh generated protocol models and notifications, and preserve completion events that arrive before a turn-start response. #44032, #44400

Check these migrations when upgrading:

  • HookMetadata wraps its handler in .root. Replace accesses such as hook.command with hook.root.command, checking hook.root.handler_type before reading handler-specific fields.
  • Some previously unknown notifications now have typed payloads. Read named fields instead of .params; unknown or invalid payloads still use UnknownNotification.
  • Manually constructed or late-joining turn handles receive events from their attachment point. Earlier output is not replayed, so collected results can be partial; attaching after completion can raise TransportClosedError. Use thread.read(include_turns=True) for saved history. Handles returned directly by thread.turn(...) retain events from when their request is sent.

Custom codex_bin overrides require CLI 0.151.0 or newer for ExternalMessage and the new history/per-turn options.