> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trynito.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Pydantic AI

> The OpenAI chat model, pointed at Nito.

```python lines wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
# pip install pydantic-ai
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider

model = OpenAIChatModel(
    "moonshotai/kimi-k3",                                    # a Nito catalog ID, fetch from GET /v1/models
    provider=OpenAIProvider(
        api_key="z_sk_your_key_here",              # your Nito API key
        base_url="https://app.trynito.ai/v1",  # Nito's OpenAI-compatible base URL
    ),
)

agent = Agent(model)
result = agent.run_sync("Say hello in one short sentence.")
print(result.output)
```

`OpenAIChatModel` speaks Chat Completions, which is what every OpenAI-compatible provider in Pydantic AI uses. The `OPENAI_BASE_URL` and `OPENAI_API_KEY` environment variables are the alternative to passing `base_url` and `api_key`.

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
"z-ai/glm-5.2:confidential"
```

## Privacy

Use a catalog ID, not an OpenAI name. For attested hardware use a `:confidential` variant; `GET /v1/models` lists their `:confidential` IDs. Encrypted needs client-side encryption and extra headers, which these frameworks do not add. See [Privacy Levels](/privacy/levels).

## Related

<CardGroup cols={3}>
  <Card title="Framework Integrations" icon="link" href="/api/sdks/framework-integrations">
    The shared pattern.
  </Card>

  <Card title="OpenAI Compatibility" icon="arrows-left-right" href="/api/sdks/openai-drop-in/compatibility-notes">
    What differs.
  </Card>

  <Card title="Privacy Levels" icon="file-shield" href="/privacy/levels">
    The four levels.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.