API 文档API Docs
获取 API KeyGet API Key

Claude API 概览Claude API Overview

通过 StoryClaw 中转接入 Claude 大语言模型,无需科学上网。接口兼容 Anthropic 官方 SDK,替换 Base URL 后即可使用。

Access Claude LLMs via StoryClaw relay — no VPN required. Compatible with the official Anthropic SDK. Just swap the base URL.

🌐
接口地址Base URL
https://router.storyclaw.com
所有 Claude API 请求均发往此地址。
All Claude API requests go to this URL.
🔑
认证方式Authentication
Authorization: Bearer YOUR_API_KEY
在请求头中传递 API Key,格式固定为 Bearer Token。
Pass your API Key in the request header as a Bearer Token.
支持模型Supported Models
claude-opus-4-7 claude-sonnet-4-6 claude-haiku-4-5
1
获取 API KeyGet an API Key
前往 控制台 → API Keys 创建密钥,格式为 sk-xxxxxxxx
Go to Dashboard → API Keys to create a key. Format: sk-xxxxxxxx.
2
安装 SDKInstall SDK
使用官方 Anthropic SDK,Python:pip install anthropic;Node.js:npm install @anthropic-ai/sdk
Use the official Anthropic SDK. Python: pip install anthropic · Node.js: npm install @anthropic-ai/sdk.
3
替换 Base URLSet Base URL
初始化 SDK 时将 base_url 设为 https://router.storyclaw.com,其他用法与官方完全一致。
Set base_url to https://router.storyclaw.com when initializing the SDK. Everything else is identical to the official Anthropic API.
安全提示Security — 切勿将 API Key 提交到公开代码仓库,如密钥泄露请立即在控制台重新生成。 — Never commit your API Key to a public repository. Regenerate it immediately if leaked.
Python
import anthropic

# 将 base_url 替换为 StoryClaw 中转地址
client = anthropic.Anthropic(
    api_key="YOUR_API_KEY",
    base_url="https://router.storyclaw.com",
)

msg = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}]
)
print(msg.content[0].text)
Node.js
import Anthropic from '@anthropic-ai/sdk';

// 将 baseURL 替换为 StoryClaw 中转地址
const client = new Anthropic({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://router.storyclaw.com',
});

const msg = await client.messages.create({
  model: 'claude-sonnet-4-6',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(msg.content[0].text);
cURL
curl --request POST \
  --url https://router.storyclaw.com/v1/messages \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [{"role":"user","content":"Hello!"}]
  }'

消息接口Messages

向 Claude 发送对话消息,同步获得回复。支持多轮对话、系统提示词与流式输出(SSE)。

Send messages to Claude and receive responses synchronously. Supports multi-turn conversations, system prompts, and streaming (SSE).

POST https://router.storyclaw.com/v1/messages
认证Authorization
Authorization string header required
Bearer Token 认证,值为 Bearer YOUR_API_KEY
Body application/json
modelenum<string>required
模型名称。Model identifier.
claude-opus-4-7 claude-sonnet-4-6 claude-haiku-4-5
messagesarrayrequired
对话消息列表,每条含 roleuserassistant)与 content(字符串)。
Conversation messages. Each has role (user/assistant) and content (string).
max_tokensintegerrequired
最大生成 Token 数,通常 1024–16384,不同模型上限不同。
Maximum tokens to generate. Typically 1024–16384, varies by model.
systemstringoptional
系统提示词,定义模型角色与行为。
System prompt to define the model's role and behavior.
temperaturenumberoptionaldefault: 1
采样温度 0–1,越高输出越随机,0 为确定性。
Sampling temperature 0–1. Higher = more random; 0 = deterministic.
streambooleanoptionaldefault: false
开启 SSE 流式输出,适合实时展示场景。
Enable SSE streaming for real-time display.
响应Response
idstring
消息唯一 ID,格式 Message ID, format msg_xxxxxxxx
contentarray
返回内容块,通常为 [{type:"text", text:"..."}]
Content blocks, typically [{type:"text", text:"..."}]
stop_reasonenum
end_turnmax_tokensstop_sequence
usageobject
input_tokens & output_tokens
请求示例Request
curl --request POST \
  --url https://router.storyclaw.com/v1/messages \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "system": "You are a helpful assistant.",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'
响应示例Response
200 OKapplication/json
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "model": "claude-sonnet-4-6",
  "content": [
    { "type": "text", "text": "Hello! How can I help?" }
  ],
  "stop_reason": "end_turn",
  "usage": { "input_tokens": 12, "output_tokens": 18 }
}

Seedance 2.0 概览Seedance 2.0 Overview

