即梦视频生成
即梦官方 API 格式的视频生成接口。
支持通过 Action 参数指定操作类型:
CVSync2AsyncSubmitTask: 提交视频生成任务CVSync2AsyncGetResult: 获取任务结果
需要在查询参数中指定 Action 和 Version。
POST
/jimeng/即梦视频生成
即梦官方 API 格式的视频生成接口。 支持通过 Action 参数指定操作类型: - `CVSync2AsyncSubmitTask`: 提交视频生成任务 - `CVSync2AsyncGetResult`: 获取任务结果 需要在查询参数中指定 Action 和 Version。
鉴权: 使用 Bearer Token 认证。 格式: `Authorization: Bearer sk-xxxxxx`
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
Action | string | 是 | API 操作类型 位置: query |
Version | string | 是 | API 版本 位置: query |
请求体
Content-Type: application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
req_key | string | 请求类型标识 | |
prompt | string | 文本描述 | |
binary_data_base64 | array<string> | Base64 编码的图片数据 | |
[] | string |
示例代码
curl -X POST "https://api.nodeprice.com/jimeng/" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <token>" \
-d '{
"req_key": "string",
"prompt": "string",
"binary_data_base64": [
"string"
]
}'const url = "https://api.nodeprice.com/jimeng/";
const body = {
"req_key": "string",
"prompt": "string",
"binary_data_base64": [
"string"
]
};
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <token>"
},
body: JSON.stringify(body)
});
console.log(await response.text());package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://api.nodeprice.com/jimeng/"
body := strings.NewReader(`{
"req_key": "string",
"prompt": "string",
"binary_data_base64": [
"string"
]
}`)
req, err := http.NewRequest("POST", url, body)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer <token>")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
data, err := io.ReadAll(resp.Body)
if err != nil {
panic(err)
}
fmt.Println(string(data))
}import requests
url = "https://api.nodeprice.com/jimeng/"
body = """{
"req_key": "string",
"prompt": "string",
"binary_data_base64": [
"string"
]
}"""
response = requests.request("POST", url, data=body, headers={
"Content-Type": "application/json",
"Authorization": "Bearer <token>"
})
print(response.text)OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n"
+ " \"req_key\": \"string\",\n"
+ " \"prompt\": \"string\",\n"
+ " \"binary_data_base64\": [\n"
+ " \"string\"\n"
+ " ]\n"
+ "}");
Request request = new Request.Builder()
.url("https://api.nodeprice.com/jimeng/")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer <token>")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());#include <stdio.h>
#include <curl/curl.h>
int main(void) {
CURL *curl = curl_easy_init();
if (curl == NULL) {
return 1;
}
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer <token>");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.nodeprice.com/jimeng/");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\n"
+ " \"req_key\": \"string\",\n"
+ " \"prompt\": \"string\",\n"
+ " \"binary_data_base64\": [\n"
+ " \"string\"\n"
+ " ]\n"
+ "}");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
CURLcode code = curl_easy_perform(curl);
if (code != CURLE_OK) {
fprintf(stderr, "%s\n", curl_easy_strerror(code));
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
return 0;
}using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.nodeprice.com/jimeng/");
request.Headers.Add("Authorization", "Bearer <token>");
request.Content = new StringContent("{\n"
+ " \"req_key\": \"string\",\n"
+ " \"prompt\": \"string\",\n"
+ " \"binary_data_base64\": [\n"
+ " \"string\"\n"
+ " ]\n"
+ "}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}响应
200 成功处理请求
Content-Type: application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
code | integer | 响应码 | |
message | string | 响应消息 | |
data | object | 响应数据 |
400 请求参数错误
Content-Type: application/json
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
error | object | ||
message | string | 错误信息 | |
type | string | 错误类型 | |
param | string | null | 相关参数 | |
code | string | null | 错误代码 |