创建自定义主体
curl --request POST \
--url https://geekai.co/api/v1/elements/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "test-element",
"model": "kling-element-v2",
"description": "<string>",
"image": "<string>",
"images": [
"<string>"
],
"videos": [
"<string>"
],
"voice_id": "<string>",
"tag_list": [
{
"tag_id": "<string>"
}
]
}
'import requests
url = "https://geekai.co/api/v1/elements/create"
payload = {
"name": "test-element",
"model": "kling-element-v2",
"description": "<string>",
"image": "<string>",
"images": ["<string>"],
"videos": ["<string>"],
"voice_id": "<string>",
"tag_list": [{ "tag_id": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'test-element',
model: 'kling-element-v2',
description: '<string>',
image: '<string>',
images: ['<string>'],
videos: ['<string>'],
voice_id: '<string>',
tag_list: [{tag_id: '<string>'}]
})
};
fetch('https://geekai.co/api/v1/elements/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://geekai.co/api/v1/elements/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'test-element',
'model' => 'kling-element-v2',
'description' => '<string>',
'image' => '<string>',
'images' => [
'<string>'
],
'videos' => [
'<string>'
],
'voice_id' => '<string>',
'tag_list' => [
[
'tag_id' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://geekai.co/api/v1/elements/create"
payload := strings.NewReader("{\n \"name\": \"test-element\",\n \"model\": \"kling-element-v2\",\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"videos\": [\n \"<string>\"\n ],\n \"voice_id\": \"<string>\",\n \"tag_list\": [\n {\n \"tag_id\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://geekai.co/api/v1/elements/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"test-element\",\n \"model\": \"kling-element-v2\",\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"videos\": [\n \"<string>\"\n ],\n \"voice_id\": \"<string>\",\n \"tag_list\": [\n {\n \"tag_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/v1/elements/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"test-element\",\n \"model\": \"kling-element-v2\",\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"videos\": [\n \"<string>\"\n ],\n \"voice_id\": \"<string>\",\n \"tag_list\": [\n {\n \"tag_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>",
"task_status": "pending",
"task_result": {
"voices": [
{
"voice_id": "<string>",
"voice_name": "<string>"
}
]
}
}{
"code": "validation_error",
"message": "参数验证失败",
"details": {
"field": "错误描述"
}
}{
"code": "unauthorized",
"message": "Invalid API key or token"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}视频模型
创建主体
POST
/
elements
/
create
创建自定义主体
curl --request POST \
--url https://geekai.co/api/v1/elements/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "test-element",
"model": "kling-element-v2",
"description": "<string>",
"image": "<string>",
"images": [
"<string>"
],
"videos": [
"<string>"
],
"voice_id": "<string>",
"tag_list": [
{
"tag_id": "<string>"
}
]
}
'import requests
url = "https://geekai.co/api/v1/elements/create"
payload = {
"name": "test-element",
"model": "kling-element-v2",
"description": "<string>",
"image": "<string>",
"images": ["<string>"],
"videos": ["<string>"],
"voice_id": "<string>",
"tag_list": [{ "tag_id": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'test-element',
model: 'kling-element-v2',
description: '<string>',
image: '<string>',
images: ['<string>'],
videos: ['<string>'],
voice_id: '<string>',
tag_list: [{tag_id: '<string>'}]
})
};
fetch('https://geekai.co/api/v1/elements/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://geekai.co/api/v1/elements/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'test-element',
'model' => 'kling-element-v2',
'description' => '<string>',
'image' => '<string>',
'images' => [
'<string>'
],
'videos' => [
'<string>'
],
'voice_id' => '<string>',
'tag_list' => [
[
'tag_id' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://geekai.co/api/v1/elements/create"
payload := strings.NewReader("{\n \"name\": \"test-element\",\n \"model\": \"kling-element-v2\",\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"videos\": [\n \"<string>\"\n ],\n \"voice_id\": \"<string>\",\n \"tag_list\": [\n {\n \"tag_id\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://geekai.co/api/v1/elements/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"test-element\",\n \"model\": \"kling-element-v2\",\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"videos\": [\n \"<string>\"\n ],\n \"voice_id\": \"<string>\",\n \"tag_list\": [\n {\n \"tag_id\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://geekai.co/api/v1/elements/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"test-element\",\n \"model\": \"kling-element-v2\",\n \"description\": \"<string>\",\n \"image\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"videos\": [\n \"<string>\"\n ],\n \"voice_id\": \"<string>\",\n \"tag_list\": [\n {\n \"tag_id\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>",
"task_status": "pending",
"task_result": {
"voices": [
{
"voice_id": "<string>",
"voice_name": "<string>"
}
]
}
}{
"code": "validation_error",
"message": "参数验证失败",
"details": {
"field": "错误描述"
}
}{
"code": "unauthorized",
"message": "Invalid API key or token"
}{
"code": "invalid_request",
"message": "请求参数不合法"
}用于创建自定义主体,创建自定义主体可用于视频生成场景,目前仅可灵支持。
授权
bearerAuthapiKeyAuth
API认证token
请求体
application/json
主体名称
示例:
"test-element"
模型ID
示例:
"kling-element-v2"
主体描述
主体参考方式
可用选项:
video_refer, image_refer 正面参考图URL/Base64编码
其他参考图URL/Base64编码
参考视频URL/Base64编码
音色ID,用于指定生成的音色
为主体配置标签列表
Show child attributes
Show child attributes
此页面对您有帮助吗?
