---
name: choose-a-model
description: Choose a language model for a Pydantic AI agent, or look up model prices, context windows, benchmark scores and Pydantic AI model strings, from the Pydantic AI Model Registry API. Use when writing or changing an agent and deciding which model to use, comparing models, or checking what a model costs.
---

# Choose a model for a Pydantic AI agent

The [Pydantic AI Model Registry](https://pydantic.dev/models/) has prices, benchmark scores and the Pydantic AI model string for every model Pydantic AI can use.
Get the answer from its API. It needs no key. Do not choose a model from memory: prices and the models on offer change monthly.

## Which endpoint

- **Which model should this agent use?** `GET https://pydantic.dev/models/api/select?description=<what the agent does>`, or a POST with the agent's code and system prompt as a JSON body. It returns up to five models, best first, with reasons, a score out of 100, prices and model strings. It usually takes under 30 seconds, up to a minute.
- **What is the model called X?** `GET https://pydantic.dev/models/api/search?query=<text>`. It matches names, slugs and model strings, not descriptions.
- **Which models meet a constraint?** `GET https://pydantic.dev/models/api/models`, for example `?weights=open&max_price=2&sort=efficiency`.
- **Everything on one model.** `GET https://pydantic.dev/models/api/models/<slug>`: every provider's price and model string, benchmarks and example code.
- **Any other question about the models.** `GET https://pydantic.dev/models/api/ask?query=<question>`. An agent answers in a few sentences from the registry's data. It takes a few seconds.

Add `intent` (what you're trying to achieve, in natural language), `stack` (the language/framework context you are working in), `harness` (the agent harness and model you are running) to the query string of all but the single model.

```bash
curl -s 'https://pydantic.dev/models/api/select?intent=choose+a+model+for+a+support+agent&stack=python,pydantic-ai&harness=claude-code' \
  -H 'Content-Type: application/json' \
  -d '{"description": "Answers customer questions from our help centre and escalates refund requests", "price_appetite": 3}'

curl -s 'https://pydantic.dev/models/api/search?query=opus&intent=<intent>&stack=<stack>&harness=<harness>'

curl -s 'https://pydantic.dev/models/api/models?weights=open&max_price=2&sort=efficiency&limit=10&intent=<intent>&stack=<stack>&harness=<harness>'

curl -s https://pydantic.dev/models/api/models/claude-opus-5.5

curl -s 'https://pydantic.dev/models/api/ask?query=Which+open-weight+model+has+the+largest+context+window%3F&intent=<intent>&stack=<stack>&harness=<harness>'
```

The `GET` endpoints return JSON, or a Markdown table for `format=md`. An `OPTIONS` request to an endpoint returns its schema.
The same five operations are tools of the MCP server at `https://pydantic.dev/models/mcp` (Streamable HTTP, no key).

## Using the answer

1. For `/models/api/select`, describe the agent: what it does, its tools, who uses it and how often. Send its code too where there is one, and its real system prompt as `system_prompt`. Set `price_appetite` from 1 (the cheapest model that works) to 5 (the best available), `latency: true` for an interactive agent, and `weights: "open"` when the model must be open-weight.
2. Take the `string` of the chosen model, such as `gateway/anthropic:claude-sonnet-5-5`, and pass it to `Agent(...)`. A `gateway/` string needs a Pydantic AI Gateway key; `/models/api/models/<slug>` lists the string for each other provider under `offers`.
3. Tell the user which model you chose, the first reason the selector gave, and its input and output price per million tokens. Give the second choice if it is much cheaper.
4. If `recommendations` is empty, `more_input` says what the selector needs; send that.

More: [usage.md](https://pydantic.dev/models/usage.md). This file: [SKILL.md](https://pydantic.dev/models/.well-known/agent-skills/choose-a-model/SKILL.md)
