Skip to content

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

xAI のロゴ

Grok Imagine Image

テキストから画像 • xAI

Markdown で表示Agent セットアップ
  • サードパーティ
  • ゼロデータ保持

xAI の Grok Imagine 画像モデルです。テキストと参照画像から画像を生成・編集し、アスペクト比と解像度を設定できます。

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

使い方

const response = await env.AI.run(
  'xai/grok-imagine-image',
  { prompt: 'A golden retriever puppy playing in autumn leaves' },
)
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",
  "input": {
    "prompt": "A golden retriever puppy playing in autumn leaves"
  }
}'
簡単な生成
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image/simple-generation.jpeg"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

カスタムアスペクト比 — 2K 解像度のポートレート向きレンダリングです
const response = await env.AI.run(
  'xai/grok-imagine-image',
  {
    prompt:
      'A detailed botanical illustration of exotic tropical flowers with fine line work and watercolor textures',
    aspect_ratio: '3:4',
    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",
  "input": {
    "prompt": "A detailed botanical illustration of exotic tropical flowers with fine line work and watercolor textures",
    "aspect_ratio": "3:4",
    "resolution": "2k"
  }
}'
カスタムアスペクト比
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image/custom-aspect-ratio.png"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}
シネマティックな風景 — 2K 解像度のワイド画面の風景です
const response = await env.AI.run(
  'xai/grok-imagine-image',
  {
    prompt:
      'A neon-lit cyberpunk figure standing in the rain beneath a holographic billboard, cinematic lighting',
    aspect_ratio: '16:9',
    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",
  "input": {
    "prompt": "A neon-lit cyberpunk figure standing in the rain beneath a holographic billboard, cinematic lighting",
    "aspect_ratio": "16:9",
    "resolution": "2k"
  }
}'
シネマティックな風景
{
  "state": "Completed",
  "result": {
    "image": "https://examples.aig.cloudflare.com/xai/grok-imagine-image/cinematic-landscape.png"
  },
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

パラメーター

prompt
string必須
n
integerminimum: 1maximum: 10
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, high
resolution
stringenum: 1k, 2k
response_format
stringenum: url, b64_json
user
string
image
string

API スキーマ(Raw)

Input
Output

役に立ちましたか?