Caveman
Framework integrationsPydantic AI

Pydantic AI

Any Pydantic AI provider class that takes a base_url routes through the gateway. Wire the provider into a model and hand it to your Agent.

Pydantic AI
import os
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider

model = OpenAIChatModel(
"gpt-4.1",
provider=OpenAIProvider(
base_url="http://127.0.0.1:8787/w/my-service/openai/v1",
api_key=os.environ["OPENAI_API_KEY"],
),
)

agent = Agent(model)
result = agent.run_sync("Why is the sky blue?")

Any provider class that takes base_url routes through the gateway.

Local vs. connected

The base URL above is the local proxy default (http://127.0.0.1:8787). Connected or managed use swaps in the cloud gateway URL and adds x-cave-api-key (gateway auth) plus x-cave-upstream-key (your per-request provider key) as request headers on the same client.