# `vllm_mlx.endpoint_model_policies`

Request-time model resolution policies for optional endpoints.

[View the complete module source at #L1-L118](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L1-L118).

## API details

Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.

::: vllm_mlx.endpoint_model_policies
    options:
      members:
        - _EMBEDDING_MODELS
        - _STT_MODEL_ALIASES
        - _TTS_MODEL_ALIASES
        - _with_identity_aliases
        - _STT_MODEL_MAP
        - _TTS_MODEL_MAP
        - _reject_unknown_embedding_model
        - _reject_unknown_audio_model
        - resolve_embedding_model_name
        - resolve_stt_model_name
        - resolve_tts_model_name
      filters: []
      show_if_no_docstring: true

## Complete contract reference

Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.

<details class="api-contract" id="contract-vllm_mlx.endpoint_model_policies._with_identity_aliases" markdown="1">
<summary><code>vllm_mlx.endpoint_model_policies._with_identity_aliases</code> · function</summary>

```python
vllm_mlx.endpoint_model_policies._with_identity_aliases(model_map: dict[str, str]) -> dict[str, str]
```

Function `_with_identity_aliases` calls `dict`, `model_map.values`; returns `expanded`.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `model_map` | `dict[str, str]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `dict[str, str]`
- Direct return expressions: `expanded`

**Exceptions and behavior**

Function `_with_identity_aliases` calls `dict`, `model_map.values`; returns `expanded`.
No direct `raise` statement appears in this definition.

[View source #L42-L46](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L42-L46).

</details>

<details class="api-contract" id="contract-vllm_mlx.endpoint_model_policies._reject_unknown_embedding_model" markdown="1">
<summary><code>vllm_mlx.endpoint_model_policies._reject_unknown_embedding_model</code> · function</summary>

```python
vllm_mlx.endpoint_model_policies._reject_unknown_embedding_model(requested_model: str) -> None
```

Function `_reject_unknown_embedding_model` calls `', '.join`, `sorted`, `HTTPException`; can raise `HTTPException`.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `requested_model` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `None`

**Exceptions and behavior**

Function `_reject_unknown_embedding_model` calls `', '.join`, `sorted`, `HTTPException`; can raise `HTTPException`.
Directly raised exceptions: `HTTPException`.

[View source #L53-L63](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L53-L63).

</details>

<details class="api-contract" id="contract-vllm_mlx.endpoint_model_policies._reject_unknown_audio_model" markdown="1">
<summary><code>vllm_mlx.endpoint_model_policies._reject_unknown_audio_model</code> · function</summary>

```python
vllm_mlx.endpoint_model_policies._reject_unknown_audio_model(endpoint: str, requested_model: str, supported_aliases: dict[str, str]) -> None
```

Function `_reject_unknown_audio_model` calls `', '.join`, `sorted`, `HTTPException`; can raise `HTTPException`.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `endpoint` | `str` | `yes` | `none` | Required positional or keyword input. |
| `requested_model` | `str` | `yes` | `none` | Required positional or keyword input. |
| `supported_aliases` | `dict[str, str]` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `None`

**Exceptions and behavior**

Function `_reject_unknown_audio_model` calls `', '.join`, `sorted`, `HTTPException`; can raise `HTTPException`.
Directly raised exceptions: `HTTPException`.

[View source #L66-L79](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L66-L79).

</details>

<details class="api-contract" id="contract-vllm_mlx.endpoint_model_policies.resolve_embedding_model_name" markdown="1">
<summary><code>vllm_mlx.endpoint_model_policies.resolve_embedding_model_name</code> · function</summary>

```python
vllm_mlx.endpoint_model_policies.resolve_embedding_model_name(requested_model: str, *, locked_model: str | None = None) -> str
```

Resolve the embedding model for a request or raise HTTP 400.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `requested_model` | `str` | `yes` | `none` | Required positional or keyword input. |
| `locked_model` | `str \| None` | `no` | `None` | Optional keyword-only input; defaults to `None`. |

**Returns**

- Type: `str`
- Direct return expressions: `locked_model`; `requested_model`

**Exceptions and behavior**

Function `resolve_embedding_model_name` calls `HTTPException`, `_reject_unknown_embedding_model`; can raise `HTTPException`; has 2 explicit return paths.
Directly raised exceptions: `HTTPException`.

[View source #L82-L104](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L82-L104).

</details>

<details class="api-contract" id="contract-vllm_mlx.endpoint_model_policies.resolve_stt_model_name" markdown="1">
<summary><code>vllm_mlx.endpoint_model_policies.resolve_stt_model_name</code> · function</summary>

```python
vllm_mlx.endpoint_model_policies.resolve_stt_model_name(requested_model: str) -> str
```

Resolve an STT request model alias or configured model ID.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `requested_model` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `str`
- Direct return expressions: `_STT_MODEL_MAP[requested_model]`

**Exceptions and behavior**

Function `resolve_stt_model_name` calls `_reject_unknown_audio_model`; returns `_STT_MODEL_MAP[requested_model]`.
No direct `raise` statement appears in this definition.

[View source #L107-L111](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L107-L111).

</details>

<details class="api-contract" id="contract-vllm_mlx.endpoint_model_policies.resolve_tts_model_name" markdown="1">
<summary><code>vllm_mlx.endpoint_model_policies.resolve_tts_model_name</code> · function</summary>

```python
vllm_mlx.endpoint_model_policies.resolve_tts_model_name(requested_model: str) -> str
```

Resolve a TTS request model alias or configured model ID.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `requested_model` | `str` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `str`
- Direct return expressions: `_TTS_MODEL_MAP[requested_model]`

**Exceptions and behavior**

Function `resolve_tts_model_name` calls `_reject_unknown_audio_model`; returns `_TTS_MODEL_MAP[requested_model]`.
No direct `raise` statement appears in this definition.

[View source #L114-L118](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L114-L118).

</details>

## Complete symbol map

This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.

| Symbol | Kind | Signature and inputs | What it does | Source |
| --- | --- | --- | --- | --- |
| [`_with_identity_aliases`](#contract-vllm_mlx.endpoint_model_policies._with_identity_aliases) | function | `_with_identity_aliases(model_map: dict[str, str]) -> dict[str, str]` | Function `_with_identity_aliases` calls `dict`, `model_map.values`; returns `expanded`. | [#L42-L46](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L42-L46) |
| [`_reject_unknown_embedding_model`](#contract-vllm_mlx.endpoint_model_policies._reject_unknown_embedding_model) | function | `_reject_unknown_embedding_model(requested_model: str) -> None` | Function `_reject_unknown_embedding_model` calls `', '.join`, `sorted`, `HTTPException`; can raise `HTTPException`. | [#L53-L63](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L53-L63) |
| [`_reject_unknown_audio_model`](#contract-vllm_mlx.endpoint_model_policies._reject_unknown_audio_model) | function | `_reject_unknown_audio_model(endpoint: str, requested_model: str, supported_aliases: dict[str, str]) -> None` | Function `_reject_unknown_audio_model` calls `', '.join`, `sorted`, `HTTPException`; can raise `HTTPException`. | [#L66-L79](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L66-L79) |
| [`resolve_embedding_model_name`](#contract-vllm_mlx.endpoint_model_policies.resolve_embedding_model_name) | function | `resolve_embedding_model_name(requested_model: str, *, locked_model: str \| None = None) -> str` | Resolve the embedding model for a request or raise HTTP 400. | [#L82-L104](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L82-L104) |
| [`resolve_stt_model_name`](#contract-vllm_mlx.endpoint_model_policies.resolve_stt_model_name) | function | `resolve_stt_model_name(requested_model: str) -> str` | Resolve an STT request model alias or configured model ID. | [#L107-L111](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L107-L111) |
| [`resolve_tts_model_name`](#contract-vllm_mlx.endpoint_model_policies.resolve_tts_model_name) | function | `resolve_tts_model_name(requested_model: str) -> str` | Resolve a TTS request model alias or configured model ID. | [#L114-L118](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/vllm_mlx/endpoint_model_policies.py#L114-L118) |
