Skip to main content

PydanticAI

PydanticAI supports custom OpenAI-compatible providers. Construct an OpenAIChatModel explicitly so requests use Radium’s Chat Completions endpoint.

Before you start

You need Python 3.10 or newer, a Radium API key, and a terminal or PowerShell window.

1. Create a project and install PydanticAI

2. Set your Radium credentials

3. Create main.py

Do not use the shorthand openai:hal-1.0. Constructing OpenAIChatModel explicitly ensures PydanticAI uses the custom Radium provider and Chat Completions endpoint.

4. Run it

Expected output:

Choose a model

Migrate an existing PydanticAI agent

Replace its model/provider configuration:
Your system prompts, dependency types, tools, and output types can remain unchanged.

Troubleshooting

Validation

These instructions were verified with Python 3.12.7 and pydantic-ai-slim[openai]==2.31.1 on August 20, 2026. You do not need that exact package version.
Text generation and tool_plain execution passed with hal-1.0, clarke-1.0, and tycho-1.0.

Next steps

API quickstart

Call Radium directly

Tool calling

The tool_use and tool_result contract