Seedance 2.0 是字节跳动推出的高质量视频生成模型,通过 StoryClaw 接入支持文生视频、图生视频和多模态 OmniVideo 三种生成模式。

Seedance 2.0 is ByteDance's high-quality video generation model. Via StoryClaw, it supports Text-to-Video, Image-to-Video, and multi-modal OmniVideo generation.

🌐
接口地址Base URL
https://models.storyclaw.com
所有 Seedance 视频任务均通过此地址提交。
All Seedance video tasks are submitted to this URL.
🔑
认证方式Authentication
Authorization: Bearer YOUR_API_KEY
与 Claude API 使用同一个 API Key。
Uses the same API Key as the Claude API.
⚙️
处理模式Processing Model
异步任务Async Task
提交任务后返回 task_id,通过查询接口轮询状态直到完成(status = 2)。视频链接有效期通常为 24 小时,请及时保存。
Submit a task to get a task_id, then poll the query endpoint until status = 2 (completed). Video URLs typically expire in 24 hours — save them promptly.
任务状态码Task Status Codes
0
排队中 — 任务已提交,等待调度Queued — submitted, waiting to be scheduled
1
处理中 — 模型正在生成视频Processing — model is generating the video
2
已完成 — 结果 URL 可用Completed — result URL is available
3
失败 — 请查看 error_msg 字段Failed — check the error_msg field
典型调用流程Typical Flow
# Step 1: 提交任务
curl --request POST \
  --url https://models.storyclaw.com/v1/router/task/create \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --data '{"task":"Txt2Video","model":"seedance-2.0-pro","mode":"pro","input":{...}}'

# Response → 获得 task_id
{ "code": 200, "task_id": "Txt2Video_seedance-2.0-pro_xxx" }

# Step 2: 轮询任务状态(每 3-5 秒一次)
curl --request GET \
  --url https://models.storyclaw.com/v1/router/tasks/Txt2Video_seedance-2.0-pro_xxx \
  --header 'Authorization: Bearer YOUR_API_KEY'

# status=2 时任务完成
{
  "status": 2,
  "results": [{ "urls": ["https://static.giggle.pro/.../video.mp4"] }]
}
Python 轮询示例Polling Example
import requests, time

BASE = "https://models.storyclaw.com"
HDR = {"Authorization": "Bearer YOUR_API_KEY"}

# 提交任务
res = requests.post(f"{BASE}/v1/router/task/create",
    headers=HDR,
    json={"task": "Txt2Video", "model": "seedance-2.0-pro",
          "mode": "pro", "input": {"prompt": "A sunrise",
          "duration": 6, "aspect_ratio": "16:9"}}
)
task_id = res.json()["task_id"]

# 轮询直到完成
while True:
    r = requests.get(f"{BASE}/v1/router/tasks/{task_id}", headers=HDR)
    data = r.json()
    if data["status"] == 2:
        print("Done:", data["results"][0]["urls"])
        break
    elif data["status"] == 3:
        print("Failed"); break
    time.sleep(5)

文生视频Text to Video

根据文字描述生成视频,支持 4–10 秒时长、多种画幅比例与分辨率。

Generate video from a text prompt. Supports 4–10 second duration, multiple aspect ratios, and resolutions.

POST https://models.storyclaw.com/v1/router/task/create
Body application/json
taskstringrequired
固定传 Txt2Video
modelenum<string>required
seedance-2.0-pro
modestringrequired
固定传 pro
callback_urlstring<uri>optional
任务完成后的 HTTPS 回调地址,为空则需主动轮询。
HTTPS callback URL on completion. If empty, poll manually.
input.promptstringrequired
视频描述,越详细效果越好,可描述镜头运动、场景、风格等。
Video description. Be specific — include camera movement, scene, style for best results.
input.durationintegerrequired
时长(秒)
Duration in seconds
46810
input.aspect_ratioenum<string>required
16:99:161:14:3
input.resolutionenum<string>optionaldefault: 720p
720p1080p
input.generate_audiobooleanoptionaldefault: false
是否自动生成配音/音效
Auto-generate audio/sound effects
响应(200 OK)Response (200 OK)
codeinteger
200 = 任务创建成功task created successfully
task_idstring
格式 Txt2Video_{model}_{uuid},用于查询和取消。
Format: Txt2Video_{model}_{uuid}, used to query or cancel.
请求示例Request
curl --request POST \
  --url https://models.storyclaw.com/v1/router/task/create \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "task": "Txt2Video",
    "model": "seedance-2.0-pro",
    "mode": "pro",
    "callback_url": "",
    "input": {
      "prompt": "相机缓缓向前推进,人物在画面中微笑",
      "duration": 6,
      "aspect_ratio": "16:9",
      "resolution": "720p",
      "generate_audio": true
    }
  }'
