# واجهة برمجة تطبيقات الاستعلام عن قائمة النماذج

Use your **API Call Token (`sk-xxx`)** to dynamically fetch available models or query single-model details (filtered by the token's model whitelist and account visibility). Compatible with **OpenAI**, **Anthropic Messages SDK**, and **Google Gemini Native Protocol**.

> [!IMPORTANT]
> - **Base URL**: `https://ai.artsmcp.com`
> - **Auth Header**: `Authorization: Bearer sk-your_api_token` for OpenAI; `x-api-key` for Anthropic; `x-goog-api-key` or `?key=sk-your_api_token` for Gemini
> - **Single Model Lookup**: Returns HTTP `404` if the model does not exist or is not allowed for the current token

---

### 1. OpenAI / Anthropic Protocol Models & Details

Compatible with OpenAI SDK, Anthropic SDK, Claude Code, and Volcengine Ark. When the `anthropic-version` header is present or `/anthropic/v1/models` is requested, responses automatically include Anthropic fields (`type`, `display_name`, `created_at`, `has_more`, `first_id`, `last_id`) while preserving OpenAI `object` / `data[].id` compatibility.

* **List Path**: `GET /v1/models` (also supports `/api/v3/models`, `/anthropic/v1/models`, `/api/compatible/v1/models`)
* **Detail Path**: `GET /v1/models/{model_id}` (also supports `/api/v3/models/{model_id}`, `/anthropic/v1/models/{model_id}`, `/api/compatible/v1/models/{model_id}`)
* **Example (Curl)**:

```bash
curl -s "https://ai.artsmcp.com/v1/models" \
  -H "Authorization: Bearer sk-your_api_token"
```

* **Response Example**:

```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"
    }
  ]
}
```

* **Response Fields**:

| Field | Type | Description |
| :--- | :--- | :--- |
| `object` | `string` | Always `"list"` |
| `data` | `array` | List of models available to the current token |
| `data[].id` | `string` | Callable model ID (e.g., `gpt-4o`) |
| `data[].object` | `string` | Always `"model"` |
| `data[].created` | `integer` | Model creation timestamp (Unix seconds) |
| `data[].owned_by` | `string` | Model provider name (e.g., `OpenAI`, `Google`) |

---

### 2. Google Gemini Native Protocol Models & Details

Compatible with Google GenAI SDK. Read `baseModelId` or strip the `models/` prefix from `models[].name` to obtain the callable model ID.

* **List Path**: `GET /v1beta/models` (sending `x-goog-api-key` to `/v1/models` also returns Gemini format)
* **Detail Path**: `GET /v1beta/models/{model_id}`
* **Example (Curl)**:

```bash
curl -s "https://ai.artsmcp.com/v1beta/models" \
  -H "x-goog-api-key: sk-your_api_token" \
  -H "Content-Type: application/json"
```

* **Response Example**:

```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"
      ]
    }
  ]
}
```

* **Response Fields**:

| Field | Type | Description |
| :--- | :--- | :--- |
| `models` | `array` | List of models in Gemini format available to the current token |
| `models[].name` | `string` | Full resource name prefixed with `models/` (e.g., `models/gemini-2.5-flash`) |
| `models[].baseModelId` | `string` | Callable base model ID |
| `models[].displayName` | `string` | Display name of the model |
| `models[].description` | `string` | Model description |
| `models[].supportedGenerationMethods` | `string[]` | Supported generation methods (e.g., `generateContent`, `streamGenerateContent`) |
