PydanticAI v2.23.0 发布:新增成本限制与工具可用性支持
原标题:v2.23.0 (2026-08-03)
AI 摘要
PydanticAI 发布 v2.23.0 版本,新增了 Bedrock 对 ModelSettings.extra_headers 的支持、恢复 gemini-3-pro-image 和 gemini-3.1-flash-image 网关别名、在 RunUsage 中添加 cost 字段及 UsageLimits 中添加 cost_limit,并新增 ToolAvailabilityDeltaPart 以原生渲染工具添加。同时修复了多个 bug,包括 bedrock_max_concurrency 死锁、GoogleCloudProvider 凭据作用域和 ADC 环境变量泄漏、OpenAI 流式响应中 created 时间戳读取等问题。
正文节选
<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🚀 Features * Add Bedrock support for `ModelSettings.extra_headers` by @kkauy in https://github.com/pydantic/pydantic-ai/pull/4825 * Restore stable `gemini-3-pro-image` and `gemini-3.1-flash-image` Gateway aliases by @adtyavrdhn in https://github.com/pydantic/pydantic-ai/pull/7069 * Add `cost` to `RunUsage` and `cost_limit` to `UsageLimits` by @Kludex in https://github.com/pydantic/pydantic-