响应Response
200 OK
{
  "code": 200,
  "message": "task created",
  "task_id": "Txt2Video_seedance-2.0-pro_207df23e-6a1d-41b2-b7aa-ab0c535b1db0"
}

图生视频Image to Video

以图片为首帧,结合文字描述生成视频,适合产品展示、角色动画等。

Use an image as the first frame and generate video from a text prompt. Ideal for product showcases and character animation.

POSThttps://models.storyclaw.com/v1/router/task/create
Body application/json
taskstringrequired
固定传 Img2Video
modelenumrequired
seedance-2.0-pro
input.promptstringrequired
描述图片如何运动或演变。
Describe how the image should animate or evolve.
input.imagesstring[]required
首帧图片 URL 列表,必须为公开可直接访问的链接。
First-frame image URL list. Must be publicly accessible direct links.
  • 支持格式:Formats: .jpg .png .webp
  • 单张 ≤ 20MBMax 20MB per image
input.durationintegerrequired
468
input.aspect_ratioenumrequired
16:99:161:1
input.resolutionenumoptional
720p1080p
input.generate_audiobooleanoptional
自动生成音效
Auto-generate audio
callback_urlstring<uri>optional
HTTPS 回调地址
HTTPS callback URL
请求示例Request
curl --request POST \
  --url https://models.storyclaw.com/v1/router/task/create \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "task": "Img2Video",
    "model": "seedance-2.0-pro",
    "mode": "pro",
    "callback_url": "",
    "input": {
      "prompt": "A conductor leads an orchestra joyfully",
      "images": ["https://example.com/frame.jpg"],
      "duration": 4,
      "aspect_ratio": "16:9",
      "resolution": "720p",
      "generate_audio": true
    }
  }'
响应Response
200 OK
{ "code": 200, "message": "task created",
  "task_id": "Img2Video_seedance-2.0-pro_207df23e..." }

OmniVideo

多模态视频生成,可同时传入图片、音频、参考视频,最长 10 秒,适合广告、品牌 MV 等专业场景。

Multi-modal video generation. Accepts images, audio, and reference videos simultaneously. Up to 10 seconds. Ideal for ads and brand music videos.

POSThttps://models.storyclaw.com/v1/router/task/create
Body application/json
taskstringrequired
固定传 OmniVideo
input.promptstringrequired
详细描述内容、时序与镜头运动,通过"图片1"、"音频1"、"视频1"引用媒体素材。
Describe content, timing, and camera movement. Reference media as "image1", "audio1", "video1".
input.imagesstring[]optional
参考图片 URL 列表
Reference image URLs
input.audiosstring[]optional
参考音频 URL 列表(MP3/WAV)
Reference audio URLs (MP3/WAV)
input.videosstring[]optional
参考视频 URL,用于镜头风格参考
Reference video URLs for style/composition guidance
input.durationintegerrequired
时长(秒),最大 10
Duration in seconds, max 10
input.ratioenumrequired
16:99:161:1
input.generate_audiobooleanoptional
是否生成配音,配合音频参考效果更佳
Generate audio. Works best with audio reference files
提示Tip — 在 prompt 中用"第0-3秒"、"第4-6秒"等时间段描述各段内容,结合媒体引用可实现精确的叙事控制。 — Structure the prompt with time segments ("0-3s", "4-6s") combined with media references for precise narrative control.
请求示例Request
curl --request POST \
  --url https://models.storyclaw.com/v1/router/task/create \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "task": "OmniVideo",
    "model": "seedance-2.0-pro",
    "mode": "pro",
    "callback_url": "",
    "input": {
      "prompt": "全程使用音频1作为背景音乐。0-3秒:图片1的苹果特写;4-6秒:快速切镜摇晃果茶;尾帧定格为图片2。",
      "images": [
        "https://example.com/apple.jpg",
        "https://example.com/drink.jpg"
      ],
      "audios": ["https://example.com/bgm.mp3"],
      "videos": ["https://example.com/ref.mp4"],
      "duration": 10,
      "ratio": "16:9",
      "generate_audio": true
    }
  }'
响应Response
200 OK
{ "code": 200, "message": "task created",
  "task_id": "Img2Video_seedance-2.0-pro_207df23e..." }

查询任务状态Query Task Status

通过 task_id 查询视频任务的当前状态和结果。建议轮询间隔 3–5 秒。

Query a video task's current status and result by task_id. Recommended polling interval: 3–5 seconds.

