灵活的参数配置
可配置文档中列出的 9 个参数,包括 aspect_ratio, enable_pro, enable_safety_checker, image_url, mask_indices。
curl -X POST https://runapi.ai/api/v1/grok_imagine/segment_map \
-H "Authorization: Bearer $RUNAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-2-0",
"prompt": "生成一段机械手在棋盘上落子的短视频,戏剧性打光,慢动作。"
}'
import { GrokImagineClient } from "@runapi.ai/grok-imagine";
const client = new GrokImagineClient();
const result = await client.segmentMap.run({
model: "grok-imagine-image-2-0",
prompt: "生成一段机械手在棋盘上落子的短视频,戏剧性打光,慢动作。",
});
import os
import requests
response = requests.post(
"https://runapi.ai/api/v1/grok_imagine/segment_map",
headers={"Authorization": f"Bearer {os.environ['RUNAPI_API_KEY']}"},
json={"model":"grok-imagine-image-2-0","prompt":"生成一段机械手在棋盘上落子的短视频,戏剧性打光,慢动作。"}
)
response.raise_for_status()
<?php
$client = curl_init("https://runapi.ai/api/v1/grok_imagine/segment_map");
curl_setopt_array($client, [
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("RUNAPI_API_KEY"), "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
'model' => 'grok-imagine-image-2-0',
'prompt' => '生成一段机械手在棋盘上落子的短视频,戏剧性打光,慢动作。',
])
]);
$response = curl_exec($client);
RunApi client = new RunApi(System.getenv("RUNAPI_API_KEY"));
Task task = client.segmentMap().run({"model":"grok-imagine-image-2-0","prompt":"生成一段机械手在棋盘上落子的短视频,戏剧性打光,慢动作。"});
task.waitForResult();
require "runapi/grok_imagine"
client = RunApi::GrokImagine::Client.new
result = client.segment_map.run(
model: "grok-imagine-image-2-0",
prompt: "生成一段机械手在棋盘上落子的短视频,戏剧性打光,慢动作。"
)
client := runapi.NewClient(os.Getenv("RUNAPI_API_KEY"))
task, err := client.segmentMap.Run({"model":"grok-imagine-image-2-0","prompt":"生成一段机械手在棋盘上落子的短视频,戏剧性打光,慢动作。"})
if err != nil { log.Fatal(err) }
task.Wait()
$ runapi generate \
--model grok-imagine-image-2-0 \
--endpoint segment_map \
--wait
7 个版本可用
选择任意模型,几秒内开始生成。
| 提供商 | xAI |
| 模型 ID | grok-imagine-image-2-0 |
| 模态 | 图像 |
| 任务类型 | Asynchronous |
| API 端点 | /api/v1/grok_imagine/edit_image, /api/v1/grok_imagine/segment_map, /api/v1/grok_imagine/text_to_image |
| 计费单位 | 次调用 |
| 输入参数 | aspect_ratio, callback_url, enable_pro, enable_safety_checker, image_url, mask_indices, model, prompt, source_image_url, source_image_urls, source_task_id |
| 宽高比 | 1:1, 2:3, 3:2, 16:9, 9:16, auto |
| 目录状态 | 运行中 |
免费注册后,在控制台创建用于 grok-imagine-image-2-0 的 API 密钥。
向 /api/v1/grok_imagine/segment_map 发送 POST 请求,并传入 grok-imagine-image-2-0 模型 ID 和参数。
轮询任务或按照回调获取已完成的 grok-imagine-image-2-0 结果。
可配置文档中列出的 9 个参数,包括 aspect_ratio, enable_pro, enable_safety_checker, image_url, mask_indices。
提供 3 个公开 endpoint:edit_image, segment_map, text_to_image。
异步任务支持回调 URL,任务完成时发送通知。
按 次调用 计量,无需订阅。
image_urlPublic image URL that the service can fetch.
callback_urlWebhook URL for terminal Task delivery.
source_task_idCompleted Image 2.0 text-to-image Task ID owned by the same account. Compatibility input; use image_url instead.
为缺少棚拍照片的电商商品自动生成场景化产品图。
快速概念化环境和角色,再进入最终美术制作。
为博客文章和专栏批量生成独特封面图和插图。
该模型暂无已验证的用户反馈。
传入 quickstart 中显示的模型 ID。
Key 级限流随使用层级伸缩。当前限制见定价页。
可以——变体只是参数,改 model 字段即可。
模型支持流式时,RunAPI 端到端流式。
在公共 GitHub 仓库提 issue 或邮件联系 support。
不需要。你的 RunAPI API key 足以访问此 variant 以及目录中的所有其他模型,无需底层提供方账户。