Grok Imagine Image 2.0 API
An image model, called through Hyperouter's OpenAI-compatible API. Generate and edit, as above.
Price
| Tier | Price |
|---|---|
| Base rate | $0.04 per image |
| quality medium | $0.06 per image |
| 2K | $0.06 per image |
| 2K · quality medium | $0.08 per image |
Call it with the OpenAI SDK
Set HYPEROUTER_API_KEY to an API key from the dashboard. Any OpenAI SDK works once its base URL is https://api.hyperouter.app/v1.
curl https://api.hyperouter.app/v1/images/generations \ -H "Authorization: Bearer $HYPEROUTER_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model": "x-ai/grok-imagine-image-2.0", "prompt": "A lighthouse at dusk", "n": 1}'
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.hyperouter.app/v1", apiKey: process.env.HYPEROUTER_API_KEY, }); const res = await client.images.generate({ model: "x-ai/grok-imagine-image-2.0", prompt: "A lighthouse at dusk", n: 1, }); console.log(res.data[0].url);
import os from openai import OpenAI client = OpenAI( base_url="https://api.hyperouter.app/v1", api_key=os.environ["HYPEROUTER_API_KEY"], ) res = client.images.generate( model="x-ai/grok-imagine-image-2.0", prompt="A lighthouse at dusk", n=1, ) print(res.data[0].url)
Reference
- Images: parameters, waiting for the result and errors
GET /v1/models: the models your account can call at the time of the request, with prices and parameters
Related models
- Grok Imagine Image
x-ai/grok-imagine-image - Qwen Image 2.0
qwen/qwen-image-2.0 - Seedream 5.0 Flash
bytedance/seedream-5.0-flash - Seedream 5.0 Lite
bytedance/seedream-5.0-lite