# نظرة عامة والمصادقة (واجهة API الأساسية)

The Basic API authenticates with an **API Call Token (`sk-xxx`)** for AI model inference and querying the current token's own quota, call logs, and available models. You can create and manage API Call Tokens in Console **Token Management**.

> [!IMPORTANT]
> - **Base URL**: `https://ai.artsmcp.com`
> - **Key Location**: Create in Console **Token Management** (prefixed with `sk-`)
> - **Time Format**: Timestamps are uniformly formatted in the **site operating timezone** (e.g., `2026-11-29 21:30:00 (UTC+8)`)

---

### 1. Basic API Endpoints

| Module | Endpoint | Description |
| :--- | :--- | :--- |
| **Model Inference** | `/v1/*`, `/v1beta/*`, etc. | Invoke chat, image, video, audio, and embedding models (OpenAI, Anthropic, Gemini, Volcengine Ark protocols) |
| **Token Quota & Info** | `GET /v1/balance` | Query the current token's real-time quota, period usage, and limit configuration |
| **Current Token Logs** | `GET /v1/logs` | Paginated query of call logs and cost/token summaries generated by the current token |
| **Current Token Async Tasks** | `GET /v1/task_logs` | Paginated query of video/image async tasks and preview URLs created by the current token |
| **Available Models** | `GET /v1/models`, `GET /v1beta/models`, `GET /anthropic/v1/models` | Dynamically list available models and query single-model details for the current token |

---

### 2. Authentication

All Basic API endpoints authenticate directly with your **API Call Token (`sk-xxx`)** via any of the headers or query parameters below, compatible with backend services and third-party clients (Claude Code, Codex, Cursor, Cline, Cherry Studio, etc.):

| Method | Example | Applicable Clients |
| :--- | :--- | :--- |
| **Bearer Header (Recommended)** | `Authorization: Bearer sk-your_api_token` | Standard REST / OpenAI SDK (case-insensitive scheme; also supports `Token <key>`) |
| **Anthropic / Compatible Header** | `x-api-key: sk-your_api_token` | Anthropic SDK / Claude Code / Volcengine Ark |
| **Google Header / Query Param** | `x-goog-api-key: sk-your_api_token` or `?key=sk-your_api_token` | Google GenAI SDK / Gemini |

* **Header Example**:

```http
Authorization: Bearer sk-your_api_token
```

---

### 3. Common Status Codes

| HTTP Status | Common Causes |
| :--- | :--- |
| `401 Unauthorized` | Missing authentication header, invalid format, or nonexistent token |
| `402 Payment Required` | Insufficient available account balance |
| `403 Forbidden` | Token disabled, expired, quota/count exhausted, or model/IP not whitelisted |
| `404 Not Found` | Model does not exist or is not allowed for the current token |
| `429 Too Many Requests` | Token RPS / RPM rate limit or query rate limit exceeded |
