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

# 快速開始

> 提交第一個生成任務，輪詢到完成，然後下載結果。

WideRouter 的每一個任務都是同樣三步，與你生成的是圖片還是影片無關，也與選哪個模型無關。

<Info>
  \*\*腳手架提示。\*\*下面的端點路徑和欄位名是倉庫初始化時的佔位，替換為真實介面後需要重新生成各語種頁面。
</Info>

## 獲取 API Key

在控制台建立令牌，然後匯出成環境變數供下面的示例讀取。
**任何情況下都不要把真實 Key 寫死進會提交的檔案。**

```bash theme={null}
export WIDEROUTER_API_KEY="sk-your-api-key"
```

## 建立任務

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.widerouter.com/v1/tasks \
    -H "Authorization: Bearer $WIDEROUTER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "your-model-id",
      "prompt": "黃昏時分的燈塔"
    }'
  ```

  ```python Python theme={null}
  import os, requests

  resp = requests.post(
      "https://api.widerouter.com/v1/tasks",
      headers={"Authorization": f"Bearer {os.environ['WIDEROUTER_API_KEY']}"},
      json={"model": "your-model-id", "prompt": "黃昏時分的燈塔"},
      timeout=30,
  )
  task_id = resp.json()["id"]
  ```
</CodeGroup>

呼叫會立刻返回一個任務 id，生成在後臺進行。

## 輪詢到完成

帶退避地輪詢任務端點，直到狀態進入終態，然後下載任務產出的內容。

<Warning>
  用退避輪詢，不要死迴圈。起步間隔兩秒左右逐步拉長；每 100 毫秒打一次的客戶端
  只會更快撞上限流，不會更早拿到結果。
</Warning>

## 下一步

<CardGroup cols={2}>
  <Card title="模型" icon="layers">
    每個模型接受哪些參數、預設值是什麼。
  </Card>

  <Card title="API 參考" icon="terminal">
    完整的請求與響應結構，帶互動式 Playground。
  </Card>
</CardGroup>
