首页/Imagine API/概览

Imagine API 概览

将创意变为现实 — 使用 Imagine API 进行图像和视频生成与编辑。

模式
生成 & 编辑
速度
业界领先
图像
$0.02 / 张

图像生成

使用 Imagine API 从文本提示生成图像:

Python
import os
import xai_sdk

client = xai_sdk.Client(api_key=os.getenv("XAI_API_KEY"))

response = client.image.sample(
    prompt="一座未来主义的城市天际线在夕阳下",
    model="grok-imagine-image-quality",
)

print(response.url)

可用模型

模型能力分辨率价格
grok-imagine-image-quality文本、图像 → 图像1K / 2K$0.05 / 张 (1K),$0.07 / 张 (2K)
grok-imagine-image文本、图像 → 图像1K / 2K$0.02 / 张
grok-imagine-video-1.5图像 → 视频480p / 720p / 1080p$0.08 / 秒 (480p) 起
grok-imagine-video文本、图像、视频 → 视频480p / 720p$0.05 / 秒 (480p) 起

能力概览