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

# 認證

> API 金鑰、傳遞方式與可呼叫的端點。

## API 金鑰

Blon API 金鑰以 `blon_api_` 開頭，在[開發者主控台](https://blon.ai/console/keys)建立與撤銷。金鑰屬於已開通 API 平台的工作區，每個請求都固定在該工作區。

以 Bearer token 帶入：

```bash theme={null}
curl https://api.blon.ai/v1/balance \
  -H "Authorization: Bearer $BLON_API_KEY"
```

也接受 `x-api-key` header。

> [!WARNING]
>
> 金鑰只放在伺服器上。不要放進瀏覽器或行動 App，也不要送到上傳網址。

## 美元與點數

| 呼叫者 | 錢包 | 金額表示 |
| - | - | - |
| `blon_api_` 金鑰 | 工作區的 API 餘額 | `USD`，美元字串，例如 `"0.0042"` |
| CLI 登入、MCP | 你 Blon 帳號的點數 | `CREDITS` |

API 回傳的所有金額，包含餘額、估價、工作的 `cost`、用量與錯誤 `details`，都使用呼叫者的幣別。

## 權限

建立金鑰時勾選的權限決定可呼叫的端點；缺少權限回 `403 insufficient_scope`。

| 權限 | 端點 |
| - | - |
| `read` | `GET /jobs`、`GET /jobs/{id}`、`GET /models`、`GET /models/{id}`、`GET /balance`、`GET /usage` |
| `generate` | `POST /estimate`、`POST /jobs`、`POST /jobs/{id}/cancel`、`POST /uploads`、`POST /uploads/complete` |

## 錯誤

缺少、已撤銷或無法辨識的金鑰回 `401`：

```json theme={null}
{
  "error": {
    "code": "unauthorized",
    "message": "…",
    "request_id": "req_…",
    "retryable": false,
    "retry_after_seconds": null,
    "details": null
  }
}
```

`blon` CLI 與 MCP 不使用 API 金鑰，而是以你的 Blon 帳號登入；請見 [CLI](https://docs.blon.ai/zh-TW/cli.md) 與 [MCP](https://docs.blon.ai/zh-TW/how-to/mcp.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.