Grok Imagine icon

Grok Image Generator API

xAI の Grok 画像モデルを1つの統合 API で使い、AI 画像を生成。単一の REST エンドポイント、非同期ジョブ、Webhook を備え、xAI の個別アカウントの管理は不要です。

Grok Imagine を1回のAPIコールで統合できます。1つのキー、1つの統一エンドポイント、そしてApiframe上のすべてのモデルで共通の請求。

model: "grok-imagine-image"
Grok Imagine candid lifestyle shot of friends laughing at an outdoor cafe in natural light with realistic skin

Grok Imagine の特長

  • 1:1, 2:3, 3:2 を含む 5 種類のアスペクト比に対応。
  • 画像から画像への編集と参照画像に対応。
  • 高速処理 — 1回の生成あたり平均約8秒。
  • xAI のアカウント不要の従量課金。成功した生成分だけお支払いいただきます。
  • Apiframe のすべてのモデルで、1つのAPIキー・統一請求・冪等性・Webhookに対応。

Grok Imagine で作成

Apiframeの Grok Imagine API で生成した出力例です。

Grok Imagine photorealistic product render of a matte black water bottle on a concrete ledge in natural daylight

A photorealistic product render of a matte black water bottle on a concrete ledge, natural daylight.

Grok Imagine event ad with the headline 'LAUNCH NIGHT', the date and venue beneath, in a bold modern layout

An event ad with the headline 'LAUNCH NIGHT', the date and venue beneath, bold modern layout.

Grok Imagine branded hero image combining a logo and a product photo into a single composition for Apex Outdoor Gear

Combine this logo and this product photo into a single branded hero image.

Grok Imagine portrait restyled as a 1970s film photograph while keeping the subject’s face

Restyle this portrait as a 1970s film photograph, keeping the subject's face.

Grok Imagine candid lifestyle shot of friends laughing at an outdoor cafe in natural light with realistic skin

A candid lifestyle shot of friends laughing at an outdoor cafe, natural light, realistic skin.

Grok Imagine clean app icon of a paper plane on a blue gradient in a simple flat design

A clean app icon of a paper plane on a blue gradient, simple flat design.

概要

エンドポイント
POST /v2/images/generate
モデルID
grok-imagine-image
パラメータキー
grokParams
モダリティ
画像
プロバイダー
xAI
平均完了時間
~8s

機能

アスペクト比1:1, 2:3, 3:2, 16:9, 9:16
画像入力対応
平均時間~8秒

クイックスタート

APIキーを添えて POST /v2/images/generate に1回リクエストを送るだけで Grok Imagine による生成が始まります。レスポンスには、ポーリングまたはWebhookで受け取れる jobId が返ります。

curl -X POST https://api.apiframe.ai/v2/images/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
        "prompt": "a sleek silver sports car on a coastal highway at sunset, hyper-realistic",
        "model": "grok-imagine-image",
        "grokParams": {
            "image": "https://example.com/input.jpg"
        }
    }'
import requests

response = requests.post(
    "https://api.apiframe.ai/v2/images/generate",
    headers={
        "X-API-Key": "afk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "a sleek silver sports car on a coastal highway at sunset, hyper-realistic",
        "model": "grok-imagine-image",
        "grokParams": {
            "image": "https://example.com/input.jpg"
        }
    },
)
print(response.json())  # { "jobId": "...", "status": "QUEUED" }
const response = await fetch("https://api.apiframe.ai/v2/images/generate", {
  method: "POST",
  headers: {
    "X-API-Key": "afk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "prompt": "a sleek silver sports car on a coastal highway at sunset, hyper-realistic",
    "model": "grok-imagine-image",
    "grokParams": {
      "image": "https://example.com/input.jpg"
    }
  }),
});
const { jobId } = await response.json();
console.log(jobId);

レスポンスとジョブのライフサイクル

生成は非同期で行われます。送信が成功すると 202 AcceptedjobId が返ります。ステータスが COMPLETED になるまで GET /v2/jobs/{id} をポーリングする(または webhook_url を指定する)と、result フィールドに出力URLが格納されます。

1. 送信レスポンス (202)

{
  "jobId": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
  "status": "QUEUED"
}

2. 結果をポーリング

curl https://api.apiframe.ai/v2/jobs/JOB_ID \
  -H "X-API-Key: afk_your_api_key_here"
import requests, time

while True:
    job = requests.get(
        "https://api.apiframe.ai/v2/jobs/JOB_ID",
        headers={"X-API-Key": "afk_your_api_key_here"},
    ).json()
    if job["status"] in ("COMPLETED", "FAILED"):
        break
    time.sleep(2)
print(job["result"])
let job;
do {
  await new Promise((r) => setTimeout(r, 2000));
  job = await fetch("https://api.apiframe.ai/v2/jobs/JOB_ID", {
    headers: { "X-API-Key": "afk_your_api_key_here" },
  }).then((r) => r.json());
} while (job.status !== "COMPLETED" && job.status !== "FAILED");
console.log(job.result);

入力スキーマ

Grok Imagine エンドポイントが受け付けるリクエストパラメータです。モデル固有のオプションは、下記のパラメータオブジェクトの中にネストされます。

パラメータ 必須 デフォルト 許可値 / 範囲 説明
prompt string 必須 生成する内容のテキスト説明。
model string 必須 "grok-imagine-image" "grok-imagine-image" このエンドポイントのモデル識別子。
grokParams.image string (URL) 任意 Reference image (URL)

よくある質問

Grok Imagine APIに関するよくある質問をまとめました。

Grok Imagine の API はありますか?

はい。Apiframe は単一の REST エンドポイント(`POST /v2/images/generate`、`model: "grok-imagine-image"`)で Grok Imagine を提供します。対応するすべてのモデルで、統一されたAPI・キー・請求をご利用いただけ、xAI の個別アカウントは不要です。

Grok Imagine API の料金はいくらですか?

Grok Imagine は Apiframe のシンプルな従量課金制で、成功した生成分のみお支払いいただきます。プランと数量割引は料金ページをご覧ください。

Grok Imagine API はどのように呼び出しますか?

`X-API-Key` と、`model: "grok-imagine-image"` を含む JSON ボディを添えて `/v2/images/generate` に POST リクエストを送ります。レスポンスで返る `jobId` を `GET /v2/jobs/{id}` でポーリングするか、Webhook で結果を受け取ります。

Grok Imagine はどんなパラメータに対応していますか?

Grok Imagine は、共通の `prompt`・`webhook_url` に加えて、`grokParams` の下にネストされた 1 個のモデル固有パラメータを受け付けます。型やデフォルト値を含む一覧は上記の入力スキーマをご覧ください。

解決しませんでしたか?

Grok Imagine API で開発を始めよう

APIキーを取得すれば数分で Grok Imagine を統合できます — 従量課金。

無料クレジットですぐに開始
すべてのモデルを1つのAPIで
Webhook・SDK・冪等性に対応
プロバイダーのアカウント不要

ご質問はありますか? Discordに参加 または 営業に問い合わせる