You can use OpenRouter with PydanticAI through its OpenAI-compatible interface:
from pydantic_ai import Agentfrom pydantic_ai.models.openai import OpenAIModelmodel = OpenAIModel( "anthropic/claude-sonnet-4.6", # or any other OpenRouter model base_url="https://openrouter.ai/api/v1", api_key="sk-or-...",)agent = Agent(model)result = await agent.run("What is the meaning of life?")print(result)