生成视频
curl --request POST \
--url https://api.mountsea.ai/xai/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "小猫在吃鱼",
"model": "grok-imagine-video",
"duration": 6,
"resolution": "720P",
"images": [
"<string>"
]
}
'import requests
url = "https://api.mountsea.ai/xai/videos"
payload = {
"prompt": "小猫在吃鱼",
"model": "grok-imagine-video",
"duration": 6,
"resolution": "720P",
"images": ["<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({
prompt: '小猫在吃鱼',
model: 'grok-imagine-video',
duration: 6,
resolution: '720P',
images: ['<string>']
})
};
fetch('https://api.mountsea.ai/xai/videos', 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://api.mountsea.ai/xai/videos",
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([
'prompt' => '小猫在吃鱼',
'model' => 'grok-imagine-video',
'duration' => 6,
'resolution' => '720P',
'images' => [
'<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://api.mountsea.ai/xai/videos"
payload := strings.NewReader("{\n \"prompt\": \"小猫在吃鱼\",\n \"model\": \"grok-imagine-video\",\n \"duration\": 6,\n \"resolution\": \"720P\",\n \"images\": [\n \"<string>\"\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://api.mountsea.ai/xai/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"小猫在吃鱼\",\n \"model\": \"grok-imagine-video\",\n \"duration\": 6,\n \"resolution\": \"720P\",\n \"images\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/xai/videos")
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 \"prompt\": \"小猫在吃鱼\",\n \"model\": \"grok-imagine-video\",\n \"duration\": 6,\n \"resolution\": \"720P\",\n \"images\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"taskId": "<string>"
}XAI (Grok)
grok video generation
根据文本提示词生成视频,支持指定时长、宽高比和分辨率。 可选传入参考图片进行图生视频。 返回 taskId,使用 /xai/tasks 查询结果
POST
/
xai
/
videos
生成视频
curl --request POST \
--url https://api.mountsea.ai/xai/videos \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "小猫在吃鱼",
"model": "grok-imagine-video",
"duration": 6,
"resolution": "720P",
"images": [
"<string>"
]
}
'import requests
url = "https://api.mountsea.ai/xai/videos"
payload = {
"prompt": "小猫在吃鱼",
"model": "grok-imagine-video",
"duration": 6,
"resolution": "720P",
"images": ["<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({
prompt: '小猫在吃鱼',
model: 'grok-imagine-video',
duration: 6,
resolution: '720P',
images: ['<string>']
})
};
fetch('https://api.mountsea.ai/xai/videos', 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://api.mountsea.ai/xai/videos",
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([
'prompt' => '小猫在吃鱼',
'model' => 'grok-imagine-video',
'duration' => 6,
'resolution' => '720P',
'images' => [
'<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://api.mountsea.ai/xai/videos"
payload := strings.NewReader("{\n \"prompt\": \"小猫在吃鱼\",\n \"model\": \"grok-imagine-video\",\n \"duration\": 6,\n \"resolution\": \"720P\",\n \"images\": [\n \"<string>\"\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://api.mountsea.ai/xai/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"小猫在吃鱼\",\n \"model\": \"grok-imagine-video\",\n \"duration\": 6,\n \"resolution\": \"720P\",\n \"images\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mountsea.ai/xai/videos")
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 \"prompt\": \"小猫在吃鱼\",\n \"model\": \"grok-imagine-video\",\n \"duration\": 6,\n \"resolution\": \"720P\",\n \"images\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"taskId": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
视频描述提示词(最大 1000 字符)
Maximum string length:
1000Example:
"小猫在吃鱼"
视频模型
Available options:
grok-imagine-video, grok-imagine-video-1.5 Example:
"grok-imagine-video"
视频时长(秒)
Available options:
6, 10, 12, 16, 20 视频宽高比
Available options:
2:3, 3:2, 1:1, 9:16, 16:9 视频分辨率。1080P 仅 grok-imagine-video-1.5 支持;grok-imagine-video 最高 720P
Available options:
480P, 720P, 1080P 参考图片 URL(图生视频,最多 5 张;提供后视频尺寸跟随图片,aspectRatio 和 resolution 将被忽略)
Maximum array length:
5Response
200 - application/json
任务 ID,用于后续查询结果
⌘I