[ Skip to content ](https://ai.pydantic.dev/api/models/base/#pydantic_aimodels)
**Join us at the inaugural PyAI Conf in San Francisco on March 10th![Learn More](https://pyai.events/?utm_source=pydantic-ai) **
[ ![logo](https://ai.pydantic.dev/img/logo-white.svg) ](https://ai.pydantic.dev/ "Pydantic AI")
Pydantic AI
pydantic_ai.models
Type to start searching
[ pydantic/pydantic-ai
  * v1.63.0
  * 15.1k
  * 1.7k

](https://github.com/pydantic/pydantic-ai "Go to repository")
[ ![logo](https://ai.pydantic.dev/img/logo-white.svg) ](https://ai.pydantic.dev/ "Pydantic AI") Pydantic AI
[ pydantic/pydantic-ai
  * v1.63.0
  * 15.1k
  * 1.7k

](https://github.com/pydantic/pydantic-ai "Go to repository")
  * [ Pydantic AI  ](https://ai.pydantic.dev/)
  * [ Installation  ](https://ai.pydantic.dev/install/)
  * [ Getting Help  ](https://ai.pydantic.dev/help/)
  * [ Troubleshooting  ](https://ai.pydantic.dev/troubleshooting/)
  * [ Pydantic AI Gateway  ](https://ai.pydantic.dev/gateway/)
  * Documentation
    * Core Concepts
      * [ Agents  ](https://ai.pydantic.dev/agent/)
      * [ Dependencies  ](https://ai.pydantic.dev/dependencies/)
      * [ Function Tools  ](https://ai.pydantic.dev/tools/)
      * [ Output  ](https://ai.pydantic.dev/output/)
      * [ Messages and chat history  ](https://ai.pydantic.dev/message-history/)
      * [ Direct Model Requests  ](https://ai.pydantic.dev/direct/)
    * Models & Providers
      * [ Overview  ](https://ai.pydantic.dev/models/overview/)
      * [ OpenAI  ](https://ai.pydantic.dev/models/openai/)
      * [ Anthropic  ](https://ai.pydantic.dev/models/anthropic/)
      * [ Google  ](https://ai.pydantic.dev/models/google/)
      * [ xAI  ](https://ai.pydantic.dev/models/xai/)
      * [ Bedrock  ](https://ai.pydantic.dev/models/bedrock/)
      * [ Cerebras  ](https://ai.pydantic.dev/models/cerebras/)
      * [ Cohere  ](https://ai.pydantic.dev/models/cohere/)
      * [ Groq  ](https://ai.pydantic.dev/models/groq/)
      * [ Hugging Face  ](https://ai.pydantic.dev/models/huggingface/)
      * [ Mistral  ](https://ai.pydantic.dev/models/mistral/)
      * [ OpenRouter  ](https://ai.pydantic.dev/models/openrouter/)
      * [ Outlines  ](https://ai.pydantic.dev/models/outlines/)
    * Tools & Toolsets
      * [ Function Tools  ](https://ai.pydantic.dev/tools/)
      * [ Advanced Tool Features  ](https://ai.pydantic.dev/tools-advanced/)
      * [ Toolsets  ](https://ai.pydantic.dev/toolsets/)
      * [ Deferred Tools  ](https://ai.pydantic.dev/deferred-tools/)
      * [ Built-in Tools  ](https://ai.pydantic.dev/builtin-tools/)
      * [ Common Tools  ](https://ai.pydantic.dev/common-tools/)
      * [ Third-Party Tools  ](https://ai.pydantic.dev/third-party-tools/)
    * Advanced Features
      * [ Image, Audio, Video & Document Input  ](https://ai.pydantic.dev/input/)
      * [ Thinking  ](https://ai.pydantic.dev/thinking/)
      * [ HTTP Request Retries  ](https://ai.pydantic.dev/retries/)
    * MCP
      * [ Overview  ](https://ai.pydantic.dev/mcp/overview/)
      * [ Client  ](https://ai.pydantic.dev/mcp/client/)
      * [ FastMCP Client  ](https://ai.pydantic.dev/mcp/fastmcp-client/)
      * [ Server  ](https://ai.pydantic.dev/mcp/server/)
    * [ Multi-Agent Patterns  ](https://ai.pydantic.dev/multi-agent-applications/)
    * [ Web Chat UI  ](https://ai.pydantic.dev/web/)
    * [ Embeddings  ](https://ai.pydantic.dev/embeddings/)
    * [ Testing  ](https://ai.pydantic.dev/testing/)
  * Pydantic Evals
    * [ Overview  ](https://ai.pydantic.dev/evals/)
    * Getting Started
      * [ Quick Start  ](https://ai.pydantic.dev/evals/quick-start/)
      * [ Core Concepts  ](https://ai.pydantic.dev/evals/core-concepts/)
    * Evaluators
      * [ Overview  ](https://ai.pydantic.dev/evals/evaluators/overview/)
      * [ Built-in Evaluators  ](https://ai.pydantic.dev/evals/evaluators/built-in/)
      * [ LLM Judge  ](https://ai.pydantic.dev/evals/evaluators/llm-judge/)
      * [ Custom Evaluators  ](https://ai.pydantic.dev/evals/evaluators/custom/)
      * [ Report Evaluators  ](https://ai.pydantic.dev/evals/evaluators/report-evaluators/)
      * [ Span-Based  ](https://ai.pydantic.dev/evals/evaluators/span-based/)
    * How-To Guides
      * [ Logfire Integration  ](https://ai.pydantic.dev/evals/how-to/logfire-integration/)
      * [ Dataset Management  ](https://ai.pydantic.dev/evals/how-to/dataset-management/)
      * [ Dataset Serialization  ](https://ai.pydantic.dev/evals/how-to/dataset-serialization/)
      * [ Concurrency & Performance  ](https://ai.pydantic.dev/evals/how-to/concurrency/)
      * [ Multi-Run Evaluation  ](https://ai.pydantic.dev/evals/how-to/multi-run/)
      * [ Retry Strategies  ](https://ai.pydantic.dev/evals/how-to/retry-strategies/)
      * [ Metrics & Attributes  ](https://ai.pydantic.dev/evals/how-to/metrics-attributes/)
    * Examples
      * [ Simple Validation  ](https://ai.pydantic.dev/evals/examples/simple-validation/)
  * Pydantic Graph
    * [ Overview  ](https://ai.pydantic.dev/graph/)
    * [ Beta API  ](https://ai.pydantic.dev/graph/beta/)
      * [ Steps  ](https://ai.pydantic.dev/graph/beta/steps/)
      * [ Joins & Reducers  ](https://ai.pydantic.dev/graph/beta/joins/)
      * [ Decisions  ](https://ai.pydantic.dev/graph/beta/decisions/)
      * [ Parallel Execution  ](https://ai.pydantic.dev/graph/beta/parallel/)
  * Integrations
    * [ Debugging & Monitoring with Pydantic Logfire  ](https://ai.pydantic.dev/logfire/)
    * Durable Execution
      * [ Overview  ](https://ai.pydantic.dev/durable_execution/overview/)
      * [ Temporal  ](https://ai.pydantic.dev/durable_execution/temporal/)
      * [ DBOS  ](https://ai.pydantic.dev/durable_execution/dbos/)
      * [ Prefect  ](https://ai.pydantic.dev/durable_execution/prefect/)
    * UI Event Streams
      * [ Overview  ](https://ai.pydantic.dev/ui/overview/)
      * [ AG-UI  ](https://ai.pydantic.dev/ui/ag-ui/)
      * [ Vercel AI  ](https://ai.pydantic.dev/ui/vercel-ai/)
    * [ Agent2Agent (A2A)  ](https://ai.pydantic.dev/a2a/)
  * Related Packages
    * [ clai  ](https://ai.pydantic.dev/cli/)
  * Examples
    * [ Setup  ](https://ai.pydantic.dev/examples/setup/)
    * Getting Started
      * [ Pydantic Model  ](https://ai.pydantic.dev/examples/pydantic-model/)
      * [ Weather agent  ](https://ai.pydantic.dev/examples/weather-agent/)
    * Conversational Agents
      * [ Chat App with FastAPI  ](https://ai.pydantic.dev/examples/chat-app/)
      * [ Bank support  ](https://ai.pydantic.dev/examples/bank-support/)
    * Data & Analytics
      * [ SQL Generation  ](https://ai.pydantic.dev/examples/sql-gen/)
      * [ Data Analyst  ](https://ai.pydantic.dev/examples/data-analyst/)
      * [ RAG  ](https://ai.pydantic.dev/examples/rag/)
    * Streaming
      * [ Stream markdown  ](https://ai.pydantic.dev/examples/stream-markdown/)
      * [ Stream whales  ](https://ai.pydantic.dev/examples/stream-whales/)
    * Complex Workflows
      * [ Flight booking  ](https://ai.pydantic.dev/examples/flight-booking/)
      * [ Question Graph  ](https://ai.pydantic.dev/examples/question-graph/)
    * Business Applications
      * [ Slack Lead Qualifier with Modal  ](https://ai.pydantic.dev/examples/slack-lead-qualifier/)
    * UI Examples
      * [ Agent User Interaction (AG-UI)  ](https://ai.pydantic.dev/examples/ag-ui/)
  * API Reference
    * pydantic_ai
      * [ pydantic_ai.ag_ui  ](https://ai.pydantic.dev/api/ag_ui/)
      * [ pydantic_ai.agent  ](https://ai.pydantic.dev/api/agent/)
      * [ pydantic_ai.builtin_tools  ](https://ai.pydantic.dev/api/builtin_tools/)
      * [ pydantic_ai.common_tools  ](https://ai.pydantic.dev/api/common_tools/)
      * [ pydantic_ai — Concurrency  ](https://ai.pydantic.dev/api/concurrency/)
      * [ pydantic_ai.direct  ](https://ai.pydantic.dev/api/direct/)
      * [ pydantic_ai.durable_exec  ](https://ai.pydantic.dev/api/durable_exec/)
      * [ pydantic_ai.embeddings  ](https://ai.pydantic.dev/api/embeddings/)
      * [ pydantic_ai.exceptions  ](https://ai.pydantic.dev/api/exceptions/)
      * [ pydantic_ai.ext  ](https://ai.pydantic.dev/api/ext/)
      * [ pydantic_ai.format_prompt  ](https://ai.pydantic.dev/api/format_prompt/)
      * [ pydantic_ai.mcp  ](https://ai.pydantic.dev/api/mcp/)
      * [ pydantic_ai.messages  ](https://ai.pydantic.dev/api/messages/)
      * [ pydantic_ai.models.anthropic  ](https://ai.pydantic.dev/api/models/anthropic/)
      * pydantic_ai.models  [ pydantic_ai.models  ](https://ai.pydantic.dev/api/models/base/)
        * [ models  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models)
        * [ KnownModelName  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.KnownModelName)
        * [ ModelRequestParameters  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ModelRequestParameters)
        * [ Model  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model)
          * [ __init__  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.__init__)
          * [ settings  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.settings)
          * [ request  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.request)
          * [ count_tokens  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.count_tokens)
          * [ request_stream  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.request_stream)
          * [ customize_request_parameters  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.customize_request_parameters)
          * [ prepare_request  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.prepare_request)
          * [ model_name  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.model_name)
          * [ model_id  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.model_id)
          * [ label  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.label)
          * [ supported_builtin_tools  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.supported_builtin_tools)
          * [ profile  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.profile)
          * [ system  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.system)
          * [ base_url  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.base_url)
        * [ StreamedResponse  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse)
          * [ __aiter__  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.__aiter__)
          * [ get  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.get)
          * [ usage  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.usage)
          * [ model_name  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.model_name)
          * [ provider_name  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.provider_name)
          * [ provider_url  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.provider_url)
          * [ timestamp  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.timestamp)
        * [ ALLOW_MODEL_REQUESTS  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ALLOW_MODEL_REQUESTS)
        * [ check_allow_model_requests  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.check_allow_model_requests)
        * [ override_allow_model_requests  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.override_allow_model_requests)
      * [ pydantic_ai.models.bedrock  ](https://ai.pydantic.dev/api/models/bedrock/)
      * [ pydantic_ai.models.cerebras  ](https://ai.pydantic.dev/api/models/cerebras/)
      * [ pydantic_ai.models.cohere  ](https://ai.pydantic.dev/api/models/cohere/)
      * [ pydantic_ai.models.fallback  ](https://ai.pydantic.dev/api/models/fallback/)
      * [ pydantic_ai.models.function  ](https://ai.pydantic.dev/api/models/function/)
      * [ pydantic_ai.models.google  ](https://ai.pydantic.dev/api/models/google/)
      * [ pydantic_ai.models.xai  ](https://ai.pydantic.dev/api/models/xai/)
      * [ pydantic_ai.models.groq  ](https://ai.pydantic.dev/api/models/groq/)
      * [ pydantic_ai.models.huggingface  ](https://ai.pydantic.dev/api/models/huggingface/)
      * [ pydantic_ai.models.instrumented  ](https://ai.pydantic.dev/api/models/instrumented/)
      * [ pydantic_ai.models.mcp_sampling  ](https://ai.pydantic.dev/api/models/mcp-sampling/)
      * [ pydantic_ai.models.mistral  ](https://ai.pydantic.dev/api/models/mistral/)
      * [ pydantic_ai.models.openai  ](https://ai.pydantic.dev/api/models/openai/)
      * [ pydantic_ai.models.openrouter  ](https://ai.pydantic.dev/api/models/openrouter/)
      * [ pydantic_ai.models.outlines  ](https://ai.pydantic.dev/api/models/outlines/)
      * [ pydantic_ai.models.test  ](https://ai.pydantic.dev/api/models/test/)
      * [ pydantic_ai.models.wrapper  ](https://ai.pydantic.dev/api/models/wrapper/)
      * [ pydantic_ai.output  ](https://ai.pydantic.dev/api/output/)
      * [ pydantic_ai.profiles  ](https://ai.pydantic.dev/api/profiles/)
      * [ pydantic_ai.providers  ](https://ai.pydantic.dev/api/providers/)
      * [ pydantic_ai.result  ](https://ai.pydantic.dev/api/result/)
      * [ pydantic_ai.retries  ](https://ai.pydantic.dev/api/retries/)
      * [ pydantic_ai.run  ](https://ai.pydantic.dev/api/run/)
      * [ pydantic_ai.settings  ](https://ai.pydantic.dev/api/settings/)
      * [ pydantic_ai.tools  ](https://ai.pydantic.dev/api/tools/)
      * [ pydantic_ai.toolsets  ](https://ai.pydantic.dev/api/toolsets/)
      * [ pydantic_ai.ui.ag_ui  ](https://ai.pydantic.dev/api/ui/ag_ui/)
      * [ pydantic_ai.ui  ](https://ai.pydantic.dev/api/ui/base/)
      * [ pydantic_ai.ui.vercel_ai  ](https://ai.pydantic.dev/api/ui/vercel_ai/)
      * [ pydantic_ai.usage  ](https://ai.pydantic.dev/api/usage/)
    * pydantic_evals
      * [ pydantic_evals.dataset  ](https://ai.pydantic.dev/api/pydantic_evals/dataset/)
      * [ pydantic_evals.evaluators  ](https://ai.pydantic.dev/api/pydantic_evals/evaluators/)
      * [ pydantic_evals.reporting  ](https://ai.pydantic.dev/api/pydantic_evals/reporting/)
      * [ pydantic_evals.otel  ](https://ai.pydantic.dev/api/pydantic_evals/otel/)
      * [ pydantic_evals.generation  ](https://ai.pydantic.dev/api/pydantic_evals/generation/)
    * pydantic_graph
      * [ pydantic_graph  ](https://ai.pydantic.dev/api/pydantic_graph/graph/)
      * [ pydantic_graph.nodes  ](https://ai.pydantic.dev/api/pydantic_graph/nodes/)
      * [ pydantic_graph.persistence  ](https://ai.pydantic.dev/api/pydantic_graph/persistence/)
      * [ pydantic_graph.mermaid  ](https://ai.pydantic.dev/api/pydantic_graph/mermaid/)
      * [ pydantic_graph.exceptions  ](https://ai.pydantic.dev/api/pydantic_graph/exceptions/)
      * Beta API
        * [ pydantic_graph.beta  ](https://ai.pydantic.dev/api/pydantic_graph/beta/)
        * [ pydantic_graph.beta.graph  ](https://ai.pydantic.dev/api/pydantic_graph/beta_graph/)
        * [ pydantic_graph.beta.graph_builder  ](https://ai.pydantic.dev/api/pydantic_graph/beta_graph_builder/)
        * [ pydantic_graph.beta.step  ](https://ai.pydantic.dev/api/pydantic_graph/beta_step/)
        * [ pydantic_graph.beta.join  ](https://ai.pydantic.dev/api/pydantic_graph/beta_join/)
        * [ pydantic_graph.beta.decision  ](https://ai.pydantic.dev/api/pydantic_graph/beta_decision/)
        * [ pydantic_graph.beta.node  ](https://ai.pydantic.dev/api/pydantic_graph/beta_node/)
    * fasta2a
      * [ fasta2a  ](https://ai.pydantic.dev/api/fasta2a/)
  * Project
    * [ Contributing  ](https://ai.pydantic.dev/contributing/)
    * [ Upgrade Guide  ](https://ai.pydantic.dev/changelog/)
    * [ Version policy  ](https://ai.pydantic.dev/version-policy/)


  * [ models  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models)
  * [ KnownModelName  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.KnownModelName)
  * [ ModelRequestParameters  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ModelRequestParameters)
  * [ Model  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model)
    * [ __init__  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.__init__)
    * [ settings  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.settings)
    * [ request  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.request)
    * [ count_tokens  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.count_tokens)
    * [ request_stream  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.request_stream)
    * [ customize_request_parameters  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.customize_request_parameters)
    * [ prepare_request  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.prepare_request)
    * [ model_name  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.model_name)
    * [ model_id  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.model_id)
    * [ label  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.label)
    * [ supported_builtin_tools  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.supported_builtin_tools)
    * [ profile  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.profile)
    * [ system  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.system)
    * [ base_url  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.base_url)
  * [ StreamedResponse  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse)
    * [ __aiter__  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.__aiter__)
    * [ get  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.get)
    * [ usage  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.usage)
    * [ model_name  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.model_name)
    * [ provider_name  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.provider_name)
    * [ provider_url  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.provider_url)
    * [ timestamp  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse.timestamp)
  * [ ALLOW_MODEL_REQUESTS  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ALLOW_MODEL_REQUESTS)
  * [ check_allow_model_requests  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.check_allow_model_requests)
  * [ override_allow_model_requests  ](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.override_allow_model_requests)


  1. [ Pydantic AI  ](https://ai.pydantic.dev/)
  2. [ API Reference  ](https://ai.pydantic.dev/api/ag_ui/)
  3. [ pydantic_ai  ](https://ai.pydantic.dev/api/ag_ui/)


# `pydantic_ai.models`
Logic related to making requests to an LLM.
The aim here is to make a common interface for different LLMs, so that the rest of the code can be agnostic to the specific LLM being used.
###  KnownModelName `module-attribute`
```
KnownModelName = TypeAliasType[](https://typing-extensions.readthedocs.io/en/latest/index.html#typing_extensions.TypeAliasType "typing_extensions.TypeAliasType")(
    "KnownModelName",
    Literal[](https://docs.python.org/3/library/typing.html#typing.Literal "typing.Literal")[
        "anthropic:claude-3-5-haiku-20241022",
        "anthropic:claude-3-5-haiku-latest",
        "anthropic:claude-3-7-sonnet-20250219",
        "anthropic:claude-3-7-sonnet-latest",
        "anthropic:claude-3-haiku-20240307",
        "anthropic:claude-3-opus-20240229",
        "anthropic:claude-3-opus-latest",
        "anthropic:claude-4-opus-20250514",
        "anthropic:claude-4-sonnet-20250514",
        "anthropic:claude-haiku-4-5-20251001",
        "anthropic:claude-haiku-4-5",
        "anthropic:claude-opus-4-0",
        "anthropic:claude-opus-4-1-20250805",
        "anthropic:claude-opus-4-20250514",
        "anthropic:claude-opus-4-5-20251101",
        "anthropic:claude-opus-4-5",
        "anthropic:claude-opus-4-6",
        "anthropic:claude-sonnet-4-0",
        "anthropic:claude-sonnet-4-20250514",
        "anthropic:claude-sonnet-4-5-20250929",
        "anthropic:claude-sonnet-4-5",
        "anthropic:claude-sonnet-4-6",
        "bedrock:amazon.titan-text-express-v1",
        "bedrock:amazon.titan-text-lite-v1",
        "bedrock:amazon.titan-tg1-large",
        "bedrock:anthropic.claude-3-5-haiku-20241022-v1:0",
        "bedrock:anthropic.claude-3-5-sonnet-20240620-v1:0",
        "bedrock:anthropic.claude-3-5-sonnet-20241022-v2:0",
        "bedrock:anthropic.claude-3-7-sonnet-20250219-v1:0",
        "bedrock:anthropic.claude-3-haiku-20240307-v1:0",
        "bedrock:anthropic.claude-3-opus-20240229-v1:0",
        "bedrock:anthropic.claude-3-sonnet-20240229-v1:0",
        "bedrock:anthropic.claude-haiku-4-5-20251001-v1:0",
        "bedrock:anthropic.claude-instant-v1",
        "bedrock:anthropic.claude-opus-4-20250514-v1:0",
        "bedrock:anthropic.claude-sonnet-4-20250514-v1:0",
        "bedrock:anthropic.claude-sonnet-4-5-20250929-v1:0",
        "bedrock:anthropic.claude-sonnet-4-6",
        "bedrock:anthropic.claude-v2:1",
        "bedrock:anthropic.claude-v2",
        "bedrock:cohere.command-light-text-v14",
        "bedrock:cohere.command-r-plus-v1:0",
        "bedrock:cohere.command-r-v1:0",
        "bedrock:cohere.command-text-v14",
        "bedrock:eu.anthropic.claude-haiku-4-5-20251001-v1:0",
        "bedrock:eu.anthropic.claude-sonnet-4-20250514-v1:0",
        "bedrock:eu.anthropic.claude-sonnet-4-5-20250929-v1:0",
        "bedrock:eu.anthropic.claude-sonnet-4-6",
        "bedrock:global.anthropic.claude-opus-4-5-20251101-v1:0",
        "bedrock:meta.llama3-1-405b-instruct-v1:0",
        "bedrock:meta.llama3-1-70b-instruct-v1:0",
        "bedrock:meta.llama3-1-8b-instruct-v1:0",
        "bedrock:meta.llama3-70b-instruct-v1:0",
        "bedrock:meta.llama3-8b-instruct-v1:0",
        "bedrock:mistral.mistral-7b-instruct-v0:2",
        "bedrock:mistral.mistral-large-2402-v1:0",
        "bedrock:mistral.mistral-large-2407-v1:0",
        "bedrock:mistral.mixtral-8x7b-instruct-v0:1",
        "bedrock:us.amazon.nova-2-lite-v1:0",
        "bedrock:us.amazon.nova-lite-v1:0",
        "bedrock:us.amazon.nova-micro-v1:0",
        "bedrock:us.amazon.nova-pro-v1:0",
        "bedrock:us.anthropic.claude-3-5-haiku-20241022-v1:0",
        "bedrock:us.anthropic.claude-3-5-sonnet-20240620-v1:0",
        "bedrock:us.anthropic.claude-3-5-sonnet-20241022-v2:0",
        "bedrock:us.anthropic.claude-3-7-sonnet-20250219-v1:0",
        "bedrock:us.anthropic.claude-3-haiku-20240307-v1:0",
        "bedrock:us.anthropic.claude-3-opus-20240229-v1:0",
        "bedrock:us.anthropic.claude-3-sonnet-20240229-v1:0",
        "bedrock:us.anthropic.claude-haiku-4-5-20251001-v1:0",
        "bedrock:us.anthropic.claude-opus-4-20250514-v1:0",
        "bedrock:us.anthropic.claude-sonnet-4-20250514-v1:0",
        "bedrock:us.anthropic.claude-sonnet-4-5-20250929-v1:0",
        "bedrock:us.anthropic.claude-sonnet-4-6",
        "bedrock:us.meta.llama3-1-70b-instruct-v1:0",
        "bedrock:us.meta.llama3-1-8b-instruct-v1:0",
        "bedrock:us.meta.llama3-2-11b-instruct-v1:0",
        "bedrock:us.meta.llama3-2-1b-instruct-v1:0",
        "bedrock:us.meta.llama3-2-3b-instruct-v1:0",
        "bedrock:us.meta.llama3-2-90b-instruct-v1:0",
        "bedrock:us.meta.llama3-3-70b-instruct-v1:0",
        "cerebras:gpt-oss-120b",
        "cerebras:llama-3.3-70b",
        "cerebras:llama3.1-8b",
        "cerebras:qwen-3-235b-a22b-instruct-2507",
        "cerebras:qwen-3-32b",
        "cerebras:qwen-3-coder-480b",
        "cerebras:zai-glm-4.6",
        "cerebras:zai-glm-4.7",
        "cohere:c4ai-aya-expanse-32b",
        "cohere:c4ai-aya-expanse-8b",
        "cohere:command-nightly",
        "cohere:command-r-08-2024",
        "cohere:command-r-plus-08-2024",
        "cohere:command-r7b-12-2024",
        "deepseek:deepseek-chat",
        "deepseek:deepseek-reasoner",
        "gateway/anthropic:claude-3-5-haiku-20241022",
        "gateway/anthropic:claude-3-5-haiku-latest",
        "gateway/anthropic:claude-3-7-sonnet-20250219",
        "gateway/anthropic:claude-3-7-sonnet-latest",
        "gateway/anthropic:claude-3-haiku-20240307",
        "gateway/anthropic:claude-3-opus-20240229",
        "gateway/anthropic:claude-3-opus-latest",
        "gateway/anthropic:claude-4-opus-20250514",
        "gateway/anthropic:claude-4-sonnet-20250514",
        "gateway/anthropic:claude-haiku-4-5-20251001",
        "gateway/anthropic:claude-haiku-4-5",
        "gateway/anthropic:claude-opus-4-0",
        "gateway/anthropic:claude-opus-4-1-20250805",
        "gateway/anthropic:claude-opus-4-20250514",
        "gateway/anthropic:claude-opus-4-5-20251101",
        "gateway/anthropic:claude-opus-4-5",
        "gateway/anthropic:claude-opus-4-6",
        "gateway/anthropic:claude-sonnet-4-0",
        "gateway/anthropic:claude-sonnet-4-20250514",
        "gateway/anthropic:claude-sonnet-4-5-20250929",
        "gateway/anthropic:claude-sonnet-4-5",
        "gateway/anthropic:claude-sonnet-4-6",
        "gateway/bedrock:amazon.titan-text-express-v1",
        "gateway/bedrock:amazon.titan-text-lite-v1",
        "gateway/bedrock:amazon.titan-tg1-large",
        "gateway/bedrock:anthropic.claude-3-5-haiku-20241022-v1:0",
        "gateway/bedrock:anthropic.claude-3-5-sonnet-20240620-v1:0",
        "gateway/bedrock:anthropic.claude-3-5-sonnet-20241022-v2:0",
        "gateway/bedrock:anthropic.claude-3-7-sonnet-20250219-v1:0",
        "gateway/bedrock:anthropic.claude-3-haiku-20240307-v1:0",
        "gateway/bedrock:anthropic.claude-3-opus-20240229-v1:0",
        "gateway/bedrock:anthropic.claude-3-sonnet-20240229-v1:0",
        "gateway/bedrock:anthropic.claude-haiku-4-5-20251001-v1:0",
        "gateway/bedrock:anthropic.claude-instant-v1",
        "gateway/bedrock:anthropic.claude-opus-4-20250514-v1:0",
        "gateway/bedrock:anthropic.claude-sonnet-4-20250514-v1:0",
        "gateway/bedrock:anthropic.claude-sonnet-4-5-20250929-v1:0",
        "gateway/bedrock:anthropic.claude-sonnet-4-6",
        "gateway/bedrock:anthropic.claude-v2:1",
        "gateway/bedrock:anthropic.claude-v2",
        "gateway/bedrock:cohere.command-light-text-v14",
        "gateway/bedrock:cohere.command-r-plus-v1:0",
        "gateway/bedrock:cohere.command-r-v1:0",
        "gateway/bedrock:cohere.command-text-v14",
        "gateway/bedrock:eu.anthropic.claude-haiku-4-5-20251001-v1:0",
        "gateway/bedrock:eu.anthropic.claude-sonnet-4-20250514-v1:0",
        "gateway/bedrock:eu.anthropic.claude-sonnet-4-5-20250929-v1:0",
        "gateway/bedrock:eu.anthropic.claude-sonnet-4-6",
        "gateway/bedrock:global.anthropic.claude-opus-4-5-20251101-v1:0",
        "gateway/bedrock:meta.llama3-1-405b-instruct-v1:0",
        "gateway/bedrock:meta.llama3-1-70b-instruct-v1:0",
        "gateway/bedrock:meta.llama3-1-8b-instruct-v1:0",
        "gateway/bedrock:meta.llama3-70b-instruct-v1:0",
        "gateway/bedrock:meta.llama3-8b-instruct-v1:0",
        "gateway/bedrock:mistral.mistral-7b-instruct-v0:2",
        "gateway/bedrock:mistral.mistral-large-2402-v1:0",
        "gateway/bedrock:mistral.mistral-large-2407-v1:0",
        "gateway/bedrock:mistral.mixtral-8x7b-instruct-v0:1",
        "gateway/bedrock:us.amazon.nova-2-lite-v1:0",
        "gateway/bedrock:us.amazon.nova-lite-v1:0",
        "gateway/bedrock:us.amazon.nova-micro-v1:0",
        "gateway/bedrock:us.amazon.nova-pro-v1:0",
        "gateway/bedrock:us.anthropic.claude-3-5-haiku-20241022-v1:0",
        "gateway/bedrock:us.anthropic.claude-3-5-sonnet-20240620-v1:0",
        "gateway/bedrock:us.anthropic.claude-3-5-sonnet-20241022-v2:0",
        "gateway/bedrock:us.anthropic.claude-3-7-sonnet-20250219-v1:0",
        "gateway/bedrock:us.anthropic.claude-3-haiku-20240307-v1:0",
        "gateway/bedrock:us.anthropic.claude-3-opus-20240229-v1:0",
        "gateway/bedrock:us.anthropic.claude-3-sonnet-20240229-v1:0",
        "gateway/bedrock:us.anthropic.claude-haiku-4-5-20251001-v1:0",
        "gateway/bedrock:us.anthropic.claude-opus-4-20250514-v1:0",
        "gateway/bedrock:us.anthropic.claude-sonnet-4-20250514-v1:0",
        "gateway/bedrock:us.anthropic.claude-sonnet-4-5-20250929-v1:0",
        "gateway/bedrock:us.anthropic.claude-sonnet-4-6",
        "gateway/bedrock:us.meta.llama3-1-70b-instruct-v1:0",
        "gateway/bedrock:us.meta.llama3-1-8b-instruct-v1:0",
        "gateway/bedrock:us.meta.llama3-2-11b-instruct-v1:0",
        "gateway/bedrock:us.meta.llama3-2-1b-instruct-v1:0",
        "gateway/bedrock:us.meta.llama3-2-3b-instruct-v1:0",
        "gateway/bedrock:us.meta.llama3-2-90b-instruct-v1:0",
        "gateway/bedrock:us.meta.llama3-3-70b-instruct-v1:0",
        "gateway/google-vertex:gemini-2.0-flash-lite",
        "gateway/google-vertex:gemini-2.0-flash",
        "gateway/google-vertex:gemini-2.5-flash-image",
        "gateway/google-vertex:gemini-2.5-flash-lite-preview-09-2025",
        "gateway/google-vertex:gemini-2.5-flash-lite",
        "gateway/google-vertex:gemini-2.5-flash-preview-09-2025",
        "gateway/google-vertex:gemini-2.5-flash",
        "gateway/google-vertex:gemini-2.5-pro",
        "gateway/google-vertex:gemini-3-flash-preview",
        "gateway/google-vertex:gemini-3-pro-image-preview",
        "gateway/google-vertex:gemini-3-pro-preview",
        "gateway/google-vertex:gemini-3.1-pro-preview",
        "gateway/google-vertex:gemini-flash-latest",
        "gateway/google-vertex:gemini-flash-lite-latest",
        "gateway/groq:llama-3.1-8b-instant",
        "gateway/groq:llama-3.3-70b-versatile",
        "gateway/groq:meta-llama/llama-guard-4-12b",
        "gateway/groq:openai/gpt-oss-120b",
        "gateway/groq:openai/gpt-oss-20b",
        "gateway/groq:whisper-large-v3",
        "gateway/groq:whisper-large-v3-turbo",
        "gateway/groq:meta-llama/llama-4-maverick-17b-128e-instruct",
        "gateway/groq:meta-llama/llama-4-scout-17b-16e-instruct",
        "gateway/groq:meta-llama/llama-prompt-guard-2-22m",
        "gateway/groq:meta-llama/llama-prompt-guard-2-86m",
        "gateway/groq:moonshotai/kimi-k2-instruct-0905",
        "gateway/groq:openai/gpt-oss-safeguard-20b",
        "gateway/groq:playai-tts",
        "gateway/groq:playai-tts-arabic",
        "gateway/groq:qwen/qwen-3-32b",
        "gateway/openai:chatgpt-4o-latest",
        "gateway/openai:codex-mini-latest",
        "gateway/openai:computer-use-preview-2025-03-11",
        "gateway/openai:computer-use-preview",
        "gateway/openai:gpt-3.5-turbo-0125",
        "gateway/openai:gpt-3.5-turbo-0301",
        "gateway/openai:gpt-3.5-turbo-0613",
        "gateway/openai:gpt-3.5-turbo-1106",
        "gateway/openai:gpt-3.5-turbo-16k-0613",
        "gateway/openai:gpt-3.5-turbo-16k",
        "gateway/openai:gpt-3.5-turbo",
        "gateway/openai:gpt-4-0125-preview",
        "gateway/openai:gpt-4-0314",
        "gateway/openai:gpt-4-0613",
        "gateway/openai:gpt-4-1106-preview",
        "gateway/openai:gpt-4-32k-0314",
        "gateway/openai:gpt-4-32k-0613",
        "gateway/openai:gpt-4-32k",
        "gateway/openai:gpt-4-turbo-2024-04-09",
        "gateway/openai:gpt-4-turbo-preview",
        "gateway/openai:gpt-4-turbo",
        "gateway/openai:gpt-4-vision-preview",
        "gateway/openai:gpt-4.1-2025-04-14",
        "gateway/openai:gpt-4.1-mini-2025-04-14",
        "gateway/openai:gpt-4.1-mini",
        "gateway/openai:gpt-4.1-nano-2025-04-14",
        "gateway/openai:gpt-4.1-nano",
        "gateway/openai:gpt-4.1",
        "gateway/openai:gpt-4",
        "gateway/openai:gpt-4o-2024-05-13",
        "gateway/openai:gpt-4o-2024-08-06",
        "gateway/openai:gpt-4o-2024-11-20",
        "gateway/openai:gpt-4o-audio-preview-2024-10-01",
        "gateway/openai:gpt-4o-audio-preview-2024-12-17",
        "gateway/openai:gpt-4o-audio-preview-2025-06-03",
        "gateway/openai:gpt-4o-audio-preview",
        "gateway/openai:gpt-4o-mini-2024-07-18",
        "gateway/openai:gpt-4o-mini-audio-preview-2024-12-17",
        "gateway/openai:gpt-4o-mini-audio-preview",
        "gateway/openai:gpt-4o-mini-search-preview-2025-03-11",
        "gateway/openai:gpt-4o-mini-search-preview",
        "gateway/openai:gpt-4o-mini",
        "gateway/openai:gpt-4o-search-preview-2025-03-11",
        "gateway/openai:gpt-4o-search-preview",
        "gateway/openai:gpt-4o",
        "gateway/openai:gpt-5-2025-08-07",
        "gateway/openai:gpt-5-chat-latest",
        "gateway/openai:gpt-5-codex",
        "gateway/openai:gpt-5-mini-2025-08-07",
        "gateway/openai:gpt-5-mini",
        "gateway/openai:gpt-5-nano-2025-08-07",
        "gateway/openai:gpt-5-nano",
        "gateway/openai:gpt-5-pro-2025-10-06",
        "gateway/openai:gpt-5-pro",
        "gateway/openai:gpt-5.1-2025-11-13",
        "gateway/openai:gpt-5.1-chat-latest",
        "gateway/openai:gpt-5.1-codex-max",
        "gateway/openai:gpt-5.1-codex",
        "gateway/openai:gpt-5.1-mini",
        "gateway/openai:gpt-5.1",
        "gateway/openai:gpt-5.2-2025-12-11",
        "gateway/openai:gpt-5.2-chat-latest",
        "gateway/openai:gpt-5.2-pro-2025-12-11",
        "gateway/openai:gpt-5.2-pro",
        "gateway/openai:gpt-5.2",
        "gateway/openai:gpt-5",
        "gateway/openai:o1-2024-12-17",
        "gateway/openai:o1-mini-2024-09-12",
        "gateway/openai:o1-mini",
        "gateway/openai:o1-preview-2024-09-12",
        "gateway/openai:o1-preview",
        "gateway/openai:o1-pro-2025-03-19",
        "gateway/openai:o1-pro",
        "gateway/openai:o1",
        "gateway/openai:o3-2025-04-16",
        "gateway/openai:o3-deep-research-2025-06-26",
        "gateway/openai:o3-deep-research",
        "gateway/openai:o3-mini-2025-01-31",
        "gateway/openai:o3-mini",
        "gateway/openai:o3-pro-2025-06-10",
        "gateway/openai:o3-pro",
        "gateway/openai:o3",
        "gateway/openai:o4-mini-2025-04-16",
        "gateway/openai:o4-mini-deep-research-2025-06-26",
        "gateway/openai:o4-mini-deep-research",
        "gateway/openai:o4-mini",
        "google-gla:gemini-2.0-flash-lite",
        "google-gla:gemini-2.0-flash",
        "google-gla:gemini-2.5-flash-image",
        "google-gla:gemini-2.5-flash-lite-preview-09-2025",
        "google-gla:gemini-2.5-flash-lite",
        "google-gla:gemini-2.5-flash-preview-09-2025",
        "google-gla:gemini-2.5-flash",
        "google-gla:gemini-2.5-pro",
        "google-gla:gemini-3-flash-preview",
        "google-gla:gemini-3-pro-image-preview",
        "google-gla:gemini-3-pro-preview",
        "google-gla:gemini-3.1-pro-preview",
        "google-gla:gemini-flash-latest",
        "google-gla:gemini-flash-lite-latest",
        "google-vertex:gemini-2.0-flash-lite",
        "google-vertex:gemini-2.0-flash",
        "google-vertex:gemini-2.5-flash-image",
        "google-vertex:gemini-2.5-flash-lite-preview-09-2025",
        "google-vertex:gemini-2.5-flash-lite",
        "google-vertex:gemini-2.5-flash-preview-09-2025",
        "google-vertex:gemini-2.5-flash",
        "google-vertex:gemini-2.5-pro",
        "google-vertex:gemini-3-flash-preview",
        "google-vertex:gemini-3-pro-image-preview",
        "google-vertex:gemini-3-pro-preview",
        "google-vertex:gemini-3.1-pro-preview",
        "google-vertex:gemini-flash-latest",
        "google-vertex:gemini-flash-lite-latest",
        "grok:grok-2-image-1212",
        "grok:grok-2-vision-1212",
        "grok:grok-3-fast",
        "grok:grok-3-mini-fast",
        "grok:grok-3-mini",
        "grok:grok-3",
        "grok:grok-4-0709",
        "grok:grok-4-latest",
        "grok:grok-4-1-fast-non-reasoning",
        "grok:grok-4-1-fast-reasoning",
        "grok:grok-4-1-fast",
        "grok:grok-4-fast-non-reasoning",
        "grok:grok-4-fast-reasoning",
        "grok:grok-4-fast",
        "grok:grok-4",
        "grok:grok-code-fast-1",
        "xai:grok-3",
        "xai:grok-3-fast",
        "xai:grok-3-fast-latest",
        "xai:grok-3-latest",
        "xai:grok-3-mini",
        "xai:grok-3-mini-fast",
        "xai:grok-3-mini-fast-latest",
        "xai:grok-4",
        "xai:grok-4-0709",
        "xai:grok-4-1-fast",
        "xai:grok-4-1-fast-non-reasoning",
        "xai:grok-4-1-fast-non-reasoning-latest",
        "xai:grok-4-1-fast-reasoning",
        "xai:grok-4-1-fast-reasoning-latest",
        "xai:grok-4-fast",
        "xai:grok-4-fast-non-reasoning",
        "xai:grok-4-fast-non-reasoning-latest",
        "xai:grok-4-fast-reasoning",
        "xai:grok-4-fast-reasoning-latest",
        "xai:grok-4-latest",
        "xai:grok-code-fast-1",
        "groq:llama-3.1-8b-instant",
        "groq:llama-3.3-70b-versatile",
        "groq:meta-llama/llama-guard-4-12b",
        "groq:openai/gpt-oss-120b",
        "groq:openai/gpt-oss-20b",
        "groq:whisper-large-v3",
        "groq:whisper-large-v3-turbo",
        "groq:meta-llama/llama-4-maverick-17b-128e-instruct",
        "groq:meta-llama/llama-4-scout-17b-16e-instruct",
        "groq:meta-llama/llama-prompt-guard-2-22m",
        "groq:meta-llama/llama-prompt-guard-2-86m",
        "groq:moonshotai/kimi-k2-instruct-0905",
        "groq:openai/gpt-oss-safeguard-20b",
        "groq:playai-tts",
        "groq:playai-tts-arabic",
        "groq:qwen/qwen-3-32b",
        "heroku:claude-3-5-haiku",
        "heroku:claude-3-5-sonnet-latest",
        "heroku:claude-3-7-sonnet",
        "heroku:claude-3-haiku",
        "heroku:claude-4-5-haiku",
        "heroku:claude-4-5-sonnet",
        "heroku:claude-4-sonnet",
        "heroku:claude-opus-4-5",
        "heroku:gpt-oss-120b",
        "heroku:kimi-k2-thinking",
        "heroku:minimax-m2",
        "heroku:qwen3-235b",
        "heroku:qwen3-coder-480b",
        "heroku:nova-2-lite",
        "heroku:nova-lite",
        "heroku:nova-pro",
        "huggingface:deepseek-ai/DeepSeek-R1",
        "huggingface:meta-llama/Llama-3.3-70B-Instruct",
        "huggingface:meta-llama/Llama-4-Maverick-17B-128E-Instruct",
        "huggingface:meta-llama/Llama-4-Scout-17B-16E-Instruct",
        "huggingface:Qwen/Qwen2.5-72B-Instruct",
        "huggingface:Qwen/Qwen3-235B-A22B",
        "huggingface:Qwen/Qwen3-32B",
        "huggingface:Qwen/QwQ-32B",
        "mistral:codestral-latest",
        "mistral:mistral-large-latest",
        "mistral:mistral-moderation-latest",
        "mistral:mistral-small-latest",
        "moonshotai:kimi-k2-0711-preview",
        "moonshotai:kimi-latest",
        "moonshotai:kimi-thinking-preview",
        "moonshotai:moonshot-v1-128k-vision-preview",
        "moonshotai:moonshot-v1-128k",
        "moonshotai:moonshot-v1-32k-vision-preview",
        "moonshotai:moonshot-v1-32k",
        "moonshotai:moonshot-v1-8k-vision-preview",
        "moonshotai:moonshot-v1-8k",
        "openai:chatgpt-4o-latest",
        "openai:codex-mini-latest",
        "openai:computer-use-preview-2025-03-11",
        "openai:computer-use-preview",
        "openai:gpt-3.5-turbo-0125",
        "openai:gpt-3.5-turbo-0301",
        "openai:gpt-3.5-turbo-0613",
        "openai:gpt-3.5-turbo-1106",
        "openai:gpt-3.5-turbo-16k-0613",
        "openai:gpt-3.5-turbo-16k",
        "openai:gpt-3.5-turbo",
        "openai:gpt-4-0125-preview",
        "openai:gpt-4-0314",
        "openai:gpt-4-0613",
        "openai:gpt-4-1106-preview",
        "openai:gpt-4-32k-0314",
        "openai:gpt-4-32k-0613",
        "openai:gpt-4-32k",
        "openai:gpt-4-turbo-2024-04-09",
        "openai:gpt-4-turbo-preview",
        "openai:gpt-4-turbo",
        "openai:gpt-4-vision-preview",
        "openai:gpt-4.1-2025-04-14",
        "openai:gpt-4.1-mini-2025-04-14",
        "openai:gpt-4.1-mini",
        "openai:gpt-4.1-nano-2025-04-14",
        "openai:gpt-4.1-nano",
        "openai:gpt-4.1",
        "openai:gpt-4",
        "openai:gpt-4o-2024-05-13",
        "openai:gpt-4o-2024-08-06",
        "openai:gpt-4o-2024-11-20",
        "openai:gpt-4o-audio-preview-2024-10-01",
        "openai:gpt-4o-audio-preview-2024-12-17",
        "openai:gpt-4o-audio-preview-2025-06-03",
        "openai:gpt-4o-audio-preview",
        "openai:gpt-4o-mini-2024-07-18",
        "openai:gpt-4o-mini-audio-preview-2024-12-17",
        "openai:gpt-4o-mini-audio-preview",
        "openai:gpt-4o-mini-search-preview-2025-03-11",
        "openai:gpt-4o-mini-search-preview",
        "openai:gpt-4o-mini",
        "openai:gpt-4o-search-preview-2025-03-11",
        "openai:gpt-4o-search-preview",
        "openai:gpt-4o",
        "openai:gpt-5-2025-08-07",
        "openai:gpt-5-chat-latest",
        "openai:gpt-5-codex",
        "openai:gpt-5-mini-2025-08-07",
        "openai:gpt-5-mini",
        "openai:gpt-5-nano-2025-08-07",
        "openai:gpt-5-nano",
        "openai:gpt-5-pro-2025-10-06",
        "openai:gpt-5-pro",
        "openai:gpt-5.1-2025-11-13",
        "openai:gpt-5.1-chat-latest",
        "openai:gpt-5.1-codex-max",
        "openai:gpt-5.1-codex",
        "openai:gpt-5.1-mini",
        "openai:gpt-5.1",
        "openai:gpt-5.2-2025-12-11",
        "openai:gpt-5.2-chat-latest",
        "openai:gpt-5.2-pro-2025-12-11",
        "openai:gpt-5.2-pro",
        "openai:gpt-5.2",
        "openai:gpt-5",
        "openai:o1-2024-12-17",
        "openai:o1-mini-2024-09-12",
        "openai:o1-mini",
        "openai:o1-preview-2024-09-12",
        "openai:o1-preview",
        "openai:o1-pro-2025-03-19",
        "openai:o1-pro",
        "openai:o1",
        "openai:o3-2025-04-16",
        "openai:o3-deep-research-2025-06-26",
        "openai:o3-deep-research",
        "openai:o3-mini-2025-01-31",
        "openai:o3-mini",
        "openai:o3-pro-2025-06-10",
        "openai:o3-pro",
        "openai:o3",
        "openai:o4-mini-2025-04-16",
        "openai:o4-mini-deep-research-2025-06-26",
        "openai:o4-mini-deep-research",
        "openai:o4-mini",
        "test",
    ],
)

```

Known model names that can be used with the `model` parameter of [`Agent`](https://ai.pydantic.dev/api/agent/#pydantic_ai.agent.Agent "Agent



      dataclass
  ").
`KnownModelName` is provided as a concise way to specify a model.
###  ModelRequestParameters `dataclass`
Configuration for an agent's request to a model, specifically related to tools and output handling.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
```
| ```
@dataclass(repr=False, kw_only=True)
class ModelRequestParameters:
    """Configuration for an agent's request to a model, specifically related to tools and output handling."""

    function_tools: list[ToolDefinition] = field(default_factory=list[ToolDefinition])
    builtin_tools: list[AbstractBuiltinTool] = field(default_factory=list[AbstractBuiltinTool])

    output_mode: OutputMode = 'text'
    output_object: OutputObjectDefinition | None = None
    output_tools: list[ToolDefinition] = field(default_factory=list[ToolDefinition])
    prompted_output_template: str | None = None
    allow_text_output: bool = True
    allow_image_output: bool = False

    @cached_property
    def tool_defs(self) -> dict[str, ToolDefinition]:
        return {tool_def.name: tool_def for tool_def in [*self.function_tools, *self.output_tools]}

    @cached_property
    def prompted_output_instructions(self) -> str | None:
        if self.prompted_output_template and self.output_object:
            return StructuredTextOutputSchema.build_instructions(self.prompted_output_template, self.output_object)
        return None

    __repr__ = _utils.dataclasses_no_defaults_repr

```

---|---
###  Model
Bases: `ABC[](https://docs.python.org/3/library/abc.html#abc.ABC "abc.ABC")`
Abstract class for a model.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
```
| ```
class Model(ABC):
    """Abstract class for a model."""

    _profile: ModelProfileSpec | None = None
    _settings: ModelSettings | None = None

    def __init__(
        self,
        *,
        settings: ModelSettings | None = None,
        profile: ModelProfileSpec | None = None,
    ) -> None:
        """Initialize the model with optional settings and profile.

        Args:
            settings: Model-specific settings that will be used as defaults for this model.
            profile: The model profile to use.
        """
        self._settings = settings
        self._profile = profile

    @property
    def settings(self) -> ModelSettings | None:
        """Get the model settings."""
        return self._settings

    @abstractmethod
    async def request(
        self,
        messages: list[ModelMessage],
        model_settings: ModelSettings | None,
        model_request_parameters: ModelRequestParameters,
    ) -> ModelResponse:
        """Make a request to the model.

        This is ultimately called by `pydantic_ai._agent_graph.ModelRequestNode._make_request(...)`.
        """
        raise NotImplementedError()

    async def count_tokens(
        self,
        messages: list[ModelMessage],
        model_settings: ModelSettings | None,
        model_request_parameters: ModelRequestParameters,
    ) -> RequestUsage:
        """Make a request to the model for counting tokens."""
        # This method is not required, but you need to implement it if you want to support `UsageLimits.count_tokens_before_request`.
        raise NotImplementedError(f'Token counting ahead of the request is not supported by {self.__class__.__name__}')

    @asynccontextmanager
    async def request_stream(
        self,
        messages: list[ModelMessage],
        model_settings: ModelSettings | None,
        model_request_parameters: ModelRequestParameters,
        run_context: RunContext[Any] | None = None,
    ) -> AsyncIterator[StreamedResponse]:
        """Make a request to the model and return a streaming response."""
        # This method is not required, but you need to implement it if you want to support streamed responses
        raise NotImplementedError(f'Streamed requests not supported by this {self.__class__.__name__}')
        # yield is required to make this a generator for type checking
        # noinspection PyUnreachableCode
        yield  # pragma: no cover

    def customize_request_parameters(self, model_request_parameters: ModelRequestParameters) -> ModelRequestParameters:
        """Customize the request parameters for the model.

        This method can be overridden by subclasses to modify the request parameters before sending them to the model.
        In particular, this method can be used to make modifications to the generated tool JSON schemas if necessary
        for vendor/model-specific reasons.
        """
        if transformer := self.profile.json_schema_transformer:
            model_request_parameters = replace(
                model_request_parameters,
                function_tools=[_customize_tool_def(transformer, t) for t in model_request_parameters.function_tools],
                output_tools=[_customize_tool_def(transformer, t) for t in model_request_parameters.output_tools],
            )
            if output_object := model_request_parameters.output_object:
                model_request_parameters = replace(
                    model_request_parameters,
                    output_object=_customize_output_object(transformer, output_object),
                )

        return model_request_parameters

    def prepare_request(
        self,
        model_settings: ModelSettings | None,
        model_request_parameters: ModelRequestParameters,
    ) -> tuple[ModelSettings | None, ModelRequestParameters]:
        """Prepare request inputs before they are passed to the provider.

        This merges the given `model_settings` with the model's own `settings` attribute and ensures
        `customize_request_parameters` is applied to the resolved
        [`ModelRequestParameters`][pydantic_ai.models.ModelRequestParameters]. Subclasses can override this method if
        they need to customize the preparation flow further, but most implementations should simply call
        `self.prepare_request(...)` at the start of their `request` (and related) methods.
        """
        model_settings = merge_model_settings(self.settings, model_settings)

        params = self.customize_request_parameters(model_request_parameters)

        if builtin_tools := params.builtin_tools:
            # Deduplicate builtin tools
            params = replace(
                params,
                builtin_tools=list({tool.unique_id: tool for tool in builtin_tools}.values()),
            )

        if params.output_mode == 'auto':
            output_mode = self.profile.default_structured_output_mode
            params = replace(
                params,
                output_mode=output_mode,
                allow_text_output=output_mode in ('native', 'prompted'),
            )

        # Reset irrelevant fields
        if params.output_tools and params.output_mode != 'tool':
            params = replace(params, output_tools=[])
        if params.output_object and params.output_mode not in ('native', 'prompted'):
            params = replace(params, output_object=None)
        if params.prompted_output_template and params.output_mode not in ('prompted', 'native'):
            params = replace(params, prompted_output_template=None)  # pragma: no cover

        # Set default prompted output template
        if (
            params.output_mode == 'prompted'
            or (params.output_mode == 'native' and self.profile.native_output_requires_schema_in_instructions)
        ) and not params.prompted_output_template:
            params = replace(params, prompted_output_template=self.profile.prompted_output_template)

        # Check if output mode is supported
        if params.output_mode == 'native' and not self.profile.supports_json_schema_output:
            raise UserError('Native structured output is not supported by this model.')
        if params.output_mode == 'tool' and not self.profile.supports_tools:
            raise UserError('Tool output is not supported by this model.')
        if params.allow_image_output and not self.profile.supports_image_output:
            raise UserError('Image output is not supported by this model.')

        # Check if builtin tools are supported
        if params.builtin_tools:
            supported_types = self.profile.supported_builtin_tools
            unsupported = [tool for tool in params.builtin_tools if not isinstance(tool, tuple(supported_types))]
            if unsupported:
                unsupported_names = [type(tool).__name__ for tool in unsupported]
                supported_names = [t.__name__ for t in supported_types]
                raise UserError(
                    f'Builtin tool(s) {unsupported_names} not supported by this model. Supported: {supported_names}'
                )

        return model_settings, params

    @property
    @abstractmethod
    def model_name(self) -> str:
        """The model name."""
        raise NotImplementedError()

    @property
    def model_id(self) -> str:
        """The fully qualified model name in `'provider:model_name'` format."""
        return f'{self.system}:{self.model_name}'

    @property
    def label(self) -> str:
        """Human-friendly display label for the model.

        Handles common patterns:
        - gpt-5 -> GPT 5
        - claude-sonnet-4-5 -> Claude Sonnet 4.5
        - gemini-2.5-pro -> Gemini 2.5 Pro
        - meta-llama/llama-3-70b -> Llama 3 70b (OpenRouter style)
        """
        label = self.model_name
        # Handle OpenRouter-style names with / (e.g., meta-llama/llama-3-70b)
        if '/' in label:
            label = label.split('/')[-1]

        parts = label.split('-')
        result: list[str] = []

        for i, part in enumerate(parts):
            if i == 0 and part.lower() == 'gpt':
                result.append(part.upper())
            elif part.replace('.', '').isdigit():
                if result and result[-1].replace('.', '').isdigit():
                    result[-1] = f'{result[-1]}.{part}'
                else:
                    result.append(part)
            else:
                result.append(part.capitalize())

        return ' '.join(result)

    @classmethod
    def supported_builtin_tools(cls) -> frozenset[type[AbstractBuiltinTool]]:
        """Return the set of builtin tool types this model class can handle.

        Subclasses should override this to reflect their actual capabilities.
        Default is empty set - subclasses must explicitly declare support.
        """
        return frozenset()

    @cached_property
    def profile(self) -> ModelProfile:
        """The model profile.

        We use this to compute the intersection of the profile's supported_builtin_tools
        and the model's implemented tools, ensuring model.profile.supported_builtin_tools
        is the single source of truth for what builtin tools are actually usable.
        """
        _profile = self._profile
        if callable(_profile):
            _profile = _profile(self.model_name)

        if _profile is None:
            _profile = DEFAULT_PROFILE

        # Compute intersection: profile's allowed tools & model's implemented tools
        model_supported = self.__class__.supported_builtin_tools()
        profile_supported = _profile.supported_builtin_tools
        effective_tools = profile_supported & model_supported

        if effective_tools != profile_supported:
            _profile = replace(_profile, supported_builtin_tools=effective_tools)

        return _profile

    @property
    @abstractmethod
    def system(self) -> str:
        """The model provider, ex: openai.

        Use to populate the `gen_ai.system` OpenTelemetry semantic convention attribute,
        so should use well-known values listed in
        https://opentelemetry.io/docs/specs/semconv/attributes-registry/gen-ai/#gen-ai-system
        when applicable.
        """
        raise NotImplementedError()

    @property
    def base_url(self) -> str | None:
        """The base URL for the provider API, if available."""
        return None

    @staticmethod
    def _get_instructions(
        messages: Sequence[ModelMessage], model_request_parameters: ModelRequestParameters | None = None
    ) -> str | None:
        """Get instructions from the first ModelRequest found when iterating messages in reverse.

        In the case that a "mock" request was generated to include a tool-return part for a result tool,
        we want to use the instructions from the second-to-most-recent request (which should correspond to the
        original request that generated the response that resulted in the tool-return part).
        """
        instructions = None

        last_two_requests: list[ModelRequest] = []
        for message in reversed(messages):
            if isinstance(message, ModelRequest):
                last_two_requests.append(message)
                if len(last_two_requests) == 2:
                    break
                if message.instructions is not None:
                    instructions = message.instructions
                    break

        # If we don't have two requests, and we didn't already return instructions, there are definitely not any:
        if instructions is None and len(last_two_requests) == 2:
            most_recent_request = last_two_requests[0]
            second_most_recent_request = last_two_requests[1]

            # If we've gotten this far and the most recent request consists of only tool-return parts or retry-prompt parts,
            # we use the instructions from the second-to-most-recent request. This is necessary because when handling
            # result tools, we generate a "mock" ModelRequest with a tool-return part for it, and that ModelRequest will not
            # have the relevant instructions from the agent.

            # While it's possible that you could have a message history where the most recent request has only tool returns,
            # I believe there is no way to achieve that would _change_ the instructions without manually crafting the most
            # recent message. That might make sense in principle for some usage pattern, but it's enough of an edge case
            # that I think it's not worth worrying about, since you can work around this by inserting another ModelRequest
            # with no parts at all immediately before the request that has the tool calls (that works because we only look
            # at the two most recent ModelRequests here).

            # If you have a use case where this causes pain, please open a GitHub issue and we can discuss alternatives.

            if all(p.part_kind == 'tool-return' or p.part_kind == 'retry-prompt' for p in most_recent_request.parts):
                instructions = second_most_recent_request.instructions

        if model_request_parameters and (output_instructions := model_request_parameters.prompted_output_instructions):
            if instructions:
                instructions = '\n\n'.join([instructions, output_instructions])
            else:
                instructions = output_instructions

        return instructions

```

---|---
####  __init__
```
__init__(
    *,
    settings: ModelSettings[](https://ai.pydantic.dev/api/settings/#pydantic_ai.settings.ModelSettings "ModelSettings \(pydantic_ai.settings.ModelSettings\)") | None = None,
    profile: ModelProfileSpec | None = None
) -> None

```

Initialize the model with optional settings and profile.
Parameters:
Name | Type | Description | Default
---|---|---|---
`settings` |  `ModelSettings[](https://ai.pydantic.dev/api/settings/#pydantic_ai.settings.ModelSettings "ModelSettings \(pydantic_ai.settings.ModelSettings\)") | None` |  Model-specific settings that will be used as defaults for this model. |  `None`
`profile` |  `ModelProfileSpec | None` |  The model profile to use. |  `None`
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
642
643
644
645
646
647
648
649
650
651
652
653
654
655
```
| ```
def __init__(
    self,
    *,
    settings: ModelSettings | None = None,
    profile: ModelProfileSpec | None = None,
) -> None:
    """Initialize the model with optional settings and profile.

    Args:
        settings: Model-specific settings that will be used as defaults for this model.
        profile: The model profile to use.
    """
    self._settings = settings
    self._profile = profile

```

---|---
####  settings `property`
```
settings: ModelSettings[](https://ai.pydantic.dev/api/settings/#pydantic_ai.settings.ModelSettings "ModelSettings \(pydantic_ai.settings.ModelSettings\)") | None

```

Get the model settings.
####  request `abstractmethod` `async`
```
request(
    messages: list[](https://docs.python.org/3/library/stdtypes.html#list)[ModelMessage[](https://ai.pydantic.dev/api/messages/#pydantic_ai.messages.ModelMessage "ModelMessage



      module-attribute
   \(pydantic_ai.messages.ModelMessage\)")],
    model_settings: ModelSettings[](https://ai.pydantic.dev/api/settings/#pydantic_ai.settings.ModelSettings "ModelSettings \(pydantic_ai.settings.ModelSettings\)") | None,
    model_request_parameters: ModelRequestParameters[](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ModelRequestParameters "ModelRequestParameters



      dataclass
   \(pydantic_ai.models.ModelRequestParameters\)"),
) -> ModelResponse[](https://ai.pydantic.dev/api/messages/#pydantic_ai.messages.ModelResponse "ModelResponse



      dataclass
   \(pydantic_ai.messages.ModelResponse\)")

```

Make a request to the model.
This is ultimately called by `pydantic_ai._agent_graph.ModelRequestNode._make_request(...)`.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
662
663
664
665
666
667
668
669
670
671
672
673
```
| ```
@abstractmethod
async def request(
    self,
    messages: list[ModelMessage],
    model_settings: ModelSettings | None,
    model_request_parameters: ModelRequestParameters,
) -> ModelResponse:
    """Make a request to the model.

    This is ultimately called by `pydantic_ai._agent_graph.ModelRequestNode._make_request(...)`.
    """
    raise NotImplementedError()

```

---|---
####  count_tokens `async`
```
count_tokens(
    messages: list[](https://docs.python.org/3/library/stdtypes.html#list)[ModelMessage[](https://ai.pydantic.dev/api/messages/#pydantic_ai.messages.ModelMessage "ModelMessage



      module-attribute
   \(pydantic_ai.messages.ModelMessage\)")],
    model_settings: ModelSettings[](https://ai.pydantic.dev/api/settings/#pydantic_ai.settings.ModelSettings "ModelSettings \(pydantic_ai.settings.ModelSettings\)") | None,
    model_request_parameters: ModelRequestParameters[](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ModelRequestParameters "ModelRequestParameters



      dataclass
   \(pydantic_ai.models.ModelRequestParameters\)"),
) -> RequestUsage[](https://ai.pydantic.dev/api/usage/#pydantic_ai.usage.RequestUsage "RequestUsage



      dataclass
   \(pydantic_ai.usage.RequestUsage\)")

```

Make a request to the model for counting tokens.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
675
676
677
678
679
680
681
682
683
```
| ```
async def count_tokens(
    self,
    messages: list[ModelMessage],
    model_settings: ModelSettings | None,
    model_request_parameters: ModelRequestParameters,
) -> RequestUsage:
    """Make a request to the model for counting tokens."""
    # This method is not required, but you need to implement it if you want to support `UsageLimits.count_tokens_before_request`.
    raise NotImplementedError(f'Token counting ahead of the request is not supported by {self.__class__.__name__}')

```

---|---
####  request_stream `async`
```
request_stream(
    messages: list[](https://docs.python.org/3/library/stdtypes.html#list)[ModelMessage[](https://ai.pydantic.dev/api/messages/#pydantic_ai.messages.ModelMessage "ModelMessage



      module-attribute
   \(pydantic_ai.messages.ModelMessage\)")],
    model_settings: ModelSettings[](https://ai.pydantic.dev/api/settings/#pydantic_ai.settings.ModelSettings "ModelSettings \(pydantic_ai.settings.ModelSettings\)") | None,
    model_request_parameters: ModelRequestParameters[](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ModelRequestParameters "ModelRequestParameters



      dataclass
   \(pydantic_ai.models.ModelRequestParameters\)"),
    run_context: RunContext[](https://ai.pydantic.dev/api/tools/#pydantic_ai.tools.RunContext "RunContext



      dataclass
   \(pydantic_ai._run_context.RunContext\)")[Any[](https://docs.python.org/3/library/typing.html#typing.Any "typing.Any")] | None = None,
) -> AsyncIterator[](https://docs.python.org/3/library/collections.abc.html#collections.abc.AsyncIterator "collections.abc.AsyncIterator")[StreamedResponse[](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.StreamedResponse "StreamedResponse



      dataclass
   \(pydantic_ai.models.StreamedResponse\)")]

```

Make a request to the model and return a streaming response.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
685
686
687
688
689
690
691
692
693
694
695
696
697
698
```
| ```
@asynccontextmanager
async def request_stream(
    self,
    messages: list[ModelMessage],
    model_settings: ModelSettings | None,
    model_request_parameters: ModelRequestParameters,
    run_context: RunContext[Any] | None = None,
) -> AsyncIterator[StreamedResponse]:
    """Make a request to the model and return a streaming response."""
    # This method is not required, but you need to implement it if you want to support streamed responses
    raise NotImplementedError(f'Streamed requests not supported by this {self.__class__.__name__}')
    # yield is required to make this a generator for type checking
    # noinspection PyUnreachableCode
    yield  # pragma: no cover

```

---|---
####  customize_request_parameters
```
customize_request_parameters(
    model_request_parameters: ModelRequestParameters[](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ModelRequestParameters "ModelRequestParameters



      dataclass
   \(pydantic_ai.models.ModelRequestParameters\)"),
) -> ModelRequestParameters[](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ModelRequestParameters "ModelRequestParameters



      dataclass
   \(pydantic_ai.models.ModelRequestParameters\)")

```

Customize the request parameters for the model.
This method can be overridden by subclasses to modify the request parameters before sending them to the model. In particular, this method can be used to make modifications to the generated tool JSON schemas if necessary for vendor/model-specific reasons.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
```
| ```
def customize_request_parameters(self, model_request_parameters: ModelRequestParameters) -> ModelRequestParameters:
    """Customize the request parameters for the model.

    This method can be overridden by subclasses to modify the request parameters before sending them to the model.
    In particular, this method can be used to make modifications to the generated tool JSON schemas if necessary
    for vendor/model-specific reasons.
    """
    if transformer := self.profile.json_schema_transformer:
        model_request_parameters = replace(
            model_request_parameters,
            function_tools=[_customize_tool_def(transformer, t) for t in model_request_parameters.function_tools],
            output_tools=[_customize_tool_def(transformer, t) for t in model_request_parameters.output_tools],
        )
        if output_object := model_request_parameters.output_object:
            model_request_parameters = replace(
                model_request_parameters,
                output_object=_customize_output_object(transformer, output_object),
            )

    return model_request_parameters

```

---|---
####  prepare_request
```
prepare_request(
    model_settings: ModelSettings[](https://ai.pydantic.dev/api/settings/#pydantic_ai.settings.ModelSettings "ModelSettings \(pydantic_ai.settings.ModelSettings\)") | None,
    model_request_parameters: ModelRequestParameters[](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ModelRequestParameters "ModelRequestParameters



      dataclass
   \(pydantic_ai.models.ModelRequestParameters\)"),
) -> tuple[](https://docs.python.org/3/library/stdtypes.html#tuple)[ModelSettings[](https://ai.pydantic.dev/api/settings/#pydantic_ai.settings.ModelSettings "ModelSettings \(pydantic_ai.settings.ModelSettings\)") | None, ModelRequestParameters[](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ModelRequestParameters "ModelRequestParameters



      dataclass
   \(pydantic_ai.models.ModelRequestParameters\)")]

```

Prepare request inputs before they are passed to the provider.
This merges the given `model_settings` with the model's own `settings` attribute and ensures `customize_request_parameters` is applied to the resolved [`ModelRequestParameters`](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ModelRequestParameters "ModelRequestParameters



      dataclass
  "). Subclasses can override this method if they need to customize the preparation flow further, but most implementations should simply call `self.prepare_request(...)` at the start of their `request` (and related) methods.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
```
| ```
def prepare_request(
    self,
    model_settings: ModelSettings | None,
    model_request_parameters: ModelRequestParameters,
) -> tuple[ModelSettings | None, ModelRequestParameters]:
    """Prepare request inputs before they are passed to the provider.

    This merges the given `model_settings` with the model's own `settings` attribute and ensures
    `customize_request_parameters` is applied to the resolved
    [`ModelRequestParameters`][pydantic_ai.models.ModelRequestParameters]. Subclasses can override this method if
    they need to customize the preparation flow further, but most implementations should simply call
    `self.prepare_request(...)` at the start of their `request` (and related) methods.
    """
    model_settings = merge_model_settings(self.settings, model_settings)

    params = self.customize_request_parameters(model_request_parameters)

    if builtin_tools := params.builtin_tools:
        # Deduplicate builtin tools
        params = replace(
            params,
            builtin_tools=list({tool.unique_id: tool for tool in builtin_tools}.values()),
        )

    if params.output_mode == 'auto':
        output_mode = self.profile.default_structured_output_mode
        params = replace(
            params,
            output_mode=output_mode,
            allow_text_output=output_mode in ('native', 'prompted'),
        )

    # Reset irrelevant fields
    if params.output_tools and params.output_mode != 'tool':
        params = replace(params, output_tools=[])
    if params.output_object and params.output_mode not in ('native', 'prompted'):
        params = replace(params, output_object=None)
    if params.prompted_output_template and params.output_mode not in ('prompted', 'native'):
        params = replace(params, prompted_output_template=None)  # pragma: no cover

    # Set default prompted output template
    if (
        params.output_mode == 'prompted'
        or (params.output_mode == 'native' and self.profile.native_output_requires_schema_in_instructions)
    ) and not params.prompted_output_template:
        params = replace(params, prompted_output_template=self.profile.prompted_output_template)

    # Check if output mode is supported
    if params.output_mode == 'native' and not self.profile.supports_json_schema_output:
        raise UserError('Native structured output is not supported by this model.')
    if params.output_mode == 'tool' and not self.profile.supports_tools:
        raise UserError('Tool output is not supported by this model.')
    if params.allow_image_output and not self.profile.supports_image_output:
        raise UserError('Image output is not supported by this model.')

    # Check if builtin tools are supported
    if params.builtin_tools:
        supported_types = self.profile.supported_builtin_tools
        unsupported = [tool for tool in params.builtin_tools if not isinstance(tool, tuple(supported_types))]
        if unsupported:
            unsupported_names = [type(tool).__name__ for tool in unsupported]
            supported_names = [t.__name__ for t in supported_types]
            raise UserError(
                f'Builtin tool(s) {unsupported_names} not supported by this model. Supported: {supported_names}'
            )

    return model_settings, params

```

---|---
####  model_name `abstractmethod` `property`
```
model_name: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

The model name.
####  model_id `property`
```
model_id: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

The fully qualified model name in `'provider:model_name'` format.
####  label `property`
```
label: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

Human-friendly display label for the model.
Handles common patterns: - gpt-5 -> GPT 5 - claude-sonnet-4-5 -> Claude Sonnet 4.5 - gemini-2.5-pro -> Gemini 2.5 Pro - meta-llama/llama-3-70b -> Llama 3 70b (OpenRouter style)
####  supported_builtin_tools `classmethod`
```
supported_builtin_tools() -> (
    frozenset[](https://docs.python.org/3/library/stdtypes.html#frozenset)[type[](https://docs.python.org/3/library/functions.html#type)[AbstractBuiltinTool[](https://ai.pydantic.dev/api/builtin_tools/#pydantic_ai.builtin_tools.AbstractBuiltinTool "AbstractBuiltinTool



      dataclass
   \(pydantic_ai.builtin_tools.AbstractBuiltinTool\)")]]
)

```

Return the set of builtin tool types this model class can handle.
Subclasses should override this to reflect their actual capabilities. Default is empty set - subclasses must explicitly declare support.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
831
832
833
834
835
836
837
838
```
| ```
@classmethod
def supported_builtin_tools(cls) -> frozenset[type[AbstractBuiltinTool]]:
    """Return the set of builtin tool types this model class can handle.

    Subclasses should override this to reflect their actual capabilities.
    Default is empty set - subclasses must explicitly declare support.
    """
    return frozenset()

```

---|---
####  profile `cached` `property`
```
profile: ModelProfile[](https://ai.pydantic.dev/api/profiles/#pydantic_ai.profiles.ModelProfile "pydantic_ai.profiles.ModelProfile")

```

The model profile.
We use this to compute the intersection of the profile's supported_builtin_tools and the model's implemented tools, ensuring model.profile.supported_builtin_tools is the single source of truth for what builtin tools are actually usable.
####  system `abstractmethod` `property`
```
system: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

The model provider, ex: openai.
Use to populate the `gen_ai.system` OpenTelemetry semantic convention attribute, so should use well-known values listed in https://opentelemetry.io/docs/specs/semconv/attributes-registry/gen-ai/#gen-ai-system when applicable.
####  base_url `property`
```
base_url: str[](https://docs.python.org/3/library/stdtypes.html#str) | None

```

The base URL for the provider API, if available.
###  StreamedResponse `dataclass`
Bases: `ABC[](https://docs.python.org/3/library/abc.html#abc.ABC "abc.ABC")`
Streamed response from an LLM when calling a tool.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
```
| ```
@dataclass
class StreamedResponse(ABC):
    """Streamed response from an LLM when calling a tool."""

    model_request_parameters: ModelRequestParameters

    final_result_event: FinalResultEvent | None = field(default=None, init=False)

    provider_response_id: str | None = field(default=None, init=False)
    provider_details: dict[str, Any] | None = field(default=None, init=False)
    finish_reason: FinishReason | None = field(default=None, init=False)

    _parts_manager: ModelResponsePartsManager = field(default_factory=ModelResponsePartsManager, init=False)
    _event_iterator: AsyncIterator[ModelResponseStreamEvent] | None = field(default=None, init=False)
    _usage: RequestUsage = field(default_factory=RequestUsage, init=False)

    def __aiter__(self) -> AsyncIterator[ModelResponseStreamEvent]:
        """Stream the response as an async iterable of [`ModelResponseStreamEvent`][pydantic_ai.messages.ModelResponseStreamEvent]s.

        This proxies the `_event_iterator()` and emits all events, while also checking for matches
        on the result schema and emitting a [`FinalResultEvent`][pydantic_ai.messages.FinalResultEvent] if/when the
        first match is found.
        """
        if self._event_iterator is None:

            async def iterator_with_final_event(
                iterator: AsyncIterator[ModelResponseStreamEvent],
            ) -> AsyncIterator[ModelResponseStreamEvent]:
                async for event in iterator:
                    yield event
                    if (
                        final_result_event := _get_final_result_event(event, self.model_request_parameters)
                    ) is not None:
                        self.final_result_event = final_result_event
                        yield final_result_event
                        break

                # If we broke out of the above loop, we need to yield the rest of the events
                # If we didn't, this will just be a no-op
                async for event in iterator:
                    yield event

            async def iterator_with_part_end(
                iterator: AsyncIterator[ModelResponseStreamEvent],
            ) -> AsyncIterator[ModelResponseStreamEvent]:
                last_start_event: PartStartEvent | None = None

                def part_end_event(next_part: ModelResponsePart | None = None) -> PartEndEvent | None:
                    if not last_start_event:
                        return None

                    index = last_start_event.index
                    part = self._parts_manager.get_parts()[index]
                    if not isinstance(part, TextPart | ThinkingPart | BaseToolCallPart):
                        # Parts other than these 3 don't have deltas, so don't need an end part.
                        return None

                    return PartEndEvent(
                        index=index,
                        part=part,
                        next_part_kind=next_part.part_kind if next_part else None,
                    )

                async for event in iterator:
                    if isinstance(event, PartStartEvent):
                        if last_start_event:
                            end_event = part_end_event(event.part)
                            if end_event:
                                yield end_event

                            event.previous_part_kind = last_start_event.part.part_kind
                        last_start_event = event

                    yield event

                end_event = part_end_event()
                if end_event:
                    yield end_event

            self._event_iterator = iterator_with_part_end(iterator_with_final_event(self._get_event_iterator()))
        return self._event_iterator

    @abstractmethod
    async def _get_event_iterator(self) -> AsyncIterator[ModelResponseStreamEvent]:
        """Return an async iterator of [`ModelResponseStreamEvent`][pydantic_ai.messages.ModelResponseStreamEvent]s.

        This method should be implemented by subclasses to translate the vendor-specific stream of events into
        pydantic_ai-format events.

        It should use the `_parts_manager` to handle deltas, and should update the `_usage` attributes as it goes.
        """
        raise NotImplementedError()
        # noinspection PyUnreachableCode
        yield

    def get(self) -> ModelResponse:
        """Build a [`ModelResponse`][pydantic_ai.messages.ModelResponse] from the data received from the stream so far."""
        return ModelResponse(
            parts=self._parts_manager.get_parts(),
            model_name=self.model_name,
            timestamp=self.timestamp,
            usage=self.usage(),
            provider_name=self.provider_name,
            provider_url=self.provider_url,
            provider_response_id=self.provider_response_id,
            provider_details=self.provider_details,
            finish_reason=self.finish_reason,
        )

    # TODO (v2): Make this a property
    def usage(self) -> RequestUsage:
        """Get the usage of the response so far. This will not be the final usage until the stream is exhausted."""
        return self._usage

    @property
    @abstractmethod
    def model_name(self) -> str:
        """Get the model name of the response."""
        raise NotImplementedError()

    @property
    @abstractmethod
    def provider_name(self) -> str | None:
        """Get the provider name."""
        raise NotImplementedError()

    @property
    @abstractmethod
    def provider_url(self) -> str | None:
        """Get the provider base URL."""
        raise NotImplementedError()

    @property
    @abstractmethod
    def timestamp(self) -> datetime:
        """Get the timestamp of the response."""
        raise NotImplementedError()

```

---|---
####  __aiter__
```
__aiter__() -> AsyncIterator[](https://docs.python.org/3/library/collections.abc.html#collections.abc.AsyncIterator "collections.abc.AsyncIterator")[ModelResponseStreamEvent[](https://ai.pydantic.dev/api/messages/#pydantic_ai.messages.ModelResponseStreamEvent "ModelResponseStreamEvent



      module-attribute
   \(pydantic_ai.messages.ModelResponseStreamEvent\)")]

```

Stream the response as an async iterable of [`ModelResponseStreamEvent`](https://ai.pydantic.dev/api/messages/#pydantic_ai.messages.ModelResponseStreamEvent "ModelResponseStreamEvent



      module-attribute
  ")s.
This proxies the `_event_iterator()` and emits all events, while also checking for matches on the result schema and emitting a [`FinalResultEvent`](https://ai.pydantic.dev/api/messages/#pydantic_ai.messages.FinalResultEvent "FinalResultEvent



      dataclass
  ") if/when the first match is found.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
```
| ```
def __aiter__(self) -> AsyncIterator[ModelResponseStreamEvent]:
    """Stream the response as an async iterable of [`ModelResponseStreamEvent`][pydantic_ai.messages.ModelResponseStreamEvent]s.

    This proxies the `_event_iterator()` and emits all events, while also checking for matches
    on the result schema and emitting a [`FinalResultEvent`][pydantic_ai.messages.FinalResultEvent] if/when the
    first match is found.
    """
    if self._event_iterator is None:

        async def iterator_with_final_event(
            iterator: AsyncIterator[ModelResponseStreamEvent],
        ) -> AsyncIterator[ModelResponseStreamEvent]:
            async for event in iterator:
                yield event
                if (
                    final_result_event := _get_final_result_event(event, self.model_request_parameters)
                ) is not None:
                    self.final_result_event = final_result_event
                    yield final_result_event
                    break

            # If we broke out of the above loop, we need to yield the rest of the events
            # If we didn't, this will just be a no-op
            async for event in iterator:
                yield event

        async def iterator_with_part_end(
            iterator: AsyncIterator[ModelResponseStreamEvent],
        ) -> AsyncIterator[ModelResponseStreamEvent]:
            last_start_event: PartStartEvent | None = None

            def part_end_event(next_part: ModelResponsePart | None = None) -> PartEndEvent | None:
                if not last_start_event:
                    return None

                index = last_start_event.index
                part = self._parts_manager.get_parts()[index]
                if not isinstance(part, TextPart | ThinkingPart | BaseToolCallPart):
                    # Parts other than these 3 don't have deltas, so don't need an end part.
                    return None

                return PartEndEvent(
                    index=index,
                    part=part,
                    next_part_kind=next_part.part_kind if next_part else None,
                )

            async for event in iterator:
                if isinstance(event, PartStartEvent):
                    if last_start_event:
                        end_event = part_end_event(event.part)
                        if end_event:
                            yield end_event

                        event.previous_part_kind = last_start_event.part.part_kind
                    last_start_event = event

                yield event

            end_event = part_end_event()
            if end_event:
                yield end_event

        self._event_iterator = iterator_with_part_end(iterator_with_final_event(self._get_event_iterator()))
    return self._event_iterator

```

---|---
####  get
```
get() -> ModelResponse[](https://ai.pydantic.dev/api/messages/#pydantic_ai.messages.ModelResponse "ModelResponse



      dataclass
   \(pydantic_ai.messages.ModelResponse\)")

```

Build a [`ModelResponse`](https://ai.pydantic.dev/api/messages/#pydantic_ai.messages.ModelResponse "ModelResponse



      dataclass
  ") from the data received from the stream so far.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
```
| ```
def get(self) -> ModelResponse:
    """Build a [`ModelResponse`][pydantic_ai.messages.ModelResponse] from the data received from the stream so far."""
    return ModelResponse(
        parts=self._parts_manager.get_parts(),
        model_name=self.model_name,
        timestamp=self.timestamp,
        usage=self.usage(),
        provider_name=self.provider_name,
        provider_url=self.provider_url,
        provider_response_id=self.provider_response_id,
        provider_details=self.provider_details,
        finish_reason=self.finish_reason,
    )

```

---|---
####  usage
```
usage() -> RequestUsage[](https://ai.pydantic.dev/api/usage/#pydantic_ai.usage.RequestUsage "RequestUsage



      dataclass
   \(pydantic_ai.usage.RequestUsage\)")

```

Get the usage of the response so far. This will not be the final usage until the stream is exhausted.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
1045
1046
1047
```
| ```
def usage(self) -> RequestUsage:
    """Get the usage of the response so far. This will not be the final usage until the stream is exhausted."""
    return self._usage

```

---|---
####  model_name `abstractmethod` `property`
```
model_name: str[](https://docs.python.org/3/library/stdtypes.html#str)

```

Get the model name of the response.
####  provider_name `abstractmethod` `property`
```
provider_name: str[](https://docs.python.org/3/library/stdtypes.html#str) | None

```

Get the provider name.
####  provider_url `abstractmethod` `property`
```
provider_url: str[](https://docs.python.org/3/library/stdtypes.html#str) | None

```

Get the provider base URL.
####  timestamp `abstractmethod` `property`
```
timestamp: datetime[](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime")

```

Get the timestamp of the response.
###  ALLOW_MODEL_REQUESTS `module-attribute`
```
ALLOW_MODEL_REQUESTS = True

```

Whether to allow requests to models.
This global setting allows you to disable request to most models, e.g. to make sure you don't accidentally make costly requests to a model during tests.
The testing models [`TestModel`](https://ai.pydantic.dev/api/models/test/#pydantic_ai.models.test.TestModel "TestModel



      dataclass
  ") and [`FunctionModel`](https://ai.pydantic.dev/api/models/function/#pydantic_ai.models.function.FunctionModel "FunctionModel



      dataclass
  ") are no affected by this setting.
###  check_allow_model_requests
```
check_allow_model_requests() -> None

```

Check if model requests are allowed.
If you're defining your own models that have costs or latency associated with their use, you should call this in [`Model.request`](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.request "request



      abstractmethod
      async
  ") and [`Model.request_stream`](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.Model.request_stream "request_stream



      async
  ").
Raises:
Type | Description
---|---
`RuntimeError[](https://docs.python.org/3/library/exceptions.html#RuntimeError)` |  If model requests are not allowed.
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
```
| ```
def check_allow_model_requests() -> None:
    """Check if model requests are allowed.

    If you're defining your own models that have costs or latency associated with their use, you should call this in
    [`Model.request`][pydantic_ai.models.Model.request] and [`Model.request_stream`][pydantic_ai.models.Model.request_stream].

    Raises:
        RuntimeError: If model requests are not allowed.
    """
    if not ALLOW_MODEL_REQUESTS:
        raise RuntimeError('Model requests are not allowed, since ALLOW_MODEL_REQUESTS is False')

```

---|---
###  override_allow_model_requests
```
override_allow_model_requests(
    allow_model_requests: bool[](https://docs.python.org/3/library/functions.html#bool),
) -> Iterator[](https://docs.python.org/3/library/collections.abc.html#collections.abc.Iterator "collections.abc.Iterator")[None]

```

Context manager to temporarily override [`ALLOW_MODEL_REQUESTS`](https://ai.pydantic.dev/api/models/base/#pydantic_ai.models.ALLOW_MODEL_REQUESTS "ALLOW_MODEL_REQUESTS



      module-attribute
  ").
Parameters:
Name | Type | Description | Default
---|---|---|---
`allow_model_requests` |  `bool[](https://docs.python.org/3/library/functions.html#bool)` |  Whether to allow model requests within the context. |  _required_
Source code in `pydantic_ai_slim/pydantic_ai/models/__init__.py`
```
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
```
| ```
@contextmanager
def override_allow_model_requests(allow_model_requests: bool) -> Iterator[None]:
    """Context manager to temporarily override [`ALLOW_MODEL_REQUESTS`][pydantic_ai.models.ALLOW_MODEL_REQUESTS].

    Args:
        allow_model_requests: Whether to allow model requests within the context.
    """
    global ALLOW_MODEL_REQUESTS
    old_value = ALLOW_MODEL_REQUESTS
    ALLOW_MODEL_REQUESTS = allow_model_requests  # pyright: ignore[reportConstantRedefinition]
    try:
        yield
    finally:
        ALLOW_MODEL_REQUESTS = old_value  # pyright: ignore[reportConstantRedefinition]

```

---|---
© Pydantic Services Inc. 2024 to present
