Skip to content

非公式本サイトは非公式の日本語ドキュメントであり、Cloudflare 公式サイトではありません。最新情報はdevelopers.cloudflare.comをご確認ください。

xAI のロゴ

Grok Imagine Image 2.0

テキストから画像 • xAI

Markdown で表示Agent セットアップ
  • サードパーティ

xAI の Grok Imagine Image 2.0 は、指示追従、タイポグラフィ、レイアウト、参照画像の保持に優れた、クリエイティブ用途向けの精密な画像生成・編集モデルです。

モデル情報
利用規約とライセンスリンク
詳細情報リンク
料金Cloudflare ダッシュボードで料金を見る

使い方

const response = await env.AI.run(
  'xai/grok-imagine-image-2.0',
  { prompt: 'A concert poster for a synthwave band, bold retro typography, sharp small print' },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "xai/grok-imagine-image-2.0",
  "input": {
    "prompt": "A concert poster for a synthwave band, bold retro typography, sharp small print"
  }
}'
簡単な生成
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-2.0/simple-generation.jpg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

ポートレート 2K — アスペクト比を制御した高解像度画像です
const response = await env.AI.run(
  'xai/grok-imagine-image-2.0',
  {
    aspect_ratio: '3:4',
    prompt:
      'A detailed botanical illustration of exotic tropical flowers with fine line work and watercolor textures',
    quality: 'medium',
    resolution: '2k',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "xai/grok-imagine-image-2.0",
  "input": {
    "aspect_ratio": "3:4",
    "prompt": "A detailed botanical illustration of exotic tropical flowers with fine line work and watercolor textures",
    "quality": "medium",
    "resolution": "2k"
  }
}'
ポートレート 2K
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-2.0/portrait-2k.png"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}
低品質の下書き — 反復向けの高速・低品質の下書きです
const response = await env.AI.run(
  'xai/grok-imagine-image-2.0',
  {
    aspect_ratio: '1:1',
    prompt: 'A quiet Japanese garden in morning mist with a stone lantern and koi pond',
    quality: 'low',
    resolution: '1k',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "xai/grok-imagine-image-2.0",
  "input": {
    "aspect_ratio": "1:1",
    "prompt": "A quiet Japanese garden in morning mist with a stone lantern and koi pond",
    "quality": "low",
    "resolution": "1k"
  }
}'
低品質の下書き
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image-2.0/low-quality-draft.jpg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

パラメーター

prompt
string必須
aspect_ratio
stringenum: 1:1, 3:4, 4:3, 9:16, 16:9, 2:3, 3:2, 9:19.5, 19.5:9, 9:20, 20:9, 1:2, 2:1, auto
quality
stringenum: low, medium
resolution
stringenum: 1k, 2k
response_format
stringenum: url, b64_json
user
string
image
string生成画像です。上流の `response_format` に応じて、Base64 data URI(`data:image/png;base64,...`)または `https://` URL です。

API スキーマ(Raw)

Input
Output

役に立ちましたか?