# model_matches_spec

> **Function** in `deepagents`

📖 [View in docs](https://reference.langchain.com/python/deepagents/_models/model_matches_spec)

Check whether a model instance already matches a string model spec.

Matching is performed in two ways: first by exact string equality between
`spec` and the model identifier, then by comparing only the model-name
portion of a `provider:model` spec against the identifier. For example,
`"openai:gpt-5"` matches a model with identifier `"gpt-5"`.

Assumes the `provider:model` convention (single colon separator).

## Signature

```python
model_matches_spec(
    model: BaseChatModel,
    spec: str,
) -> bool
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `model` | `BaseChatModel` | Yes | Chat model instance to inspect. |
| `spec` | `str` | Yes | Model spec in `provider:model` format (e.g., `openai:gpt-5`). |

## Returns

`bool`

`True` if the model already matches the spec, otherwise `False`.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/ead1d09c7b5c2fe58044917bd7bfbb11634d55e2/libs/deepagents/deepagents/_models.py#L88)