grok-imagine:white默认最便宜Grok Imagine API — 如何接入并付费
Grok Imagine — xAI 提供的生成和图像到图像功能(docs.Pixel/market/grok-imagine/image-to-image)。每张图像 4 个积分;I2I 需要输入图像。
渠道对比
最近 7 天
grok-imagine| 渠道 | 价格 |
|---|---|
白色 grok-imagine:white默认最便宜 | $0.021333 起 per image |
Pixel grok-imagine | $0.021333 起 per image |
组合你需要的输出结果
grok-imagine:white什么是 Grok Imagine
Grok Imagine — xAI 提供的生成和图像到图像功能(docs.Pixel/market/grok-imagine/image-to-image)。每张图像 4 个积分;I2I 需要输入图像。
契约概览
- 输入
- text, image
- 输出
- image
- 模式
- 异步(任务 + 轮询)
- 状态轮询
- 每 3 秒 · 最多 90 秒
优势
- 定价:每张图像
- 输入:文本、图像
- 5 个可配置选项
- 一个 API 密钥用于媒体生成
应用场景
- 文章和社交媒体插画
- 产品图像
- 横幅和封面
- 设计原型
API 契约
生成是异步的:先创建任务,然后轮询状态直至完成。
- 创建任务
- POST /api/media/generate
- 检查状态
- GET /api/media/jobs/{jobId}
- 输入
- text, image
- 输出
- image
- 轮询
- 每 3 秒 · 最多 90 秒
- 鉴权
- Authorization: Bearer sk-pv-…
请求示例
在 Bearer 请求头中传递密钥。API 会返回 jobId 用于轮询状态。
curl -sS https://getvibeapi.com/api/media/generate \
-H "Authorization: Bearer $GETVIBE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary '{"model":"grok-imagine:white","prompt":"a beautiful landscape","opts":{"aspect_ratio":"1:1","mode":"text-to-image","enable_pro":false}}'JavaScript
const response = await fetch('https://getvibeapi.com/api/media/generate', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.GETVIBE_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "grok-imagine:white",
"prompt": "a beautiful landscape",
"opts": {
"aspect_ratio": "1:1",
"mode": "text-to-image",
"enable_pro": false
}
}),
});
if (!response.ok) throw new Error(`GetVibe API: ${response.status}`);
const { jobId } = await response.json();
console.log(jobId);API 请求参数
通过 GetVibe API 向 Grok Imagine 发起请求的参数。
prompt必填image_urlaspect_ratiomodeenable_proimage_file_idimage_base64| 参数 | 类型 | 取值 | 默认值 | 价格 |
|---|---|---|---|---|
prompt必填 | text | text description | required | — |
image_url | URL | Public image URL | — | — |
aspect_ratio | option selection | 1:1 (default) · 16:9 · 9:16 · 4:3 · 3:4 | 1:1 | Included in the base price |
mode | option selection | Generation (default) · Image-to-Image | 生成 | Included in the base price |
enable_pro | yes/no | Yes · No (default) | 否 | Included in the base price |
image_file_id | text | Alternative to image_url: the id of your own file from POST /v1/files (file-pv-…) | — | Included in the base price |
image_base64 | text | Alternative to image_url: the file inline, as base64 or a data: URI | — | Included in the base price |
请求:POST https://getvibeapi.com/api/media/generate。价格以 USD 计。
Grok Imagine 的价格
Grok Imagine 的费用:从 $0.021333 per image。价格按当前汇率动态计算,最终扣费见 API 响应(priceRub)。以 USD 支付,无订阅。
默认请求的实际费用
若不传参数,请求将使用这些取值:Mode — Generation, Frame format — 1:1, Pro (quality over speed) — No。 该请求的费用为 $0.021333。
各渠道及所有参数组合的价格
每个渠道的每种参数组合价格。这正是成功生成时扣除的金额,与下方链接的机器可读价格表一致。
白色grok-imagine:white$0.021333 起精确价格
| Pro (quality over speed) \ Mode | 生成 |
|---|---|
| 否 | $0.021333 |
Pixelgrok-imagine$0.021333 起精确价格
| Pro (quality over speed) \ Mode | 生成 |
|---|---|
| 否 | $0.021333 |
所有组合(JSON): /api/media/price-table?model=grok-imagine
README
Grok Imagine 的机器可读契约包含请求 schema、操作、限制、轮询和响应示例。
# Grok Imagine
公开模型:grok-imagine:white
创建任务: POST /api/media/generate
检查状态: GET /api/media/jobs/{jobId}
## 输入参数
- `prompt` (text): text description; 默认: required
- `image_url` (URL): Public image URL; 默认: —
- `aspect_ratio` (option selection): 1:1 (default) · 16:9 · 9:16 · 4:3 · 3:4; 默认: 1:1
- `mode` (option selection): Generation (default) · Image-to-Image; 默认: Generation
- `enable_pro` (yes/no): Yes · No (default); 默认: No
- `image_file_id` (text): Alternative to image_url: the id of your own file from POST /v1/files (file-pv-…); 默认: —
- `image_base64` (text): Alternative to image_url: the file inline, as base64 or a data: URI; 默认: —
## 公开变体
- `grok-imagine:white`: White
- `grok-imagine`: Pixel关于 Grok Imagine API 的常见问题
Grok Imagine 的价格是多少?
Grok Imagine 的价格:从 $0.021333 per image。价格按当前汇率动态计算。
是否兼容 OpenAI SDK?
是的,API 完全兼容 OpenAI。只需将 base_url 改为 https://getvibeapi.com/v1 并设置密钥——其余代码不变。