> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixroute.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Grok Imagine Image

> Grok Imagine Image: 画像生成モデル。MixRouteでのリクエスト例とパラメータ。

Grok Imagine Imageは、以下で説明するネイティブ画像APIを通じて利用できます。

GPT Imageのsizeフィールドではなく、ネイティブのaspect\_ratioとresolutionフィールドを使用します。qualityによる制御はImage 2.0でのみ使用できます。

<Tip>
  [生成パラメーター](/ja/api-reference/endpoint/grok-imagine-image) | [編集パラメーター](/ja/api-reference/endpoint/grok-imagine-edit)
</Tip>

`POST https://api.mixroute.ai/v1/images/generations`

## 例

環境変数`MIXROUTE_API_KEY`にMixRouteのキーを設定してください。リクエストは`Authorization: Bearer ...`を使用します。編集前に、元画像のプレースホルダーをアクセス可能な画像またはローカルファイルに置き換えてください。

```bash theme={null}
curl --request POST "https://api.mixroute.ai/v1/images/generations" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "grok-imagine-image",
  "prompt": "A clean product photograph of a red ceramic mug on a white background.",
  "n": 1,
  "response_format": "url"
}'
```

### Python

```python theme={null}
import json
import os
import requests

payload = json.loads(r'''
{
  "model": "grok-imagine-image",
  "prompt": "A clean product photograph of a red ceramic mug on a white background.",
  "n": 1,
  "response_format": "url"
}
''')
response = requests.post(
    "https://api.mixroute.ai/v1/images/generations",
    headers={"Authorization": "Bearer " + os.environ["MIXROUTE_API_KEY"]},
    json=payload,
    timeout=180,
)
response.raise_for_status()
result = response.json()
for item in result["data"]:
    print(item.get("url") or item.get("b64_json"))
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.