pydantic-ai v2.51.0 Adds OpenAI GPT-Live Support and Refines AI Model Compatibility
pydantic-ai v2.51.0 introduces support for OpenAI GPT-Live through `OpenAILiveModel` and exposes `context_window_used` on realtime sessions, providing better visibility into token usage. The update also includes compatibility adjustments for Gemini 3.1 Flash Live and 3.8 Live, specifically rejecting dated IDs and raising `RealtimeError` for close codes. Additionally, it improves error handling by raising `UserError` for forced tool calls in OpenAI, Azure OpenAI, and xAI models, alongside several bug fixes.
- →Add OpenAI GPT-Live support with OpenAILiveModel by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8390
- →Reduce RunContext copying overhead in capability hooks by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8775
- →Buffer text deltas in CompletedStreamedResponse replay by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8799
- →Cache the agent graph instead of rebuilding it on every Agent.run() by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8658
Features (2) ›
- Add OpenAI GPT-Live support with OpenAILiveModel by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8390
Expose context_window_used on realtime sessions, from GPT-Live's reported ratio or response usage by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8803
Fixes (6) ›
- Reduce RunContext copying overhead in capability hooks by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8775
Keep provider_details on OpenAI Realtime tool-call responses and the response id on replies cut off by a drop or close() by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8762
- Buffer text deltas in CompletedStreamedResponse replay by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8799
Resend a recent image with a typed Gemini Live turn, which doesn't see video frames by @DouweM in https://github.com/pydantic/pydantic-ai/pull/8756
- Cache the agent graph instead of rebuilding it on every Agent.run() by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8658
Stop spawning a task group when a toolset or capability fan-out has a single child by @Kludex in https://github.com/pydantic/pydantic-ai/pull/8774
https://github.com/pydantic/pydantic-ai/releases/tag/v2.51.0
Related releases
- Google ADK for Python v2.10.0 Boosts Skill Lifecycles, DB Integrations, and Eval Metrics Google ADK (Python) Releases ·
- Pydantic-AI v2.50.0 Introduces DecisionModel and Gemini Realtime Support Pydantic AI Releases ·
- Pydantic AI v2.49.0 Enhances LLM Integrations and Type-Safe Model Handling Pydantic AI Releases ·
- LangChain LangGraph CLI Updates to Version 0.4.32.dev0 LangGraph Releases ·
- LangGraph CLI 0.4.32 Enhances Deployments, Agent Flags, and Addresses Vulnerabilities LangGraph Releases ·
- Pydantic-AI v2.48.0 adds support for new OpenAI and Claude models Pydantic AI Releases ·