跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.crazyrouter.com/llms.txt

Use this file to discover all available pages before exploring further.

Crazyrouter 提供临时公网图片上传接口,用于把本地参考图转换成模型可访问的公网 URL。它适合 Kling、Veo、Seedance、Runway、Luma、MiniMax、Nano Banana Pro、Doubao Seedream 等需要 image_urlimage_urlsimage_listimagesimage_input 的接口。
临时图片默认保存 72 小时,到期自动清理。存储期内不单独按天收费;当前按用户上传额度和速率限制防滥用。

接口概览

场景接口
本地文件上传POST /v1/files/uploads
Base64 图片上传POST /v1/files/uploads/base64
远程图片转存POST /v1/files/uploads/url
通用限制:
项目当前规则
鉴权Authorization: Bearer YOUR_API_KEY
支持格式image/pngimage/jpegimage/webpimage/gif
单文件大小20MB
用户上传额度200MB / 24 小时滚动窗口
默认有效期72 小时
返回 URLhttps://media.crazyrouter.com/task-artifacts/tmp-inputs/...

本地文件上传

cURL
curl -X POST https://crazyrouter.com/v1/files/uploads \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@./reference.png" \
  -F "purpose=model_input"
返回示例:
{
  "id": "file_e5bbce820b5941409682a9c5e9ba79f1",
  "url": "https://media.crazyrouter.com/task-artifacts/tmp-inputs/2026/05/13/user-1/file_e5bbce820b5941409682a9c5e9ba79f1.png",
  "mime_type": "image/png",
  "size": 2025,
  "expires_at": "2026-05-16T04:41:35.0131789Z"
}

Base64 上传

cURL
curl -X POST https://crazyrouter.com/v1/files/uploads/base64 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "data": "data:image/png;base64,iVBORw0KGgoAAA...",
    "filename": "reference.png",
    "purpose": "model_input"
  }'

远程 URL 转存

cURL
curl -X POST https://crazyrouter.com/v1/files/uploads/url \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "url": "https://example.com/reference.png",
    "filename": "reference.png",
    "purpose": "model_input"
  }'
远程 URL 必须是 Crazyrouter 服务端可访问的 httphttps 图片地址。系统会做文件大小、MIME 类型和 SSRF 防护检查。

实际案例:本地参考图用于 Kling 图生视频

第一步,上传本地参考图:
cURL
UPLOAD_RESPONSE=$(curl -sS -X POST https://crazyrouter.com/v1/files/uploads \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@./portrait.png" \
  -F "purpose=model_input")

IMAGE_URL=$(python -c "import json,sys; print(json.load(sys.stdin)['url'])" <<< "$UPLOAD_RESPONSE")
echo "$IMAGE_URL"
第二步,把返回的 IMAGE_URL 传给 Kling 图生视频:
cURL
curl -X POST https://crazyrouter.com/kling/v1/videos/image2video \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "{
    \"model_name\": \"kling-v3\",
    \"prompt\": \"图片中的人物缓缓转头并微笑,镜头轻微推进,电影级光影\",
    \"image_urls\": [\"$IMAGE_URL\"],
    \"duration\": \"5\",
    \"mode\": \"std\"
  }"
提交成功后会返回任务 ID。通过 Kling 任务查询 获取终态视频结果。
临时 URL 不是永久素材库。请在任务提交前确保 URL 仍未过期,不要把它作为长期业务图片地址保存。