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

# Call OpenAI GPTs via API Using gpt-4-gizmo Model Names

> Call any public OpenAI GPT at POST /v1/chat/completions by using the gpt-4-gizmo-{id} model name. Find GPT IDs from their ChatGPT URLs.

KiosAPI lets you call any GPT available on the OpenAI website via the API using a special model naming convention. Instead of accessing GPTs only through the ChatGPT interface, you can integrate them directly into your applications by constructing the correct model name from the GPT's public URL.

## How to Use

To call a GPT, use the prefix `gpt-4-gizmo-` followed by the GPT's ID, which you can find in its URL on the OpenAI website.

For example, the GPT at:

```
https://chat.openai.com/g/g-bo0FiWLY7-researchgpt
```

corresponds to the model name:

```
gpt-4-gizmo-g-bo0FiWLY7
```

<Info>
  Browse thousands of available GPTs at [GPTs Hunter](https://www.gptshunter.com/) to find one that fits your use case.
</Info>

## Request

**POST** `https://kiosapi.com/v1/chat/completions`

### Headers

| Header          | Required | Description        |
| --------------- | -------- | ------------------ |
| `Content-Type`  | Yes      | `application/json` |
| `Authorization` | Yes      | `Bearer sk-xxx`    |

### Request Body

<ParamField body="model" type="string" required>
  GPT model name in the format `gpt-4-gizmo-{gizmo_id}` (e.g. `gpt-4-gizmo-g-bo0FiWLY7`).
</ParamField>

<ParamField body="messages" type="array" required>
  Array of message objects forming the conversation.

  <Expandable title="messages properties">
    <ParamField body="messages[].role" type="string" required>
      Role of the message author: `system` or `user`.
    </ParamField>

    <ParamField body="messages[].content" type="string" required>
      The text content of the message.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="temperature" type="number">
  Sampling temperature between 0 and 2.
</ParamField>

<ParamField body="stream" type="boolean">
  Set to `true` to stream the response using server-sent events.
</ParamField>

<ParamField body="max_tokens" type="number">
  Maximum number of tokens to generate in the response.
</ParamField>

### Examples

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl https://kiosapi.com/v1/chat/completions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer sk-xxx" \
      -d '{
        "model": "gpt-4-gizmo-g-bo0FiWLY7",
        "messages": [
          {
            "role": "user",
            "content": "What is the potential of quantum computing?"
          }
        ],
        "max_tokens": 1688,
        "temperature": 0.5,
        "stream": false
      }'
    ```
  </Tab>

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

    openai.api_key = "sk-xxx"
    openai.base_url = "https://kiosapi.com/v1/"

    response = openai.chat.completions.create(
        model="gpt-4-gizmo-g-bo0FiWLY7",
        messages=[
            {"role": "user", "content": "What is the potential of quantum computing?"}
        ],
        max_tokens=1688,
        temperature=0.5,
        stream=False
    )

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

## Response

```json theme={null}
{
  "id": "chatcmpl-89DbGj4xWTyI7ddcPHTqDolMi0MGn",
  "object": "chat.completion",
  "created": 1724999207,
  "model": "gpt-4-gizmo",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Quantum computing shows tremendous potential..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 30,
    "completion_tokens": 835,
    "total_tokens": 865
  }
}
```
