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.
sk-xxxxxxxx。
sk-xxxxxxxx.
pip install anthropic;Node.js:npm
install @anthropic-ai/sdk。
pip install anthropic ·
Node.js: npm install @anthropic-ai/sdk.
base_url 设为
https://router.storyclaw.com,其他用法与官方完全一致。
base_url to https://router.storyclaw.com when
initializing the SDK. Everything else is identical to the official Anthropic API.
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)
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 --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!"}] }'
Anthropic消息接口Anthropic Messages
向 Claude 发送对话消息,同步获得回复。支持多轮对话、系统提示词与流式输出(SSE)。
Send messages to Claude and receive responses synchronously. Supports multi-turn conversations, system prompts, and streaming (SSE).
Bearer YOUR_API_KEYrole(user 或
assistant)与 content(字符串)。
role (user/assistant)
and content (string).
msg_xxxxxxxx[{type:"text", text:"..."}][{type:"text", text:"..."}]input_tokens & output_tokenscurl --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!"} ] }'
{
"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 }
}
Gemini消息接口Gemini Messages
向 Gemini 发送对话内容,同步获得生成结果。请求体使用 Google Gemini
generateContent 格式,支持文本 parts 与生成参数配置。
Send conversational content to Gemini and receive generated output synchronously. The
request body follows Google Gemini's generateContent format with text parts and generation
settings.
Bearer YOUR_API_KEYrole(如 user 或
model)与 parts 数组。
role such as
user or model, plus a parts array.
0.7。0.7.
256。256.promptTokenCount, candidatesTokenCount & totalTokenCount
curl --location 'https://router.storyclaw.com/models/{model}:generateContent' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "contents": [ { "role": "user", "parts": [ { "text": "你好,请用一句话介绍你自己。" } ] } ], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 256 } }'
{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{ "text": "你好!我是 Gemini,可以帮助你进行文本生成、理解和创作。" }
]
},
"finishReason": "STOP"
}
],
"usageMetadata": {
"promptTokenCount": 12,
"candidatesTokenCount": 18,
"totalTokenCount": 30
}
}
OpenAI消息接口OpenAI Messages
向 OpenAI 兼容的 Chat Completions 接口发送对话消息,同步获得回复。请求体使用 messages
格式,适合从 OpenAI SDK 或现有 Chat Completions 调用迁移。
Send conversation messages to the OpenAI-compatible Chat Completions endpoint and
receive a synchronous response. The request body uses the messages format for easy migration from
existing OpenAI SDK or Chat Completions calls.
Bearer YOUR_API_KEYrole(如 system、user
或 assistant)与 content(字符串)。
role such as
system, user, or assistant, plus string content.
8192。8192.prompt_tokens, completion_tokens & total_tokens
curl --location 'https://router.storyclaw.com/chat/completions' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "model": "gpt-5.4", "messages": [ {"role": "user", "content": "Say ping in one word."} ], "max_tokens": 8192 }'
{
"id": "chatcmpl_01H8YxK4n9qP",
"object": "chat.completion",
"model": "gpt-5.4",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "ping"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 1,
"total_tokens": 15
}
}
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.
task_id,通过查询接口轮询状态直到完成(status =
2)。视频链接有效期通常为 24 小时,请及时保存。
task_id, then poll the query endpoint
until status = 2 (completed). Video URLs typically expire in 24 hours — save them promptly.
# 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"] }] }
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)
创建资产
上传图片、视频或音频素材为 Seedance 任务资产。传入文件直链与资产元信息,任务完成后可在后续生成任务中引用。
Upload image, video, or audio files as Seedance task assets. Provide a direct file URL and asset metadata so the uploaded asset can be referenced by later generation tasks.
FileUploadFileUpload.ark-uploadpropro.group-20260610155306-lgw6lgroup-20260610155306-lgw6l.SkipSkip.- 格式:Formats:
jpegpngwebpbmptiffgifheic/heif - 宽高比(W/H):0.4 ~ 2.5Aspect ratio (W/H): 0.4 ~ 2.5
- 宽/高:300 ~ 6000 pxWidth/height: 300 ~ 6000 px
- 大小:单张 < 30MBSize: < 30MB per image
- 格式:Formats:
mp4mov - 分辨率:480p、720p、1080pResolution: 480p, 720p, 1080p
- 时长:2 ~ 15 秒Duration: 2 ~ 15 seconds
- 宽高比(W/H):0.4 ~ 2.5Aspect ratio (W/H): 0.4 ~ 2.5
- 宽/高:300 ~ 6000 pxWidth/height: 300 ~ 6000 px
- 总像素(W×H):409600 ~ 2086876Total pixels (W×H): 409600 ~ 2086876
- 大小:单个视频 ≤ 50MBSize: ≤ 50MB per video
- FPS:24 ~ 60FPS: 24 ~ 60
- 格式:Formats:
wavmp3 - 时长:2 ~ 15 秒Duration: 2 ~ 15 seconds
- 大小:单个音频 ≤ 15MBSize: ≤ 15MB per audio
200 = 上传任务创建成功upload task created successfully
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": "FileUpload", "model": "ark-upload", "mode": "pro", "callback_url": "", "input": { "file": "https://hs.17hd.com/duan.wav", "pass_through": { "groupid": "group-20260610155306-lgw6l", "name": "Cobra Test Audio", "assettype": "Audio", "Moderation": { "Strategy": "Skip" } } } }'
{
"code": 200,
"message": "task created",
"task_id": "FileUpload_ark-upload_207df23e-6a1d-41b2-b7aa-ab0c535b1db0"
}
文生视频Text to Video
根据文字描述生成视频,支持 4–10 秒时长、多种画幅比例与分辨率。
Generate video from a text prompt. Supports 4–10 second duration, multiple aspect ratios, and resolutions.
Txt2Videopro200 = 任务创建成功task created successfully
Txt2Video_{model}_{uuid},用于查询和取消。Txt2Video_{model}_{uuid}, used to query or cancel.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 } }'
{
"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.
Img2Video- 支持格式:Formats:
.jpg.png.webp - 单张 ≤ 20MBMax 20MB per image
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 } }'
{ "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.
OmniVideocurl --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 } }'
{ "code": 200, "message": "task created",
"task_id": "Img2Video_seedance-2.0-pro_207df23e..." }
Kling V2.6 概览Kling V2.6 Overview
Kling V2.6 是快手可灵推出的视频生成模型,支持从文字或图片生成高质量视频,并提供音画同步的一体化生成能力。
Kling V2.6 is Kuaishou Kling's video generation model for creating high-quality videos from text or images, with integrated audio-video generation capabilities.
task_id,通过查询接口轮询状态直到完成(status =
2)。视频链接有效期通常为 24 小时,请及时保存。
task_id, then poll the query endpoint
until status = 2 (completed). Video URLs typically expire in 24 hours — save them promptly.
# Step 1: 提交任务 curl --request POST \ --url https://models.storyclaw.com/v1/router/task/create \ --header 'Authorization: Bearer YOUR_API_KEY' \ --data '{"task":"Txt2Video","model":"kling-v2-6","mode":"pro","input":{...}}' # Response → 获得 task_id { "code": 200, "task_id": "Txt2Video_kling-v2-6_xxx" } # Step 2: 轮询任务状态(每 3-5 秒一次) curl --request GET \ --url https://models.storyclaw.com/v1/router/tasks/Txt2Video_kling-v2-6_xxx \ --header 'Authorization: Bearer YOUR_API_KEY' # status=2 时任务完成 { "status": 2, "results": [{ "urls": ["https://static.giggle.pro/.../video.mp4"] }] }
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": "kling-v2-6", "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
根据文字描述生成视频,支持 5 或 10 秒时长,以及 16:9、9:16、1:1 画幅比例。
Generate video from a text prompt. Supports 5 or 10 second duration and 16:9, 9:16, 1:1 aspect ratios.
Txt2Videopro200 = 任务创建成功task created successfully
Txt2Video_{model}_{uuid},用于查询和取消。Txt2Video_{model}_{uuid}, used to query or cancel.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": "kling-v2-6", "mode": "pro", "callback_url": "", "input": { "prompt": "相机缓缓向前推进,人物在画面中微笑", "duration": "5", "aspect_ratio": "16:9", "generate_audio": true } }'
{
"code": 200,
"message": "task created",
"task_id": "Txt2Video_kling-v2-6_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.
Img2Video.jpg / .jpeg / .png;文件大小不能超过 10MB;图片宽高尺寸不小于
300px;图片宽高比介于 1:2.5 ~ 2.5:1 之间。
.jpg / .jpeg / .png; max file size: 10MB; width and
height must each be at least 300px; aspect ratio must be between 1:2.5 and 2.5:1.
- 最多 2 张:第 1 张为首帧,第 2 张为尾帧Up to 2 images: first = start frame, second = end frame
- 支持格式:Formats:
.jpg.jpeg.png - 单张 ≤ 10MBMax 10MB per image
- 宽高均 ≥ 300pxWidth and height each ≥ 300px
- 宽高比:1:2.5 ~ 2.5:1Aspect ratio: 1:2.5 ~ 2.5:1
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": "kling-v2-6", "mode": "pro", "callback_url": "", "input": { "prompt": "A conductor leads an orchestra joyfully", "images": ["https://example.com/frame.jpg"], "duration": "5", "aspect_ratio": "16:9", "generate_audio": true } }'
{ "code": 200, "message": "task created",
"task_id": "Img2Video_kling-v2-6_207df23e..." }
Nano Banana 2 概览Nano Banana 2 Overview
Nano Banana 2(Gemini 3.1 Flash Image)是 Google DeepMind 推出的图像生成与编辑模型,在 Flash 速度下结合 Pro 级视觉质量、世界知识和更快的高级编辑能力。
Nano Banana 2 (Gemini 3.1 Flash Image) is Google DeepMind's image generation and editing model, combining Pro-level visual quality, world knowledge, and faster advanced editing at Flash speed.
task_id,通过查询接口轮询状态直到完成(status =
2)。结果链接有效期通常为 24 小时,请及时保存。
task_id, then poll the query endpoint
until status = 2 (completed). Result URLs typically expire in 24 hours — save them promptly.
# Step 1: 提交任务 curl --request POST \ --url https://models.storyclaw.com/v1/router/task/create \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{"model":"nano-banana-2","input":{...}}' # Response → 获得 task_id { "code": 200, "task_id": "NanoBanana2_xxx" } # Step 2: 轮询任务状态(每 3-5 秒一次) curl --request GET \ --url https://models.storyclaw.com/v1/router/tasks/NanoBanana2_xxx \ --header 'Authorization: Bearer YOUR_API_KEY' # status=2 时任务完成 { "status": 2, "results": [{ "urls": ["https://static.giggle.pro/.../image.png"] }] }
文生图Text to Image
使用 Nano Banana 2 原生文生图能力,将自然语言提示词转成高质量图片,支持多种画幅比例、分辨率与输出格式。
Use Nano Banana 2's native text-to-image capability to turn natural-language prompts into high-quality images with multiple aspect ratios, resolutions, and output formats.
Txt2ImgTxt2Img.nano-banana-2fastfast.200 = 任务创建成功task created successfully
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": "Txt2Img", "model": "nano-banana-2", "mode": "fast", "callback_url": "https://example.com/results", "input": { "prompt": "A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art", "aspect_ratio": "1:1", "resolution": "2K", "output_format": "jpg" } }'
{
"code": 200,
"message": "task created",
"task_id": "Txt2Img_nano-banana-2_207df23e-6a1d-41b2-b7aa-ab0c535b1db0"
}
图生图Image to Image
使用 Nano Banana 2 图生图能力,基于输入图片和提示词进行转换或参考生成,支持最多 14 张参考图片。
Use Nano Banana 2's image-to-image capability to transform input images or use them as references with a prompt, supporting up to 14 reference images.
Img2ImgImg2Img.nano-banana-2fastfast.image/jpeg、image/png、image/webp,单张最大 30.0MB。
image/jpeg,
image/png, image/webp. Max size: 30.0MB per image.
200 = 任务创建成功task created successfully
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": "Img2Img", "model": "nano-banana-2", "mode": "fast", "callback_url": "", "input": { "prompt": "Keep the model's pose and the flowing shape of the liquid dress unchanged. Change the clothing material from silver metal to completely transparent clear water (or glass). Through the liquid water, the model's skin details are visible. Lighting changes from reflection to refraction.", "images": [ "https://static.giggle.pro/ipimg/airouter/20260205/Img2Img_nano-banana-pro_fba4791d-0668-4892-9fe0-3393454d5cc5/b6884e67c55c3a195fb3597b1a09963b.png" ], "resolution": "2K" } }'
{
"code": 200,
"message": "task created",
"task_id": "Img2Img_nano-banana-2_207df23e-6a1d-41b2-b7aa-ab0c535b1db0"
}
GPT Image 2 概览GPT Image 2 Overview
GPT Image 2 是 OpenAI 的先进图像生成模型,支持快速、高质量的图像生成与编辑,并可处理灵活尺寸和高保真的图像输入。
GPT Image 2 is OpenAI's state-of-the-art image generation model for fast, high-quality image generation and editing, with flexible image sizes and high-fidelity image inputs.
task_id,通过查询接口轮询状态直到完成(status =
2)。结果链接有效期通常为 24 小时,请及时保存。
task_id, then poll the query endpoint
until status = 2 (completed). Result URLs typically expire in 24 hours — save them promptly.
# Step 1: 提交任务 curl --request POST \ --url https://models.storyclaw.com/v1/router/task/create \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{"model":"gpt-image-2","input":{...}}' # Response → 获得 task_id { "code": 200, "task_id": "GPTImage2_xxx" } # Step 2: 轮询任务状态(每 3-5 秒一次) curl --request GET \ --url https://models.storyclaw.com/v1/router/tasks/GPTImage2_xxx \ --header 'Authorization: Bearer YOUR_API_KEY' # status=2 时任务完成 { "status": 2, "results": [{ "urls": ["https://static.giggle.pro/.../image.png"] }] }
文生图Text to Image
使用 GPT Image 2 文生图能力,将自然语言提示词转成高质量图片,支持多种画幅比例与分辨率。
Use GPT Image 2's text-to-image capability to turn natural-language prompts into high-quality images with multiple aspect ratios and resolutions.
Txt2ImgTxt2Img.gpt-image-2-text-to-imagefastfast.200 = 任务创建成功task created successfully
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": "Txt2Img", "model": "gpt-image-2-text-to-image", "mode": "fast", "callback_url": "https://example.com/results", "input": { "prompt": "A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art", "aspect_ratio": "auto", "resolution": "2K" } }'
{
"code": 200,
"message": "task created",
"task_id": "Txt2Img_gpt-image-2-text-to-image_207df23e-6a1d-41b2-b7aa-ab0c535b1db0"
}
图生图Image to Image
使用 GPT Image 2 图生图能力,基于输入图片 URL 和提示词生成或编辑图片,支持多种画幅比例与分辨率。
Use GPT Image 2's image-to-image capability to generate or edit images from input image URLs and a prompt, with multiple aspect ratios and resolutions.
Img2ImgImg2Img.gpt-image-2-image-to-imagefastfast.200 = 任务创建成功task created successfully
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": "Img2Img", "model": "gpt-image-2-image-to-image", "mode": "fast", "callback_url": "https://example.com/results", "input": { "prompt": "A surreal painting of a giant banana floating in space, stars and galaxies in the background, vibrant colors, digital art", "images": ["https://example.com/input.png"], "aspect_ratio": "auto", "resolution": "2K" } }'
{
"code": 200,
"message": "task created",
"task_id": "Img2Img_gpt-image-2-image-to-image_207df23e-6a1d-41b2-b7aa-ab0c535b1db0"
}
音乐生成Music Generation
使用 SUNO V5 生成带歌词或纯音乐的音频任务。接口采用异步任务模式,提交后返回 task_id,可通过查询接口轮询结果或配置回调接收通知。
Generate lyrical or instrumental music with SUNO V5. This is an async task endpoint: submit a task to receive a task_id, then poll for results or configure callbacks.
MusicMusic.V5V5.fastfast.customMode=false 时必填;customMode=true 且 instrumental=false 时必填;customMode=true 且 instrumental=true 时可选。V5 自定义模式最长 5000 字符,非自定义模式最长 500 字符。customMode=false; required when customMode=true and instrumental=false; optional when customMode=true and instrumental=true. V5 custom mode supports up to 5000 characters; non-custom mode supports up to 500.true 时按自定义模式校验 style、title、prompt 的条件必填;false 时仅 prompt 必填,其他自定义参数应留空。true, style, title, and prompt follow custom-mode conditional requirements. When false, only prompt is required and other custom parameters should be empty.customMode=true 时,纯音乐需要 style 和 title;非纯音乐需要 style、prompt 和 title。customMode=true, instrumental tracks require style and title; non-instrumental tracks require style, prompt, and title.customMode=true 时必填;customMode=false 时应留空。V5 最长 1000 字符。customMode=true; should be empty when customMode=false. V5 maximum length: 1000 characters.Heavy Metal, Upbeat Drums。Heavy Metal, Upbeat Drums.0.65。0.65.0.65。0.65.https://api.example.com/callback。回调通常包含 text、first、complete 三个阶段。https://api.example.com/callback. Callbacks typically include text, first, and complete stages.200 = 任务创建成功task created successfully
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": "Music", "model": "V5", "mode": "fast", "callback_url": "", "input": { "prompt": "A calm and relaxing piano track with soft melodies", "customMode": true, "instrumental": true, "pass_through": { "title": "Peaceful Piano Meditation", "style": "Classical", "negativeTags": "Heavy Metal, Upbeat Drums", "vocalGender": "m", "styleWeight": 0.65, "weirdnessConstraint": 0.65, "audioWeight": 0.65, "callBackUrl": "https://api.example.com/callback", "personaId": "persona_123" } } }'
{
"code": 200,
"message": "task created",
"task_id": "Music_V5_207df23e-6a1d-41b2-b7aa-ab0c535b1db0"
}
查询任务状态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.
Txt2Video_seedance-2.0-pro_xxxTxt2Video_seedance-2.0-pro_xxxcurl --request GET \ --url https://models.storyclaw.com/v1/router/tasks/Txt2Video_seedance-2.0-pro_207df23e \ --header 'Authorization: Bearer YOUR_API_KEY'
{
"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.
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"}'
{ "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.
x-auth: YOUR_API_KEY,请在回调接口中验证此值确认请求来源合法。
x-auth: YOUR_API_KEY in callback requests.
Validate this header to verify the request origin.
- 必须为 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
2=完成completed,
3=失败failed{
"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
}
}
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 |
|---|---|---|
| 200 | OK | 请求成功Request succeeded |
| 400 | Bad Request | 参数缺失或格式错误,检查请求 BodyMissing or malformed parameters. Check the request body |
| 401 | Unauthorized | API Key 无效或未传递,检查 Authorization 头Invalid or missing API Key. Check the Authorization header |
| 402 | Payment Required | 账户积分不足,前往控制台充值Insufficient credits. Top up in the dashboard |
| 403 | Forbidden | 无权访问该接口或资源Access denied to this endpoint or resource |
| 429 | Too Many Requests | 请求频率超限,请稍后重试Rate limit exceeded. Retry later |
| 500 | Internal Server Error | 服务器内部错误,稍后重试或联系支持Server error. Retry later or contact support |