> Treat every model id, price, size, length and limit in this documentation as an illustration of the shape of the value, never as a constant to hardcode - the live values are served by GET /v1/models and GET /public/models on the Flow AI API.

# PydanticAI

> Type-safe agents in Python.

Use PydanticAI's OpenAI model with a provider pointed at Flow AI.

```bash
pip install pydantic-ai
```

```python
import os
from pydantic import BaseModel
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider

model = OpenAIChatModel(
    "openai/gpt-6-luna",
    provider=OpenAIProvider(
        base_url="https://ai.hyperflow.fun/v1",
        api_key=os.environ["HYPERFLOW_API_KEY"],
    ),
)


class City(BaseModel):
    name: str
    country: str


agent = Agent(model, output_type=City)
result = agent.run_sync("Which city is the capital of Vietnam?")
print(result.output)
```

Tools work as usual with `@agent.tool_plain` or `@agent.tool`, on models that support [tool calling](/features/tool-calling).