PydanticAI
PydanticAI supports custom OpenAI-compatible endpoints via its OpenAIProvider.
Install
pip install pydantic-aiConfigure
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIModel
from pydantic_ai.providers.openai import OpenAIProvider
model = OpenAIModel(
"{{selectedModel.id}}",
provider=OpenAIProvider(
base_url="https://api.doubleword.ai/v1",
api_key="{{apiKey}}",
),
)
agent = Agent(model)
result = agent.run_sync("Say hello.")
print(result.output)The base_url is passed directly to the underlying OpenAI client. Use whatever model name is configured in your Control Layer.