Airflow Summit 2026 is coming August 31 - September 2 in Austin, TX. Register now to secure your spot!

Pydantic AI Connection

The Pydantic AI connection type configures access to LLM providers via the pydantic-ai framework. A single connection type works with any provider that pydantic-ai supports: OpenAI, Anthropic, Google, Bedrock, Groq, Mistral, Ollama, vLLM, and others.

Default Connection IDs

The PydanticAIHook uses pydanticai_default by default.

Configuring the Connection

Model

The model identifier in provider:model format. This field appears as a dedicated input in the connection form (via conn-fields) and stores its value in extra["model"].

Examples: openai:gpt-5.6-sol, anthropic:claude-sonnet-5, bedrock:us.anthropic.claude-opus-4-6-v1:0, google:gemini-2.0-flash

See Anthropic’s models overview for the current list of Claude model IDs across the Claude API, Amazon Bedrock, and Google Cloud. See OpenAI’s models reference for the current list of OpenAI model IDs.

The model can also be overridden at the hook/operator level via the model_id parameter.

API Key (Password field)

The API key for your LLM provider. Required for API-key-based providers (OpenAI, Anthropic, Groq, Mistral). Leave empty for providers using environment-based auth (Bedrock via AWS_PROFILE, Vertex via GOOGLE_APPLICATION_CREDENTIALS).

Host (optional)

Base URL for the provider’s API. Only needed for custom endpoints:

  • Ollama: http://localhost:11434/v1

  • vLLM: http://localhost:8000/v1

  • Azure OpenAI: https://<resource>.openai.azure.com/openai/deployments/<deployment>

  • Any OpenAI-compatible API: the base URL of that service

Extra (JSON, optional)

A JSON object with additional configuration. Programmatic users can set the model directly in extra:

{"model": "openai:gpt-5.6-sol"}

When using the UI, the “Model” field above writes to this same location automatically.

Examples

OpenAI

{
    "conn_type": "pydanticai",
    "password": "sk-...",
    "extra": "{\"model\": \"openai:gpt-5.6-sol\"}"
}

Anthropic

{
    "conn_type": "pydanticai",
    "password": "sk-ant-...",
    "extra": "{\"model\": \"anthropic:claude-opus-4-6\"}"
}

Ollama (local)

{
    "conn_type": "pydanticai",
    "host": "http://localhost:11434/v1",
    "extra": "{\"model\": \"openai:llama3\"}"
}

AWS Bedrock

Leave password empty and configure AWS_PROFILE or IAM role in the environment:

{
    "conn_type": "pydanticai",
    "extra": "{\"model\": \"bedrock:us.anthropic.claude-opus-4-6-v1:0\"}"
}

This still works — the bedrock: model prefix and the environment-variable credential chain are unchanged. For AWS-specific fields with dedicated UI inputs (region, IAM keys, profile, bearer token, timeouts) instead of raw extra JSON, use the Pydantic AI (AWS Bedrock) Connection connection type.

Google Vertex AI / Gemini API

Leave password empty and configure GOOGLE_API_KEY (or GEMINI_API_KEY) in the environment:

{
    "conn_type": "pydanticai",
    "extra": "{\"model\": \"google:gemini-2.0-flash\"}"
}

This connects to the Gemini API (Google AI Studio), not Vertex AI — pydantic-ai’s plain google: provider only reads an API key (GOOGLE_API_KEY/GEMINI_API_KEY); it does not fall back to GOOGLE_APPLICATION_CREDENTIALS or any other Application Default Credentials source. For project/location-scoped Vertex AI access — service account or Application Default Credentials — use the Pydantic AI (Google Vertex AI) Connection connection type with a google-cloud: model prefix instead.

Model Resolution Order

The hook reads the model from these sources in priority order:

  1. model_id parameter on the hook/operator

  2. model in the connection’s extra JSON (set by the “Model” conn-field in the UI)

Was this entry helpful?