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

# List Models (OpenAI)

> <ul><li>Retrieve the currently available model list.</li><li>Automatically detects the response format from request headers:</li><li>Returns Anthropic format when the `x-api-key` and `anthropic-version` headers are present</li><li>Returns Gemini format when the `x-goog-api-key` header or `key` query parameter is present</li></ul>

<RequestExample>
  ```bash cURL theme={null} theme={null}
  curl --request GET \
    --url 'https://api.elkapi.com/v1/models?key=key_value' \
    --header 'Authorization: Bearer <token>'
  ```

  ```python Python theme={null} theme={null}
  import requests

  url = "https://api.elkapi.com/v1/models?key=key_value"
  headers = {
      "Authorization": "Bearer <token>"
  }

  response = requests.request("GET", url, headers=headers)
  print(response.json())
  ```

  ```javascript JavaScript theme={null} theme={null}
  const url = "https://api.elkapi.com/v1/models?key=key_value";

  const headers = {
    "Authorization": "Bearer <token>"
  };

  const response = await fetch(url, { method: "GET", headers });
  console.log(await response.json());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null} theme={null}
  {
    "object": "list",
    "data": [
      {
        "id": "gpt-4",
        "object": "model",
        "created": 1,
        "owned_by": "openai"
      }
    ]
  }
  ```

  ```json 401 theme={null} theme={null}
  {
    "error": {
      "message": "message",
      "type": "type",
      "param": "param",
      "code": "code"
    }
  }
  ```
</ResponseExample>

## Authorizations

<ParamField header="Authorization" type="string" required>
  All endpoints require Bearer Token authentication.

  Add it to the request headers:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Query Parameters

<ParamField query="key" type="string">
  Google API Key (for Gemini format)
</ParamField>

## Response

<ResponseField name="object" type="string">
  Example: `list`
</ResponseField>

<ResponseField name="data" type="array<object>">
  <ResponseField name="data.id" type="string">
    Model ID

    Example: `gpt-4`
  </ResponseField>

  <ResponseField name="data.object" type="string">
    Object type

    Example: `model`
  </ResponseField>

  <ResponseField name="data.created" type="integer">
    Creation timestamp
  </ResponseField>

  <ResponseField name="data.owned_by" type="string">
    Model owner

    Example: `openai`
  </ResponseField>
</ResponseField>
