在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

2026年1月10日,openai-python迎来了最新版本 v2.15.0。该版本由自动化代码生成系统发布,包含重要的功能更新与内部优化,是一次面向开发者的实用增强升级。以下为详细更新内容及代码层面变化解析。


一、版本概览

  • 版本号: 2.15.0
  • 发布日期: 2026年1月10日
  • 主要提交:
    • feat(api): add new Response completed_at prop
    • chore(internal): codegen related update
    • release: 2.15.0

本次更新共有 3次提交26个文件被修改,由自动化bot完成发布。


二、核心功能更新

1. 新增 Response 的 completed_at 属性

在类型文件 src/openai/types/responses/response.py 中新增了 completed_at 字段,用于表示 Response 完成的时间戳。

completed_at: Optional[float] = None
"""
Unix timestamp (in seconds) of when this Response was completed.
Only present when the status is completed.
"""

这一更新使开发者能够精确追踪响应的完成时间,方便对话记录、系统日志及数据分析。


2. 新增语音模型与语音参数调整

本次版本对多处与语音合成(Speech、ChatCompletion Audio、Realtime Audio)相关的文件进行了改进,统一了语音列表描述方式,并新增了两个新内置声音:
marincedar

更新涉及文件如下:

  • src/openai/resources/audio/speech.py
  • src/openai/types/audio/speech_create_params.py
  • src/openai/types/chat/chat_completion_audio_param.py
  • src/openai/types/realtime/realtime_audio_config_output.py
  • src/openai/types/realtime/realtime_audio_config_output_param.py
  • src/openai/types/realtime/realtime_response_create_audio_output.py
  • src/openai/types/realtime/realtime_response_create_audio_output_param.py

更新后的语音选项包括:

alloy, ash, ballad, coral, echo, fable, onyx, nova, sage, shimmer, verse, marin, cedar

描述也改为统一格式:

Supported built-in voices are … Previews of the voices are available in the Text to Speech guide.

这一优化为语音生成场景提供更多声音选择,显著提升了个性化与音质表现。


3. GPT 图像模型全面升级

src/openai/resources/images.py 中的说明中,新增了 GPT Image 1.5GPT Image 1-mini 模型支持,官方表述修改为:

This endpoint supports GPT Image models (gpt-image-1.5, gpt-image-1, and gpt-image-1-mini) and dall-e-2.

这意味着图像编辑与生成接口的灵活性进一步提升,兼容更多模型版本。


4. 工具选择参数优化(tool_choice)

在多个文件中(如 src/openai/resources/responses/input_tokens.pysrc/openai/types/responses/input_token_count_params.py)重新定义了 tool_choice 字段的描述,使其更为简洁与直观:

由:

How the model should select which tool (or tools) to use when generating a response.

更新为:

Controls which tool the model should use, if any.

这一修改提升了文档清晰度,使开发者更容易理解工具选择机制。


5. 新增加密内容参数(compaction item)

在以下三个文件中增加了对 encrypted_content 字段的说明:

  • src/openai/types/responses/response_compaction_item.py
  • src/openai/types/responses/response_compaction_item_param.py
  • src/openai/types/responses/response_compaction_item_param_param.py

新增描述:

“The encrypted content of the compaction summary.”

此更新用于支持对话压缩(Compaction)项的加密内容描述,增强了安全性与数据完整性。


6. 新增 Code Interpreter 容器内存限制参数

src/openai/types/responses/tool.pysrc/openai/types/responses/tool_param.py 中新增字段:

memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]
"""The memory limit for the code interpreter container."""

开发者可通过该参数控制代码执行容器的内存上限,适用于需要特殊资源占用的任务场景。


7. Web 搜索函数优化与参数扩展

文件:

  • src/openai/types/responses/response_function_web_search.py
  • src/openai/types/responses/response_function_web_search_param.py

更新内容:

  • query 参数标记为 [DEPRECATED]
  • 新增 queries 支持多关键词搜索
  • 增加 sources 字段列表,用于返回搜索来源。

这标志着搜索功能接口设计更趋灵活,兼容多维查询场景。


8. 其他文件变动摘要
  • LICENSE 文件更新年份至 2026。
  • CHANGELOG.md 增加新版本日志与提交记录。
  • pyproject.toml_version.py 版本号提升至 2.15.0。
  • .stats.yml 更新 OpenAPI 规范 URL 与哈希。
  • .release-please-manifest.json 更新标识。

三、内部改进(Chores)

内部代码生成系统进行了更新(代码生成相关),优化了自动化生成流程,确保类型文件同步最新 OpenAPI 规范:

提交记录:

chore(internal): codegen related update

该更新确保整个 Python SDK 与平台 API 规范持续保持一致。


四、总结

代码地址:github.com/openai/openai-python

openai-python v2.15.0 是一次重要的维护与功能增强版本,重点包括:

  • Response新增 completed_at 属性,支持响应结束时间追踪。
  • 语音模型扩展,新增 marin 与 cedar 声音选项。
  • 图像编辑接口支持 GPT Image 1.5 与 mini 模型。
  • 工具选择参数描述简化,文档更清晰。
  • Code Interpreter 增加内存限制设置。
  • Web 搜索功能优化,支持多关键词与来源返回。
  • 系统内部代码生成与OpenAPI规范全面更新。
Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