GEThttps://models.storyclaw.com/v1/router/tasks/{task_id}
路径参数Path Parameters
task_idstringrequired
创建任务时返回的 task_id,如 Txt2Video_seedance-2.0-pro_xxx
task_id returned on task creation, e.g. Txt2Video_seedance-2.0-pro_xxx
响应(200 OK)Response (200 OK)
task_idstring
任务 IDTask ID
statusinteger
0 排队1 处理中2 完成3 失败
results[].urlsstring[]
视频文件直链(status=2 时可用)
Video file URLs (available when status=2)
costinteger
本次任务消耗积分
Credits consumed
请求示例Request
curl --request GET \
  --url https://models.storyclaw.com/v1/router/tasks/Txt2Video_seedance-2.0-pro_207df23e \
  --header 'Authorization: Bearer YOUR_API_KEY'
响应(已完成)Response (Completed)
200 OK
{
  "task_id": "Txt2Video_seedance-2.0-pro_207df23e",
  "status": 2,
  "results": [{
    "urls": ["https://static.giggle.pro/.../video.mp4"],
    "provider": "ark:global:seedance-2.0-pro"
  }],
  "cost": 80
}

取消任务Cancel Task

取消排队中(status=0)或处理中(status=1)的视频任务。

Cancel a queued (status=0) or processing (status=1) video task.

POSThttps://models.storyclaw.com/v1/router/task/stop
Body application/json
task_idstringrequired
要取消的任务 ID
The task_id to cancel
请求示例Request
curl --request POST \
  --url https://models.storyclaw.com/v1/router/task/stop \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"task_id":"Txt2Video_seedance-2.0-pro_207df23e"}'
响应Response
200 OK
{ "result": {"status":2,"message":"ok"}, "error": null }

回调说明Callback

创建任务时传入 callback_url,任务完成、失败或取消后服务器主动 POST 通知,无需轮询,适合生产环境。

Provide a callback_url when creating a task. The server will POST a notification on completion, failure, or cancellation — no polling needed.

安全规则Security Rules
x-authheader
服务器回调时在请求头中携带 x-auth: YOUR_API_KEY,请在回调接口中验证此值确认请求来源合法。
The server sends x-auth: YOUR_API_KEY in callback requests. Validate this header to verify the request origin.
约束Constraints
  • 必须为 HTTPS,不支持 HTTPMust be HTTPS
  • 禁止回调到内网地址(127.x、10.x、192.168.x 等)Internal IPs are blocked (127.x, 10.x, 192.168.x)
  • 返回 2xx 视为成功,否则最多重试 3 次Return 2xx to acknowledge. Up to 3 retries on non-2xx
回调数据结构Callback Payload
task_idstring
statusinteger
2=完成completed, 3=失败failed
result.urlsstring[]
生成视频直链Generated video URLs
result.costinteger
消耗积分Credits consumed
error_msgstring
失败时的错误描述,成功时为空字符串Error description on failure, empty on success
回调数据示例Callback Payload
POST your-callback-url  ·  x-auth: YOUR_API_KEY
{
  "task_id": "Img2Video_seedance-2.0-pro_207df23e",
  "status": 2,
  "error_msg": "",
  "result": {
    "urls": ["https://static.giggle.pro/.../video.mp4"],
    "provider": "ark:global:seedance-2.0-pro",
    "cost": 60
  }
}
Python 处理示例Handler
from flask import Flask, request, jsonify

app = Flask(__name__)
MY_API_KEY = "YOUR_API_KEY"

@app.route("/callback", methods=["POST"])
def callback():
    # 验签
    if request.headers.get("x-auth") != MY_API_KEY:
        return jsonify({"error": "Unauthorized"}), 401
    data = request.json
    if data["status"] == 2:
        print("Video ready:", data["result"]["urls"])
    return jsonify({}), 200

错误码Error Codes

所有接口遵循标准 HTTP 状态码规范,请求失败时响应体包含具体错误信息。

All endpoints follow standard HTTP status codes. The response body includes error details on failure.

状态码Status含义Meaning说明Description
200OK请求成功Request succeeded
400Bad Request参数缺失或格式错误,检查请求 BodyMissing or malformed parameters. Check the request body
401UnauthorizedAPI Key 无效或未传递,检查 Authorization 头Invalid or missing API Key. Check the Authorization header
402Payment Required账户积分不足,前往控制台充值Insufficient credits. Top up in the dashboard
403Forbidden无权访问该接口或资源Access denied to this endpoint or resource
429Too Many Requests请求频率超限,请稍后重试Rate limit exceeded. Retry later
500Internal Server Error服务器内部错误,稍后重试或联系支持Server error. Retry later or contact support
更多问题?联系我们Questions? Contact us
storyclaw.com →