# `examples.test_openai_compatibility`

OpenAI API Compatibility Test Script for vllm-mlx.

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

## 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.

::: examples.test_openai_compatibility
    options:
      members:
        - GREEN
        - RED
        - YELLOW
        - BLUE
        - RESET
        - BOLD
        - print_header
        - print_test
        - print_warning
        - create_test_image
        - test_health_endpoint
        - test_models_endpoint
        - test_chat_completions_http
        - test_chat_completions_openai
        - test_completions_endpoint
        - test_image_chat_http
        - test_image_chat_openai
        - test_image_url_http
        - test_streaming_chat
        - create_test_video
        - test_video_chat_http
        - test_video_chat_openai
        - test_video_url_http
        - run_all_tests
        - main
      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-examples.test_openai_compatibility.print_header" markdown="1">
<summary><code>examples.test_openai_compatibility.print_header</code> · function</summary>

```python
examples.test_openai_compatibility.print_header(text: str) -> not annotated
```

Print a section header.

**Parameters**

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

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Function `print_header` calls `print`.
No direct `raise` statement appears in this definition.

[View source #L37-L41](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L37-L41).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.print_test" markdown="1">
<summary><code>examples.test_openai_compatibility.print_test</code> · function</summary>

```python
examples.test_openai_compatibility.print_test(name: str, passed: bool, message: str = '') -> not annotated
```

Print test result.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `str` | `yes` | `none` | Required positional or keyword input. |
| `passed` | `bool` | `yes` | `none` | Required positional or keyword input. |
| `message` | `str` | `no` | `''` | Optional positional or keyword input; defaults to `''`. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Function `print_test` calls `print`.
No direct `raise` statement appears in this definition.

[View source #L44-L49](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L44-L49).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.print_warning" markdown="1">
<summary><code>examples.test_openai_compatibility.print_warning</code> · function</summary>

```python
examples.test_openai_compatibility.print_warning(text: str) -> not annotated
```

Print a warning message.

**Parameters**

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

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Function `print_warning` calls `print`.
No direct `raise` statement appears in this definition.

[View source #L52-L54](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L52-L54).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.create_test_image" markdown="1">
<summary><code>examples.test_openai_compatibility.create_test_image</code> · function</summary>

```python
examples.test_openai_compatibility.create_test_image() -> tuple[str, bytes]
```

Create a simple test image and return (path, bytes).

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `tuple[str, bytes]`
- Direct return expressions: `(temp_file.name, img_bytes)`; `(temp_file.name, minimal_png)`

**Exceptions and behavior**

Function `create_test_image` calls `Image.new`, `io.BytesIO`, `img.save`, `buffer.getvalue`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L57-L97](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L57-L97).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_health_endpoint" markdown="1">
<summary><code>examples.test_openai_compatibility.test_health_endpoint</code> · function</summary>

```python
examples.test_openai_compatibility.test_health_endpoint(server_url: str) -> bool
```

Test the /health endpoint.

**Parameters**

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

**Returns**

- Type: `bool`
- Direct return expressions: `response.status_code == 200`; `False`

**Exceptions and behavior**

Function `test_health_endpoint` calls `requests.get`, `print_warning`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L100-L109](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L100-L109).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_models_endpoint" markdown="1">
<summary><code>examples.test_openai_compatibility.test_models_endpoint</code> · function</summary>

```python
examples.test_openai_compatibility.test_models_endpoint(server_url: str) -> bool
```

Test the /v1/models endpoint.

**Parameters**

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

**Returns**

- Type: `bool`
- Direct return expressions: `False`; `'data' in data and isinstance(data['data'], list)`

**Exceptions and behavior**

Function `test_models_endpoint` calls `requests.get`, `response.json`, `isinstance`, `print_warning`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L112-L126](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L112-L126).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_chat_completions_http" markdown="1">
<summary><code>examples.test_openai_compatibility.test_chat_completions_http</code> · function</summary>

