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

# GPT-4o

> GPT-4o: general-purpose language model. Request examples and parameters for MixRoute.

GPT-4o is a general-purpose language model from OpenAI.

Call `gpt-4o` through both the OpenAI-compatible Chat Completions API and the Responses API.

## Key capabilities

* OpenAI-compatible - Works with the OpenAI SDK by changing base\_url
* Streaming - Real-time token output through SSE
* Multi-turn conversations - Uses role-based messages
* Responses API - Uses input for text and structured content
* Reasoning control - Configure reasoning effort on supported models
* Tool use - Supports function and hosted tool definitions

## Quick example

### Chat Completions

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/chat/completions" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "gpt-4o",
      "messages": [
        {
          "role": "user",
          "content": "Explain quantum entanglement in simple terms."
        }
      ],
      "max_tokens": 256
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": "Explain quantum entanglement in simple terms."}],
        max_tokens=256,
    )

    print(response.choices[0].message.content)
    ```
  </Tab>

  <Tab title="Streaming">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    stream = client.chat.completions.create(
        model="gpt-4o",
        messages=[{"role": "user", "content": "Write a short poem about the sea."}],
        max_tokens=256,
        stream=True,
    )

    for chunk in stream:
        print(chunk.choices[0].delta.content or "", end="")
    ```
  </Tab>
</Tabs>

### Responses API

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/responses" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "gpt-4o",
      "input": [
        {
          "role": "user",
          "content": "Explain quantum entanglement in simple terms."
        }
      ],
      "max_output_tokens": 256
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    response = client.responses.create(
        model="gpt-4o",
        input="Explain quantum entanglement in simple terms.",
        max_output_tokens=256,
    )

    print(response.output_text)
    ```
  </Tab>

  <Tab title="Streaming">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    with client.responses.stream(
        model="gpt-4o",
        input="Write a short poem about the sea.",
        max_output_tokens=256,
    ) as stream:
        for event in stream:
            if event.type == "response.output_text.delta":
                print(event.delta, end="")
    ```
  </Tab>
</Tabs>

## Parameters

### Chat Completions

| Parameter     | Type            | Required | Description                                       |
| ------------- | --------------- | -------- | ------------------------------------------------- |
| `model`       | string          | Yes      | Must be `gpt-4o`.                                 |
| `messages`    | array           | Yes      | Conversation messages with role and content.      |
| `max_tokens`  | integer         | No       | Maximum generated tokens.                         |
| `stream`      | boolean         | No       | Enable SSE streaming. Default: false.             |
| `temperature` | number          | No       | Sampling temperature when supported by the model. |
| `top_p`       | number          | No       | Nucleus sampling threshold when supported.        |
| `stop`        | string \| array | No       | Sequences that stop generation.                   |
| `tools`       | array           | No       | OpenAI-compatible tool definitions.               |

### Responses API

| Parameter           | Type            | Required | Description                           |
| ------------------- | --------------- | -------- | ------------------------------------- |
| `model`             | string          | Yes      | Must be `gpt-4o`.                     |
| `input`             | string \| array | Yes      | Text or structured response input.    |
| `max_output_tokens` | integer         | No       | Maximum output tokens.                |
| `stream`            | boolean         | No       | Enable SSE streaming. Default: false. |
| `tools`             | array           | No       | Tools the model may call.             |
| `store`             | boolean         | No       | Whether to store the response.        |
