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

# 上传图片

> 上传图片文件用于图生图、图生视频等任务

## 说明

上传本地图片文件，获取可在 API 中使用的 URL。

## 请求示例

```bash cURL theme={null}
curl https://api.qclawrouter.com/v1/files \
  -H "Authorization: Bearer sk-your-api-key" \
  -F "file=@/path/to/image.jpg" \
  -F "purpose=image"
```

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

with open("image.jpg", "rb") as f:
    response = requests.post(
        "https://api.qclawrouter.com/v1/files",
        headers={"Authorization": "Bearer sk-your-api-key"},
        files={"file": f},
        data={"purpose": "image"}
    )

url = response.json()["url"]
print(url)  # 使用此 URL 传入其他 API
```

## 返回示例

```json theme={null}
{
  "id": "file_xxx",
  "url": "https://cdn.qclawrouter.com/uploads/xxx.jpg",
  "size": 102400,
  "created_at": 1677652288
}
```
