imagen-4-0
Google Imagen 4.0 on reAPI — high-fidelity async text-to-image at a flat per-image rate, with five aspect ratios and a single OpenAI-style endpoint.
Google's Imagen 4 model on reAPI. Text-to-image only — no reference
images, no inpainting masks. Five aspect ratios at a flat per-image
rate. Async-first: submit returns a task_id; poll until ready. See
current pricing on the model page.
Quick example
curl https://reapi.ai/api/v1/images/generations \
-H "Authorization: Bearer rk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "imagen-4-0",
"prompt": "A corgi wearing an astronaut helmet on the lunar surface, Earth in the background, cinematic lighting, 8k",
"size": "16:9"
}'import requests
resp = requests.post(
"https://reapi.ai/api/v1/images/generations",
headers={
"Authorization": "Bearer rk_live_xxx",
"Content-Type": "application/json",
},
json={
"model": "imagen-4-0",
"prompt": "A corgi wearing an astronaut helmet on the lunar surface, Earth in the background, cinematic lighting, 8k",
"size": "16:9",
},
timeout=30,
)
print(resp.json())const r = await fetch("https://reapi.ai/api/v1/images/generations", {
method: "POST",
headers: {
Authorization: "Bearer rk_live_xxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "imagen-4-0",
prompt:
"A corgi wearing an astronaut helmet on the lunar surface, Earth in the background, cinematic lighting, 8k",
size: "16:9",
}),
});
console.log(await r.json());package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
body, _ := json.Marshal(map[string]any{
"model": "imagen-4-0",
"prompt": "A corgi wearing an astronaut helmet on the lunar surface, Earth in the background, cinematic lighting, 8k",
"size": "16:9",
})
req, _ := http.NewRequest("POST", "https://reapi.ai/api/v1/images/generations", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer rk_live_xxx")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
}The response carries a task_id. Poll
GET /api/v1/tasks/{task_id} until status is
completed, then read result.images[].url.
Request body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | yes | — | Must be imagen-4-0. |
prompt | string | yes | — | Image description. English or Chinese both supported. Up to 4000 characters. |
n | integer | no | 1 | Number of images per request. Only 1 is accepted. |
size | string | no | 16:9 | Aspect ratio. One of 1:1 / 4:3 / 3:4 / 16:9 / 9:16. Passing an unsupported ratio returns a 400. |
imagen-4-0 is text-to-image only. The endpoint rejects image_urls,
image, mask, and similar reference fields. For image-to-image, see
seedream-5-0-lite or the
gemini-3-pro-image-preview family.
Response
Submission returns the standard async envelope:
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8AYYM6R03TGZ3Q2P0TZVNPX"
}
]
}Polled completion (GET /api/v1/tasks/{task_id}):
{
"code": 200,
"data": {
"status": "completed",
"result": {
"images": [{ "url": "https://cdn.reapi.ai/..." }]
}
}
}Image URLs are valid for 24 hours from completion. Re-host the asset to your own storage if you need durable access.
Pricing
Flat per-image rate. n is fixed at 1, so total charge is exactly one
image per request. See the
model page for the live rate.
Errors
imagen-4-0 shares the platform-wide error envelope.
The validation surface is small:
promptmissing or empty →400 INVALID_REQUEST.sizeoutside the five accepted ratios →400 INVALID_REQUEST.nset to any value other than1→400 INVALID_REQUEST.- Any reference media (
image_urls,image,mask) supplied →400 INVALID_REQUESTwith a text-to-image-only message.