> ## 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>
