PydanticAI on Mingles Router

Run PydanticAI on Mingles Router

PydanticAI separates the model from the provider, so pointing it somewhere else is one object.

Pick your model and paste your key — every command and value on this page updates live.

Endpoint: https://router.mingles.ai/v1 · key stays in your browser · no key entered? commands show <your-key>.

Wire it up

1. Build the model

The provider carries the endpoint; the model carries the id:

python
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.openai import OpenAIProvider

model = OpenAIChatModel(
    "deepseek-ai/DeepSeek-V4-Flash-0731",
    provider=OpenAIProvider(
        base_url="https://router.mingles.ai/v1",
        api_key="<your-key>",
    ),
)

agent = Agent(model)
print(agent.run_sync("Hello").output)

Use OpenAIChatModel, not OpenAIResponsesModel — the latter targets the Responses API, which we do not implement.

2. Or configure it from the environment

shell
export OPENAI_BASE_URL="https://router.mingles.ai/v1"
export OPENAI_API_KEY="<your-key>"

3. Typed output works as normal

Structured output is built on tool calling, which we serve:

python
from pydantic import BaseModel

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

agent = Agent(model, output_type=City)
print(agent.run_sync("The capital of France").output)

Exact values

base_url https://router.mingles.ai/v1
api_key <your-key>
model deepseek-ai/DeepSeek-V4-Flash-0731

Switch model

Swap the string in OpenAIChatModel to change models — the provider object stays the same.

Before you file a bug: read the limits

Reasoning models spend the output budget on internal thinking, output is capped at 8192 tokens, there is no KV cache, and there are no built-in web tools. Most “it broke on Mingles Router” reports are one of these. See Model limits & behavior →

Frequently asked

The docs mention OpenAIModel — is that the same thing? +

That was the earlier name. Current PydanticAI uses OpenAIChatModel for the chat-completions API and OpenAIResponsesModel for the Responses API. Use the chat one here.

Does structured output work? +

Yes. PydanticAI implements it through tool calling, which is part of the chat-completions format.