# create_model

> **Function** in `deepagents_cli`

📖 [View in docs](https://reference.langchain.com/python/deepagents-cli/config/create_model)

Create a chat model.

Uses `init_chat_model` for standard providers, or imports a custom
`BaseChatModel` subclass when the provider has a `class_path` in config.

Supports `provider:model` format (e.g., `'anthropic:claude-sonnet-4-5'`)
for explicit provider selection, or bare model names for auto-detection.

## Signature

```python
create_model(
    model_spec: str | None = None,
    *,
    extra_kwargs: dict[str, Any] | None = None,
    profile_overrides: dict[str, Any] | None = None,
) -> ModelResult
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `model_spec` | `str \| None` | No | Model specification in `provider:model` format (e.g., `'anthropic:claude-sonnet-4-5'`, `'openai:gpt-4o'`) or just the model name for auto-detection (e.g., `'claude-sonnet-4-5'`).      If not provided, uses environment-based defaults. (default: `None`) |
| `extra_kwargs` | `dict[str, Any] \| None` | No | Additional kwargs to pass to the model constructor.  These take highest priority, overriding values from the config file. (default: `None`) |
| `profile_overrides` | `dict[str, Any] \| None` | No | Extra profile fields from `--profile-override`.  Merged on top of config file profile overrides (CLI wins). (default: `None`) |

## Returns

`ModelResult`

A `ModelResult` containing the model and its metadata.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/4869645403fe9ce57df6067417fdefc6bf509fe0/libs/cli/deepagents_cli/config.py#L2159)