26j文档
试一试 →

Grok Imagine 1.5 视频生成

  • 异步处理模式,返回任务ID用于后续查询
  • 高质量AI视频生成,支持文生视频、图生视频
  • 灵活的比例与质量选择,满足不同创作需求

模型名称:本接口统一使用 grok-imagine-1.5-video-ext。

请求示例
# model 请填写 "grok-imagine-1.5-video-ext"
curl --request POST \
  --url https://26j.cn/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "grok-imagine-1.5-video-ext",
    "prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
    "size": "16:9",
    "duration": 6,
    "resolution": "720p"
  }'
import requests

url = "https://26j.cn/v1/videos/generations"

payload = {
    "model": "grok-imagine-1.5-video-ext",
    "prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
    "size": "16:9",
    "duration": 6,
    "resolution": "720p"
}

headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
const url = "https://26j.cn/v1/videos/generations";

const payload = {
  model: "grok-imagine-1.5-video-ext",
  prompt: "一只狗在海滩上奔跑,阳光明媚,慢镜头",
  size: "16:9",
  duration: 6,
  resolution: "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"
  }
}

认证

Authorizationstring必填

所有接口均需要使用 Bearer Token 进行认证

获取 API Key:

访问 API Key 管理页面 获取您的 API Key

使用时在请求头中添加:

Authorization: Bearer YOUR_API_KEY

请求参数

modelstring必填默认 grok-imagine-1.5-video-ext

视频生成模型名称

支持的模型:

  • grok-imagine-1.5-video-ext - Grok 视频生成

示例:"grok-imagine-1.5-video-ext"

新请求请统一使用 grok-imagine-1.5-video-ext。

nsfw_checkboolean默认 false

是否在提交视频任务前执行内容审核。

  • true:使用 omni-moderation-latest 审核提示词和输入图片
  • false 或不传:不发起审核请求,不增加审核成本与延迟(默认)
promptstring必填

视频内容描述,支持中英文

sizestring默认 16:9

视频尺寸

可选值:

  • 16:9 - 横屏(默认)
  • 9:16 - 竖屏
  • 1:1 - 正方形
  • 3:2 - 横屏
  • 2:3 - 竖版
durationinteger

视频时长(秒)

取值范围:6-15(最短 6 秒,最长 15 秒)

⚠️ 注意: 必须输入纯数字(如 6),不要加引号,否则会报错

resolutionstring默认 480p

视频质量

可选值:

  • 480p - 标清(默认)
  • 720p - 高清
image_urlsstring[]

参考图像的 URL 列表

限制:

  • 最多 7 张图片
  • 必须是公网可访问的 URL
  • 不支持 base64 格式

上传参考图之后,宽高比会自动匹配参考图的宽高比

响应

codeinteger

响应状态码

dataobject[]

响应数据数组

查询任务结果

视频生成为异步任务,提交后会返回 task_id。使用 获取任务状态 接口查询生成进度和结果。

使用场景

场景 1:文生视频

{
  "model": "grok-imagine-1.5-video-ext",
  "prompt": "一只狗在海滩上奔跑,阳光明媚,慢镜头",
  "size": "16:9",
  "duration": 6
}

场景 2:图生视频

{
  "model": "grok-imagine-1.5-video-ext",
  "prompt": "让画面动起来,添加自然的动态效果",
  "image_urls": ["https://example.com/start.png"],
  "size": "16:9",
  "duration": 10,
  "resolution": "720p"
}

This documentation is built and hosted on Mintlify, a developer documentation platform.

© 2026 26j.cn · AI 模型中转站