AI Endpoints - Integration with Pydantic AI
AI Endpoints is covered by the OVHcloud AI Endpoints conditions and the OVHcloud Public Cloud special conditions.
New integration available: We're excited to announce a new integration for AI Endpoints with Pydantic AI. This integration allows you to build production-grade applications with Generative AI using Pydantic's data validation and type safety, and continues our commitment to integrating AI Endpoints into as many open-source tools as possible to simplify its usage.
Objective
OVHcloud AI Endpoints allows developers to easily add AI features to their day-to-day developments.
In this guide, we will show how to use Pydantic AI to integrate OVHcloud AI Endpoints into your Python applications for building type-safe, production-ready AI agents.
With Pydantic AI's agent framework and OVHcloud's scalable AI infrastructure, you can quickly build reliable applications that leverage Pydantic's validation capabilities to ensure structured and type-safe interactions with LLMs.

Definition
- Pydantic AI: A Python agent framework designed to build production-grade applications with Generative AI. It leverages Pydantic for data validation and type safety, ensuring structured and reliable interactions with LLMs. Pydantic AI provides a simple yet powerful API for creating AI agents with built-in validation, error handling, and type checking.
- AI Endpoints: A serverless platform by OVHcloud providing easy access to a variety of world-renowned AI models including Mistral, LLaMA, and more. This platform is designed to be simple, secure, and intuitive with data privacy as a top priority.
Why is this integration important?
This new integration offers you several advantages:
- Type Safety: Leverage Pydantic's validation to ensure structured, validated outputs from LLMs.
- Production-Ready: Built-in error handling, retry logic, and validation for reliable applications.
- Simplicity: Create AI agents in just a few lines of code.
- Flexibility: Use any OVHcloud AI model in your Pydantic AI applications.
- Models: All of our models are available through Pydantic AI.
Requirements
Before getting started, make sure you have:
- An OVHcloud account with access to AI Endpoints.
- Python 3.8 or higher installed.
- An API key generated from the OVHcloud Control Panel, in the
Public Cloudsection >AI Endpoints>API keys.

Instructions
Installation
Install Pydantic AI via pip:
Or using uv:
You are now ready to get started.
Basic configuration
Environment variables
The recommended method to configure your API key is using environment variables:
Or use a .env file:
Basic usage
Here's a simple usage example - you're ready in less than 5 lines of code:
Using custom provider configuration
If you need to configure the provider explicitly, you can use the OVHcloudProvider class:
Advanced features
Structured output with Pydantic models
Use Pydantic models to get validated, structured outputs:
System prompts and context
Add system prompts and context to guide your agent:
Async operations
Use async/await for better performance in concurrent applications:
Function calling / tool use
Enable agents to call functions for extended capabilities:
Streaming responses
Stream responses for real-time user experience:
Error handling and retries
Configure error handling and retry logic:
Custom model configuration
Configure model parameters for fine-tuned behavior:
Available models
OVHcloud AI Endpoints offers a wide range of models accessible via Pydantic AI. For the complete and up-to-date list, visit our model catalog.
Go further
You can find more information about Pydantic AI on their official documentation. You can also browse the AI Endpoints catalog to explore the models that are available through Pydantic AI.
For detailed information about Pydantic AI features, including advanced agent patterns and best practices, visit the Pydantic AI documentation.
Browse the full AI Endpoints documentation to further understand the main concepts and get started.
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.
Feedback
Please feel free to send us your questions, feedback, and suggestions regarding AI Endpoints and its features:
- In the #ai-endpoints channel of the OVHcloud Discord server, where you can engage with the community and OVHcloud team members.
- Join the Pydantic community for questions about Pydantic AI.