SuiBian AI 接口文档
AI视频/图片生成接口,支持多种模型处理与任务状态查询
支持异步任务
接口概览
接口地址
https://api.yutangxiaowu.cn/api/ai/douyin
请求方法
POST (推荐) / GET
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| type | string | 选填 |
默认为 process。
|
| model | string | 选填 | 默认为 SuiBian/process |
| url | string | 视情况 |
素材图片或视频的URL。 多张图片用英文逗号 , 分隔。video_process 模式下必填。
|
| ugc_text | array | 生成时必填 |
提示词配置数组。格式:
[
{
"type": 2,
"content": "简短提示词",
"full_word": "完整详细描述"
}
]
|
| task_id | string | 查询时必填 | 任务ID,用于查询生成进度和结果。 |
代码示例
Node.js - 创建生成任务
const axios = require('axios');
const url = 'https://api.yutangxiaowu.cn/api/ai/douyin';
const payload = {
type: 'process',
ugc_text: [
{
type: 2,
content: "赛博朋克风格",
full_word: "一个穿着赛博朋克风格衣服的女孩站在霓虹灯下"
}
],
url: "https://example.com/image.jpg" // 多个图片用逗号分隔
};
axios.post(url, payload)
.then(res => console.log('Task ID:', res.data.data.task_id))
.catch(err => console.error(err));
Python - 创建生成任务
import requests
import json
url = "https://api.yutangxiaowu.cn/api/ai/douyin"
payload = {
"type": "process",
"ugc_text": [
{
"type": 2,
"content": "赛博朋克风格",
"full_word": "一个穿着赛博朋克风格衣服的女孩站在霓虹灯下"
}
],
"url": "https://example.com/image.jpg"
}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers)
print(response.json())
PHP - 创建生成任务
$url = 'https://api.yutangxiaowu.cn/api/ai/douyin';
$data = [
'type' => 'process',
'ugc_text' => [
[
'type' => 2,
'content' => '赛博朋克风格',
'full_word' => '一个穿着赛博朋克风格衣服的女孩'
]
],
'url' => 'https://example.com/image.jpg'
];
$options = [
'http' => [
'header' => "Content-type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump(json_decode($result, true));
Java (OkHttp) - 创建生成任务
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
String jsonBody = "{\"type\":\"process\",\"ugc_text\":[{\"type\":2,\"content\":\"赛博朋克\",\"full_word\":\"描述...\"}],\"url\":\"https://example.com/1.jpg\"}";
RequestBody body = RequestBody.create(mediaType, jsonBody);
Request request = new Request.Builder()
.url("https://api.yutangxiaowu.cn/api/ai/douyin")
.post(body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
Go - 创建生成任务
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.yutangxiaowu.cn/api/ai/douyin"
payload := strings.NewReader(`{
"type": "process",
"ugc_text": [{"type":2,"content":"赛博朋克","full_word":"描述"}],
"url": "https://example.com/1.jpg"
}`)
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}在线测试工具
响应结果
获取到 Task ID: