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

# Playground

> このページから実際の Grok Imagine 画像生成タスクを送信し、返されたタスク id でポーリングします。

APIキーとプロンプトを入力してから送信してください。これによりライブAPIが呼び出されます。コードから呼び出す場合と同じエンドポイントです。

<Warning>
  **このページから送信されるリクエストは実際のものであり、キーに課金されます。**
  画像1枚あたりの料金は、モデルとティアに応じて \$0.02～\$0.08です。ここでの操作は
  サンドボックスでもモックでもありません。
</Warning>

## パラメーター

<ParamField body="model" type="string" required>
  実行するモデルです。`grok-imagine-image`、`grok-imagine-image-2.0`、または
  `grok-imagine-image-quality`を受け付けます。完全一致が必要で、エイリアスは使用できません。
</ParamField>

<ParamField body="input" type="object" required>
  生成パラメーターです。以下に記載されていないキーは
  `invalid_params`で拒否されます。

  <Expandable title="input">
    <ParamField body="input.prompt" type="string" required>
      生成する内容です。空にすることはできず、最大32000バイトです。
    </ParamField>

    <ParamField body="input.resolution" type="string" default="1k">
      `1k`または`2k`です。小文字で指定してください。大文字は拒否されます。
    </ParamField>

    <ParamField body="input.quality" type="string" default="low">
      `low`または`medium`です。**`grok-imagine-image-2.0`でのみ受け付けられます**。他の2つのモデルでは、
      未知のフィールドとして返されます。
    </ParamField>

    <ParamField body="input.aspect_ratio" type="string">
      `auto`、`1:1`、`16:9`、`9:16`、`4:3`、`3:4`、`3:2`、`2:3`、`2:1`、`1:2`、
      `19.5:9`、`9:19.5`、`20:9`、`9:20`、`21:9`、`5:2`のいずれかです。省略すると、モデル固有の
      デフォルトの構図が使用されます。
    </ParamField>

    <ParamField body="input.n" type="integer" default="1">
      生成する画像の枚数です。1～4枚を指定できます。各画像は
      `outputs`内の個別のエントリとなり、それぞれに課金されます。
    </ParamField>

    <ParamField body="input.images" type="string[]">
      編集または合成に使用する参照画像です。最大3枚まで指定できます。各エントリは
      `https` URLまたはbase64データURIで、1枚につき約\$0.01が加算されます。
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="callback_url" type="string">
  完了したタスクをPOSTする`https` URLです。これによりポーリングを省略できます。
  `https`である必要があり、それ以外は送信時に拒否されます。
</ParamField>

## 返ってくる内容

送信すると、1秒未満ですぐに返ります。画像はこの応答には**含まれません**。生成はバックグラウンドで行われます。

| フィールド        | 型       | 備考                           |
| ------------ | ------- | ---------------------------- |
| `id`         | string  | タスク ID です。ほかのすべての処理で必要になります。 |
| `status`     | string  | 新規タスクでは `queued` です。         |
| `created_at` | integer | Unix秒、UTCです。                 |

<ResponseExample>
  ```json 応答 theme={null}
  {
    "id": "task_2wZ1SuRH4VzXxONqGrH9oCLEZiBQTAVF",
    "status": "queued",
    "created_at": 1788189088
  }
  ```
</ResponseExample>

## 結果をポーリングする

このプレイグラウンドでは作成呼び出しのみを扱います。上記のレスポンスから`id`を取得し、`status`が`completed`または`failed`に達するまでタスクを読み取ります。所要時間は約7～10秒です。

```bash theme={null}
curl https://api.widerouter.com/v1/task/$TASK_ID \
  -H "Authorization: Bearer $WIDEROUTER_API_KEY"
```

完了したタスクには`outputs`配列が含まれます。

```json theme={null}
{
  "id": "task_2wZ1SuRH4VzXxONqGrH9oCLEZiBQTAVF",
  "model": "grok-imagine-image",
  "status": "completed",
  "created_at": 1788189088,
  "completed_at": 1788189094,
  "expires_at": 1788275494,
  "outputs": ["https://r2cdn.agisuitepro.com/o/2026/08/31/task_2wZ1SuRH4VzXxONqGrH9oCLEZiBQTAVF_0.jpg"],
  "counts": { "requested": 1, "succeeded": 1, "failed": 0 },
  "usage": { "cost_in_usd_ticks": 200000000 }
}
```

<Info>
  出力URLは認証なしで利用でき、タスク完了の24時間後に有効期限が切れます。
  `usage.cost_in_usd_ticks`は**定価**です。残高は、その金額にグループのレート倍率を掛けた分だけ変動します。
  詳細は[料金](/ja/models/grok-imagine/image/overview#pricing)をご覧ください。
</Info>

## 次のステップ

<CardGroup cols={2}>
  <Card title="概要" icon="image" href="/ja/models/grok-imagine/image/overview">
    すべてのパラメータ、解像度と品質の一覧、および測定済みのレイテンシー。
  </Card>

  <Card title="非同期タスク API" icon="clock" href="/ja/api/async-tasks">
    ポーリングループ、コールバック、および完全なエラーテーブル。
  </Card>
</CardGroup>
