# model 可填 "grok-imagine-1.5-video-apimart",也兼容别名 "grok-imagine-1.5-video-ext"
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.5-video-apimart",
"prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
"size": "16:9",
"duration": 6,
"quality": "720p"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "grok-imagine-1.5-video-apimart",
"prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
"size": "16:9",
"duration": 6,
"quality": "720p"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "grok-imagine-1.5-video-apimart",
prompt: "一只狗在海滩上奔跑,阳光明媚,慢镜头",
size: "16:9",
duration: 6,
quality: "720p"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"task_id": "task_01JNXXXXXXXXXXXXXXXXXX",
"status": "submitted"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 403,
"message": "访问被禁止,您没有权限访问此资源",
"type": "permission_error"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "服务器内部错误,请稍后重试",
"type": "server_error"
}
}
{
"error": {
"code": 502,
"message": "网关错误,服务器暂时不可用",
"type": "bad_gateway"
}
}
Grok Imagine 1.5
Grok Imagine 1.5 视频生成
- 异步处理模式,返回任务ID用于后续查询
- 高质量AI视频生成,支持文生视频、图生视频
- 灵活的比例与质量选择,满足不同创作需求
POST
/
v1
/
videos
/
generations
# model 可填 "grok-imagine-1.5-video-apimart",也兼容别名 "grok-imagine-1.5-video-ext"
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.5-video-apimart",
"prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
"size": "16:9",
"duration": 6,
"quality": "720p"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "grok-imagine-1.5-video-apimart",
"prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
"size": "16:9",
"duration": 6,
"quality": "720p"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "grok-imagine-1.5-video-apimart",
prompt: "一只狗在海滩上奔跑,阳光明媚,慢镜头",
size: "16:9",
duration: 6,
quality: "720p"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"task_id": "task_01JNXXXXXXXXXXXXXXXXXX",
"status": "submitted"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 403,
"message": "访问被禁止,您没有权限访问此资源",
"type": "permission_error"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "服务器内部错误,请稍后重试",
"type": "server_error"
}
}
{
"error": {
"code": 502,
"message": "网关错误,服务器暂时不可用",
"type": "bad_gateway"
}
}
模型名兼容提示:本接口同时兼容别名
grok-imagine-1.5-video-ext,它等价于 grok-imagine-1.5-video-apimart,两者可互换使用、效果一致。# model 可填 "grok-imagine-1.5-video-apimart",也兼容别名 "grok-imagine-1.5-video-ext"
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.5-video-apimart",
"prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
"size": "16:9",
"duration": 6,
"quality": "720p"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "grok-imagine-1.5-video-apimart",
"prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
"size": "16:9",
"duration": 6,
"quality": "720p"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "grok-imagine-1.5-video-apimart",
prompt: "一只狗在海滩上奔跑,阳光明媚,慢镜头",
size: "16:9",
duration: 6,
quality: "720p"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"task_id": "task_01JNXXXXXXXXXXXXXXXXXX",
"status": "submitted"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 403,
"message": "访问被禁止,您没有权限访问此资源",
"type": "permission_error"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "服务器内部错误,请稍后重试",
"type": "server_error"
}
}
{
"error": {
"code": 502,
"message": "网关错误,服务器暂时不可用",
"type": "bad_gateway"
}
}
认证
所有接口均需要使用 Bearer Token 进行认证获取 API Key:访问 API Key 管理页面 获取您的 API Key使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求参数
视频生成模型名称支持的模型:
grok-imagine-1.5-video-apimart- Grok 视频生成(兼容别名grok-imagine-1.5-video-ext)
"grok-imagine-1.5-video-apimart"为兼容旧版调用,别名
grok-imagine-1.5-video-ext(对应 grok-imagine-1.5-video-apimart)仍可正常使用。视频内容描述,支持中英文
视频尺寸可选值:
16:9- 横屏(默认)9:16- 竖屏1:1- 正方形3:2- 横屏2:3- 竖版
视频时长(秒)取值范围:6-30(最短 6 秒,最长 30 秒)⚠️ 注意: 必须输入纯数字(如
6),不要加引号,否则会报错视频质量可选值:
480p- 标清(默认)720p- 高清
参考图像的 URL 列表限制:
- 最多 7 张图片
- 必须是公网可访问的 URL
- 不支持 base64 格式
上传参考图之后,宽高比会自动匹配参考图的宽高比
响应
响应状态码
查询任务结果视频生成为异步任务,提交后会返回
task_id。使用 获取任务状态 接口查询生成进度和结果。使用场景
场景 1:文生视频
{
"model": "grok-imagine-1.5-video-apimart",
"prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
"size": "16:9",
"duration": 6
}
场景 2:图生视频
{
"model": "grok-imagine-1.5-video-apimart",
"prompt": "让画面动起来,添加自然的动态效果",
"image_urls": ["https://example.com/start.png"],
"size": "16:9",
"duration": 10,
"quality": "720p"
}
⌘I