发布日期: 2026-09-10
版本号: python-v0.154.0

使用 pip install –upgrade openai-codex==0.154.0 安装(需要 Python 3.10 或更高版本)。这个版本包含与之匹配的 openai-codex-cli-bin==0.154.0 运行时。本版新增 max 和 ultra 两档推理强度。同步和异步的 run() 与 turn() 调用新增 ExternalMessage,外部内容可以开启一轮对话,或以工具级权限加入正在进行的普通对话,但它不授予用户授权;使用方会收到独立的事件流。恢复或分叉时新增 include_turns,新增用于单次新开启对话的 turn_service_tier,并新增 source 元数据;历史选择只改变返回的响应内容,不改变模型上下文,省略这些选项时保持原有默认行为。此外刷新了自动生成的协议模型与通知,并保留那些在 turn 启动响应之前到达的完成事件。升级时需要注意几处迁移:HookMetadata 把它的处理器包在 .root 里,原先的 hook.command 这类访问要改成 hook.root.command,并在读取处理器专属字段前先检查 hook.root.handler_type;部分原本未知的通知现在有了具体类型的载荷,应读取具名字段而不是 .params,未知或无效载荷仍归为 UnknownNotification;手动构造或中途加入的对话句柄只能收到从加入那个时刻起的事件,更早的输出不会被重放,因此收集到的结果可能是部分的,在完成之后才附加还可能抛出 TransportClosedError,如果要已保存的历史,应使用 thread.read(include_turns=True),而由 thread.turn(…) 直接返回的句柄仍会保留请求发出时起的事件。如自定义 codex_bin 覆盖,则要求 CLI 0.151.0 或更高版本,以支持 ExternalMessage 和新的历史选项和单轮选项。

更新内容 (中文)

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

  • 新增 max 和 ultra 两档推理强度(reasoning-effort)取值。#39662
  • 在同步与异步的 run() 和 turn() 调用中新增 ExternalMessage。外部内容可以开启一个回合,或以工具级权限加入正在进行的常规回合;它不授予用户授权。消费方会收到独立的事件流。#44086
  • 在 resume/fork 上新增 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 覆盖需要 CLI 0.151.0 或更高版本,才能支持 ExternalMessage 以及新的历史记录/单回合选项。

更新内容 (原始)

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.

下载链接