> ## Documentation Index
> Fetch the complete documentation index at: https://askmarvin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LLM Models

> Choose a model and provider

Marvin delegates model access to [Pydantic AI](https://ai.pydantic.dev/models/). Use a `provider:model-name` string or a Pydantic AI model instance.

## Set the default before importing Marvin

```bash theme={null}
export OPENAI_API_KEY="your-api-key"
export MARVIN_AGENT_MODEL="openai:gpt-4o-mini"
```

Provider credentials use the provider's environment variables. Marvin-specific settings use the `MARVIN_` prefix.

## Choose a model for an agent

```python theme={null}
import marvin

agent = marvin.Agent(model="openai:gpt-4o-mini")
answer = agent.run("What is 23 + 19?", result_type=int)
```

For Anthropic, export `ANTHROPIC_API_KEY` and use an Anthropic model identifier, such as `anthropic:claude-haiku-4-5`.

## Change the application default

```python theme={null}
import marvin

marvin.defaults.model = "openai:gpt-4o-mini"
```

For a temporary override:

```python theme={null}
import marvin
from marvin.defaults import override_defaults

with override_defaults(model="openai:gpt-4o-mini"):
    answer = marvin.run("What is 23 + 19?", result_type=int)
```

Pass provider-supported settings through `Agent(model_settings={...})`. Accepted settings and model identifiers depend on the provider; consult its Pydantic AI documentation rather than assuming that all models accept temperature or the same options.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.