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

# ​快速開始

# [​](#快速開始)快速開始

歡迎使用我們的API服務！本指南將幫助您快速開始使用圖像和視頻生成功能。

## [​](#第一步：獲取api密鑰)第一步：獲取API密鑰

1. 訪問 [API密鑰管理頁面](https://toapis.com/console/token)
2. 登錄您的賬戶
3. 創建新的API密鑰
4. 保存您的密鑰（密鑰只顯示一次）

## [​](#第二步：選擇模型)第二步：選擇模型

我們提供多種AI模型供您選擇：

### [​](#文字生成模型)文字生成模型

* **GPT-4o**: 強大的對話和文本生成能力
* **Claude**: Anthropic 的高性能對話模型
* **Gemini**: Google 的多模態大語言模型

### [​](#圖像生成模型)圖像生成模型

* **GPT-4o-image**: 高質量圖像生成
* **gpt-image-2**: 支持 `reference_images` 的 OpenAI 兼容圖像生成

### [​](#視頻生成模型)視頻生成模型

* **Sora2**: 專業視頻生成

## [​](#第三步：發送請求)第三步：發送請求

### [​](#文字生成示例)文字生成示例

複製

```shiki theme={null}
curl -X POST https://toapis.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {
        "role": "user",
        "content": "你好，請介紹一下你自己"
      }
    ]
  }'

```

### [​](#圖像生成示例)圖像生成示例

複製

```shiki theme={null}
curl -X POST https://toapis.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-image",
    "client_business_id": "order_20260428_001",
    "prompt": "一隻可愛的熊貓",
    "size": "1:1",
    "n": 1
  }'

```

### [​](#視頻生成示例)視頻生成示例

複製

```shiki theme={null}
curl -X POST https://toapis.com/v1/videos/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "sora-2",
    "client_business_id": "order_20260428_002",
    "prompt": "海浪拍打着海岸",
    "duration": 15,
    "aspect_ratio": "16:9"
  }'

```

<Note>
  `client_business_id` 是您的業務 ID，例如訂單號、流水號或您系統內的任務 ID。創建圖片或視頻任務時傳入後，可用它查詢任務狀態：
  `GET /v1/images/generations/{client_business_id}` 或 `GET /v1/videos/generations/{client_business_id}`。
</Note>

## [​](#第四步：查詢任務狀態)第四步：查詢任務狀態

由於我們使用異步處理模式，您需要查詢任務狀態來獲取結果：
複製

```shiki theme={null}
curl -X GET https://toapis.com/v1/images/generations/order_20260428_001 \
  -H "Authorization: Bearer YOUR_API_KEY"

```

## [​](#下一步)下一步

<CardGroup cols={2}>
  <Card title="查看 API 文檔" icon="book" href="./index">
    詳細瞭解所有可用的 API 接口。
  </Card>

  <Card title="Claude Code 集成" icon="code" href="./integrations/claude-code">
    瞭解如何將 API 集成到您的開發工作流。
  </Card>
</CardGroup>
