Tokaify APITokaify API
API Reference
AI Model APIImagesImagen APIImagen Image Generation

imagen-4.0-generate-001 Image Generation API

Imogen 4 Standard Image Generation API

Designed for high-quality photorealistic images, illustrations, product visuals, and general creative asset generation.

POST
/v1beta/models/{model}:predict

Authorization

BearerAuth

AuthorizationBearer <token>

Model relay interface recognition. Request heading: Autoration: Bearer .

In: header

Path Parameters

model*string

Gemini model name.

Default"imagen-4.0-generate-001"

Request Body

application/json

[key: string]?any

Response Body

application/json

curl -X POST "https://api.tokaify.com/v1beta/models/imagen-4.0-generate-001:predict" \  -H "Content-Type: application/json" \  -d '{}'
{}

Request Parameters

FieldTypeRequiredDefaultDescription
instancesarrayYesNonePrediction input array. Imagen typically only needs one instance.
instances[].promptstringYesNoneEnglish prompt. The official recommendation is to keep it within 480 tokens.
parameters.sampleCountintegerNo4Number of generated images, from 1 to 4.
parameters.aspectRatiostringNo1:1Supports 1:1, 3:4, 4:3, 9:16, and 16:9.
parameters.imageSizestringNo1KOutput size tier. Supports 1K and 2K.
parameters.personGenerationstringNoallow_adultPerson-generation policy. Supports dont_allow, allow_adult, and allow_all; some regions do not allow allow_all.

Example Code

curl "https://api.tokaify.com/v1beta/models/imagen-4.0-generate-001:predict" \
  -H "Authorization: Bearer $TOKAIFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instances": [{ "prompt": "A premium SaaS API gateway product poster, dark background, crisp typography" }],
    "parameters": {
      "sampleCount": 1,
      "aspectRatio": "16:9",
      "imageSize": "2K",
      "personGeneration": "dont_allow"
    }
  }'
import requests

response = requests.post(
    "https://api.tokaify.com/v1beta/models/imagen-4.0-generate-001:predict",
    headers={"Authorization": "Bearer YOUR_TOKAIFY_API_KEY"},
    json={
        "instances": [{"prompt": "A premium SaaS API gateway product poster, dark background, crisp typography"}],
        "parameters": {"sampleCount": 1, "aspectRatio": "16:9", "imageSize": "2K", "personGeneration": "dont_allow"},
    },
)
print(response.json())
const response = await fetch("https://api.tokaify.com/v1beta/models/imagen-4.0-generate-001:predict", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.TOKAIFY_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    instances: [{ prompt: "A premium SaaS API gateway product poster, dark background, crisp typography" }],
    parameters: { sampleCount: 1, aspectRatio: "16:9", imageSize: "2K", personGeneration: "dont_allow" },
  }),
});
console.log(await response.json());

Response Example

{
  "predictions": [
    {
      "bytesBase64Encoded": "iVBORw0KGgoAAAANSUhEUg...",
      "mimeType": "image/png"
    }
  ]
}

Notes

Billing follows the configured model and channel ratios. Imagen 4 outputs include a SynthID watermark. For batch generation, keep sampleCount under control to avoid oversized requests timing out.

How is this guide?

Last updated on