```python
examples.test_openai_compatibility.test_chat_completions_http(server_url: str) -> tuple[bool, str]
```

Test /v1/chat/completions with direct HTTP.

**Parameters**

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

**Returns**

- Type: `tuple[bool, str]`
- Direct return expressions: `(False, f'Status code: {response.status_code}')`; `(False, "Missing 'choices' in response")`; `(False, 'Empty choices array')`; `(False, "Missing 'message' in choice")`; `(False, "Missing 'content' in message")`; `(True, f'Response: {content[:50]}...')`; `(False, str(e))`

**Exceptions and behavior**

Function `test_chat_completions_http` calls `requests.post`, `response.json`, `len`, `str`; has 7 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L129-L170](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L129-L170).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_chat_completions_openai" markdown="1">
<summary><code>examples.test_openai_compatibility.test_chat_completions_openai</code> · function</summary>

```python
examples.test_openai_compatibility.test_chat_completions_openai(server_url: str) -> tuple[bool, str]
```

Test /v1/chat/completions with OpenAI Python client.

**Parameters**

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

**Returns**

- Type: `tuple[bool, str]`
- Direct return expressions: `(False, 'OpenAI package not installed. Run: pip install openai')`; `(True, f'Response: {content[:50]}...')`; `(False, str(e))`

**Exceptions and behavior**

Function `test_chat_completions_openai` calls `OpenAI`, `client.chat.completions.create`, `str`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L173-L199](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L173-L199).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_completions_endpoint" markdown="1">
<summary><code>examples.test_openai_compatibility.test_completions_endpoint</code> · function</summary>

```python
examples.test_openai_compatibility.test_completions_endpoint(server_url: str) -> tuple[bool, str]
```

Test /v1/completions endpoint (legacy).

**Parameters**

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

**Returns**

- Type: `tuple[bool, str]`
- Direct return expressions: `(False, f'Status code: {response.status_code}')`; `(False, "Missing 'choices' in response")`; `(False, 'Empty choices array')`; `(True, f'Response: {text[:50]}...')`; `(False, str(e))`

**Exceptions and behavior**

Function `test_completions_endpoint` calls `requests.post`, `response.json`, `len`, `data['choices'][0].get`; has 5 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L202-L233](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L202-L233).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_image_chat_http" markdown="1">
<summary><code>examples.test_openai_compatibility.test_image_chat_http</code> · function</summary>

```python
examples.test_openai_compatibility.test_image_chat_http(server_url: str) -> tuple[bool, str]
```

Test multimodal image chat with direct HTTP.

**Parameters**

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

**Returns**

- Type: `tuple[bool, str]`
- Direct return expressions: `(False, f'Status code: {response.status_code}, Body: {response.text[:100]}')`; `(True, f'Response: {content[:50]}...')`; `(False, str(e))`

**Exceptions and behavior**

Function `test_image_chat_http` calls `create_test_image`, `base64.b64encode(image_bytes).decode`, `base64.b64encode`, `requests.post`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L236-L278](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L236-L278).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_image_chat_openai" markdown="1">
<summary><code>examples.test_openai_compatibility.test_image_chat_openai</code> · function</summary>

```python
examples.test_openai_compatibility.test_image_chat_openai(server_url: str) -> tuple[bool, str]
```

Test multimodal image chat with OpenAI client.

**Parameters**

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

**Returns**

- Type: `tuple[bool, str]`
- Direct return expressions: `(False, 'OpenAI package not installed')`; `(True, f'Response: {content[:50]}...')`; `(False, str(e))`

**Exceptions and behavior**

Function `test_image_chat_openai` calls `create_test_image`, `base64.b64encode(image_bytes).decode`, `base64.b64encode`, `OpenAI`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L281-L322](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L281-L322).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_image_url_http" markdown="1">
<summary><code>examples.test_openai_compatibility.test_image_url_http</code> · function</summary>

