# Models List Query API

Client tools or third-party applications can dynamically fetch the list of platform models available to the current API Key via the endpoints below (the system automatically filters by available channels, token model whitelists, and user-tier visibility). Both **OpenAI Standard Protocol** and **Google Gemini Native Protocol** are supported.

### 1. Using OpenAI Protocol
* **Method**: `GET {baseUrl}/v1/models` (if the entered endpoint URL already ends with `/v1`, it will not be duplicated; e.g., `https://www.tokenpad.ai` requests `https://www.tokenpad.ai/v1/models`; also compatible with Volcengine Ark path `GET /api/v3/models`)
* **Headers**:
```http
Authorization: Bearer <API Key>
```
* **Request Example (Curl)**:
```bash
curl -X GET https://www.tokenpad.ai/v1/models \
  -H "Authorization: Bearer sk-your_token"
```
* **Response Parsing**: Read the `data` array in the returned JSON and extract the `id` field of each item (i.e., standard OpenAI `/v1/models` format `{ "data": [{ "id": "model-name" }] }`):
```json
{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "created": 1719441600,
      "owned_by": "OpenAI"
    },
    {
      "id": "gemini-2.5-flash",
      "object": "model",
      "created": 1719441600,
      "owned_by": "Google"
    }
  ]
}
```

### 2. Using Gemini Protocol
* **Method**: `GET {baseUrl}/v1beta/models` (if the URL already ends with `/v1` or `/v1beta`, `/models` is appended directly; e.g., request `https://www.tokenpad.ai/v1beta/models` or pass `x-goog-api-key` to request `https://www.tokenpad.ai/v1/models`)
* **Headers**:
```http
x-goog-api-key: <API Key>
Content-Type: application/json
```
*(Note: Accessing `/v1beta/models` also supports the `?key=<API Key>` query parameter or `Authorization: Bearer <API Key>` header)*
* **Request Example (Curl)**:
```bash
curl -X GET https://www.tokenpad.ai/v1beta/models \
  -H "x-goog-api-key: sk-your_token" \
  -H "Content-Type: application/json"
```
* **Response Parsing**: Read the `models` array in the returned JSON and extract each item's `name` field with the leading `models/` prefix stripped (i.e., Google Gemini native format `{ "models": [{ "name": "models/gemini-..." }] }`):
```json
{
  "models": [
    {
      "name": "models/gemini-2.5-flash",
      "baseModelId": "gemini-2.5-flash",
      "displayName": "Gemini 2.5 Flash",
      "description": "Google Gemini 2.5 Flash multimodal model",
      "supportedGenerationMethods": [
        "generateContent",
        "streamGenerateContent"
      ]
    }
  ]
}
```