```python
examples.test_openai_compatibility.test_image_url_http(server_url: str) -> tuple[bool, str]
```

Test image from URL.

**Parameters**

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

**Returns**

- Type: `tuple[bool, str]`
- Direct return expressions: `(False, f'Status code: {response.status_code}')`; `(True, f'Response: {content[:80]}...')`; `(False, str(e))`

**Exceptions and behavior**

Function `test_image_url_http` calls `requests.post`, `response.json`, `str`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L325-L363](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L325-L363).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_streaming_chat" markdown="1">
<summary><code>examples.test_openai_compatibility.test_streaming_chat</code> · function</summary>

```python
examples.test_openai_compatibility.test_streaming_chat(server_url: str) -> tuple[bool, str]
```

Test streaming chat completions.

**Parameters**

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

**Returns**

- Type: `tuple[bool, str]`
- Direct return expressions: `(False, f'Status code: {response.status_code}')`; `(False, 'No streaming chunks received')`; `(True, f'Received {len(chunks)} streaming chunks')`; `(False, str(e))`

**Exceptions and behavior**

Function `test_streaming_chat` calls `requests.post`, `response.iter_lines`, `line.decode`, `line.startswith`; has 4 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L366-L405](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L366-L405).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.create_test_video" markdown="1">
<summary><code>examples.test_openai_compatibility.create_test_video</code> · function</summary>

```python
examples.test_openai_compatibility.create_test_video() -> tuple[str, bytes]
```

Create a simple test video with colored frames.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `tuple[str, bytes]`
- Direct return expressions: `(temp_path, video_bytes)`; `(None, None)`

**Exceptions and behavior**

Function `create_test_video` calls `tempfile.NamedTemporaryFile`, `temp_file.close`, `cv2.VideoWriter_fourcc`, `cv2.VideoWriter`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L408-L449](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L408-L449).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_video_chat_http" markdown="1">
<summary><code>examples.test_openai_compatibility.test_video_chat_http</code> · function</summary>

```python
examples.test_openai_compatibility.test_video_chat_http(server_url: str) -> tuple[bool, str]
```

Test multimodal video chat with direct HTTP.

**Parameters**

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

**Returns**

- Type: `tuple[bool, str]`
- Direct return expressions: `(False, 'Could not create test video (OpenCV required)')`; `(False, f'Status code: {response.status_code}, Body: {response.text[:100]}')`; `(True, f'Response: {content[:80]}...')`; `(False, str(e))`

**Exceptions and behavior**

Function `test_video_chat_http` calls `create_test_video`, `base64.b64encode(video_bytes).decode`, `base64.b64encode`, `requests.post`; has 4 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L452-L498](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L452-L498).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_video_chat_openai" markdown="1">
<summary><code>examples.test_openai_compatibility.test_video_chat_openai</code> · function</summary>

```python
examples.test_openai_compatibility.test_video_chat_openai(server_url: str) -> tuple[bool, str]
```

Test multimodal video chat with OpenAI client.

**Parameters**

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

**Returns**

- Type: `tuple[bool, str]`
- Direct return expressions: `(False, 'OpenAI package not installed')`; `(False, 'Could not create test video (OpenCV required)')`; `(True, f'Response: {content[:80]}...')`; `(False, str(e))`

**Exceptions and behavior**

Function `test_video_chat_openai` calls `create_test_video`, `base64.b64encode(video_bytes).decode`, `base64.b64encode`, `OpenAI`; has 4 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L501-L546](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L501-L546).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.test_video_url_http" markdown="1">
<summary><code>examples.test_openai_compatibility.test_video_url_http</code> · function</summary>

```python
examples.test_openai_compatibility.test_video_url_http(server_url: str) -> tuple[bool, str]
```

Test video from URL.

**Parameters**

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

**Returns**

- Type: `tuple[bool, str]`
- Direct return expressions: `(False, f'Status code: {response.status_code}')`; `(True, f'Response: {content[:80]}...')`; `(False, str(e))`

**Exceptions and behavior**

Function `test_video_url_http` calls `requests.post`, `response.json`, `str`; has 3 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L549-L587](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L549-L587).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.run_all_tests" markdown="1">
<summary><code>examples.test_openai_compatibility.run_all_tests</code> · function</summary>

```python
examples.test_openai_compatibility.run_all_tests(server_url: str, test_image: bool = True, test_video: bool = True) -> not annotated
```

Run all compatibility tests.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `server_url` | `str` | `yes` | `none` | Required positional or keyword input. |
| `test_image` | `bool` | `no` | `True` | Optional positional or keyword input; defaults to `True`. |
| `test_video` | `bool` | `no` | `True` | Optional positional or keyword input; defaults to `True`. |

**Returns**

- Type: `not annotated`
- Direct return expressions: `0`; `1`

**Exceptions and behavior**

Function `run_all_tests` calls `print_header`, `print`, `test_health_endpoint`, `print_test`; has 2 explicit return paths.
No direct `raise` statement appears in this definition.

[View source #L590-L684](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L590-L684).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.run_all_tests.record" markdown="1">
<summary><code>examples.test_openai_compatibility.run_all_tests.record</code> · nested function</summary>

```python
examples.test_openai_compatibility.run_all_tests.record(passed: bool) -> not annotated
```

Nested Function `run_all_tests.record` contains no state mutation, call, raise, return, await, or yield.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `passed` | `bool` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Nested Function `run_all_tests.record` contains no state mutation, call, raise, return, await, or yield.
No direct `raise` statement appears in this definition.

[View source #L594-L598](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L594-L598).

</details>

<details class="api-contract" id="contract-examples.test_openai_compatibility.main" markdown="1">
<summary><code>examples.test_openai_compatibility.main</code> · function</summary>

```python
examples.test_openai_compatibility.main() -> not annotated
```

Function `main` calls `argparse.ArgumentParser`, `parser.add_argument`, `parser.parse_args`, `print`; returns `run_all_tests(server_url=args.server_url, test_image=not args.no_image, test_video=not args.no_video)`.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`
- Direct return expressions: `run_all_tests(server_url=args.server_url, test_image=not args.no_image, test_video=not args.no_video)`

**Exceptions and behavior**

Function `main` calls `argparse.ArgumentParser`, `parser.add_argument`, `parser.parse_args`, `print`; returns `run_all_tests(server_url=args.server_url, test_image=not args.no_image, test_video=not args.no_video)`.
No direct `raise` statement appears in this definition.

[View source #L687-L735](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L687-L735).

</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 |
| --- | --- | --- | --- | --- |
| [`print_header`](#contract-examples.test_openai_compatibility.print_header) | function | `print_header(text: str) -> not annotated` | Print a section header. | [#L37-L41](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L37-L41) |
| [`print_test`](#contract-examples.test_openai_compatibility.print_test) | function | `print_test(name: str, passed: bool, message: str = '') -> not annotated` | Print test result. | [#L44-L49](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L44-L49) |
| [`print_warning`](#contract-examples.test_openai_compatibility.print_warning) | function | `print_warning(text: str) -> not annotated` | Print a warning message. | [#L52-L54](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L52-L54) |
| [`create_test_image`](#contract-examples.test_openai_compatibility.create_test_image) | function | `create_test_image() -> tuple[str, bytes]` | Create a simple test image and return (path, bytes). | [#L57-L97](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L57-L97) |
| [`test_health_endpoint`](#contract-examples.test_openai_compatibility.test_health_endpoint) | function | `test_health_endpoint(server_url: str) -> bool` | Test the /health endpoint. | [#L100-L109](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L100-L109) |
| [`test_models_endpoint`](#contract-examples.test_openai_compatibility.test_models_endpoint) | function | `test_models_endpoint(server_url: str) -> bool` | Test the /v1/models endpoint. | [#L112-L126](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L112-L126) |
| [`test_chat_completions_http`](#contract-examples.test_openai_compatibility.test_chat_completions_http) | function | `test_chat_completions_http(server_url: str) -> tuple[bool, str]` | Test /v1/chat/completions with direct HTTP. | [#L129-L170](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L129-L170) |
| [`test_chat_completions_openai`](#contract-examples.test_openai_compatibility.test_chat_completions_openai) | function | `test_chat_completions_openai(server_url: str) -> tuple[bool, str]` | Test /v1/chat/completions with OpenAI Python client. | [#L173-L199](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L173-L199) |
| [`test_completions_endpoint`](#contract-examples.test_openai_compatibility.test_completions_endpoint) | function | `test_completions_endpoint(server_url: str) -> tuple[bool, str]` | Test /v1/completions endpoint (legacy). | [#L202-L233](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L202-L233) |
| [`test_image_chat_http`](#contract-examples.test_openai_compatibility.test_image_chat_http) | function | `test_image_chat_http(server_url: str) -> tuple[bool, str]` | Test multimodal image chat with direct HTTP. | [#L236-L278](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L236-L278) |
| [`test_image_chat_openai`](#contract-examples.test_openai_compatibility.test_image_chat_openai) | function | `test_image_chat_openai(server_url: str) -> tuple[bool, str]` | Test multimodal image chat with OpenAI client. | [#L281-L322](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L281-L322) |
| [`test_image_url_http`](#contract-examples.test_openai_compatibility.test_image_url_http) | function | `test_image_url_http(server_url: str) -> tuple[bool, str]` | Test image from URL. | [#L325-L363](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L325-L363) |
| [`test_streaming_chat`](#contract-examples.test_openai_compatibility.test_streaming_chat) | function | `test_streaming_chat(server_url: str) -> tuple[bool, str]` | Test streaming chat completions. | [#L366-L405](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L366-L405) |
| [`create_test_video`](#contract-examples.test_openai_compatibility.create_test_video) | function | `create_test_video() -> tuple[str, bytes]` | Create a simple test video with colored frames. | [#L408-L449](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L408-L449) |
| [`test_video_chat_http`](#contract-examples.test_openai_compatibility.test_video_chat_http) | function | `test_video_chat_http(server_url: str) -> tuple[bool, str]` | Test multimodal video chat with direct HTTP. | [#L452-L498](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L452-L498) |
| [`test_video_chat_openai`](#contract-examples.test_openai_compatibility.test_video_chat_openai) | function | `test_video_chat_openai(server_url: str) -> tuple[bool, str]` | Test multimodal video chat with OpenAI client. | [#L501-L546](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L501-L546) |
| [`test_video_url_http`](#contract-examples.test_openai_compatibility.test_video_url_http) | function | `test_video_url_http(server_url: str) -> tuple[bool, str]` | Test video from URL. | [#L549-L587](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L549-L587) |
| [`run_all_tests`](#contract-examples.test_openai_compatibility.run_all_tests) | function | `run_all_tests(server_url: str, test_image: bool = True, test_video: bool = True) -> not annotated` | Run all compatibility tests. | [#L590-L684](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L590-L684) |
| [`run_all_tests.record`](#contract-examples.test_openai_compatibility.run_all_tests.record) | nested function | `run_all_tests.record(passed: bool) -> not annotated` | Nested Function `run_all_tests.record` contains no state mutation, call, raise, return, await, or yield. | [#L594-L598](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L594-L598) |
| [`main`](#contract-examples.test_openai_compatibility.main) | function | `main() -> not annotated` | Function `main` calls `argparse.ArgumentParser`, `parser.add_argument`, `parser.parse_args`, `print`; returns `run_all_tests(server_url=args.server_url, test_image=not args.no_image, test_video=not args.no_video)`. | [#L687-L735](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/test_openai_compatibility.py#L687-L735) |
