Skip to main content
Fhddos routes image generation requests to Google’s Imagen 3 and Gemini image models through an OpenAI-compatible interface. You can generate images synchronously with POST /v1/images/generations, receive results as base64 or a URL, and fall back to an asynchronous task workflow for longer-running jobs. All requests use your Fhddos Bearer token — no Google credentials required.

Set Up Your Environment

export BASE_URL="https://aiapi.fhddos.com"
export TOKEN="your-fhddos-token"

Supported Models

ModelMax ResolutionBest For
imagen-3.0-generate-001StandardHighest quality production images
imagen-3.0-fast-generate-001StandardLower latency, rapid prototyping
gemini-3-pro-image-preview4K (4096×4096)Complex prompts, reference image editing
gemini-2.5-flash-image / gemini-2.5-flash-image-preview1K (1024×1024)Fast generation, prototype validation
Use gemini-3-pro-image-preview when you need style transfer, complex semantic understanding, or reference-image editing. Use an Imagen 3 model for straightforward text-to-image at scale.

Text-to-Image: POST /v1/images/generations

Basic Request

curl -X POST "$BASE_URL/v1/images/generations" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "imagen-3.0-generate-001",
    "prompt": "A photorealistic panda reading a book in a sunlit library, cinematic lighting",
    "n": 1,
    "size": "1024x1024",
    "response_format": "b64_json"
  }'

Request Parameters

ParameterTypeRequiredDescription
modelstringModel name
promptstringText description of the image
nintegerNumber of images to generate (default 1)
sizestringResolution — use tier format ("1K", "2K", "4K") or pixel format ("1024x1024")
aspect_ratiostringExplicit aspect ratio, e.g. "1:1", "16:9", "9:16"
response_formatstring"b64_json" (default) or "url"

Resolution Tiers

Fhddos maps your size value to a standard resolution tier:
TierPixel RangeRecommended Use
1KLongest edge ~1024pxPreviews, mobile, prototypes
2KLongest edge ~2048pxHigh-definition illustrations
4KLongest edge ~4096pxPrint, large-screen display
Combine size with aspect_ratio for precise control:
{"size": "2K", "aspect_ratio": "16:9"}
Supported aspect ratios: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
gemini-2.5-flash-image supports a maximum of 1K resolution. Requesting a higher tier falls back to 1K automatically.

Response

{
  "created": 1700000000,
  "data": [
    {
      "b64_json": "<BASE64_IMAGE_DATA>",
      "revised_prompt": "Revised prompt text, if any"
    }
  ]
}
When response_format is "url":
{
  "created": 1700000000,
  "data": [
    {
      "url": "https://example.com/generated-image.png"
    }
  ]
}

Python SDK Example

from openai import OpenAI

client = OpenAI(
    base_url="https://aiapi.fhddos.com/v1",
    api_key="your-fhddos-token",
)

resp = client.images.generate(
    model="imagen-3.0-generate-001",
    prompt="A futuristic cityscape at sunset with flying cars, ultra-detailed",
    size="1024x1024",
    response_format="b64_json",
)

image_b64 = resp.data[0].b64_json

Async Image Generation

For Gemini image models, Fhddos provides a Sora-style async task interface. This is useful when you want non-blocking generation or need a publicly accessible URL without waiting inline.

Step 1 — Create the Task

curl -X POST "$BASE_URL/v1/images/generations/async" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3-pro-image-preview",
    "prompt": "A futuristic cityscape at sunset with flying cars",
    "n": 1,
    "size": "1024x1024",
    "response_format": "url"
  }'
The response returns a task id:
{
  "id": "img_task_abc123",
  "status": "queued"
}

Step 2 — Poll for the Result

curl -X GET "$BASE_URL/v1/images/generations/{id}" \
  -H "Authorization: Bearer $TOKEN"
Poll every few seconds until status is "completed". The completed response includes data[0].url — a signed URL valid for 24 hours.
Async mode always returns response_format: url. Even if you pass b64_json, the async endpoint ignores it and returns a URL. Async mode requires object storage (S3/OSS) to be configured on your Fhddos account.

Billing and the no_image_generated Error

When Gemini processes a request but its safety filters prevent an image from being produced, you may see:
{
  "error": {
    "message": "no image generated (request id: 20260608235925678097275ZgRxuG4y)",
    "type": "one_hub_error",
    "code": "no_image_generated"
  },
  "usage": {
    "input_tokens": 353,
    "output_tokens": 0,
    "total_tokens": 353,
    "input_tokens_details": {
      "text_tokens": 95,
      "image_tokens": 258
    }
  }
}
When usage appears in an error response, it means upstream already billed those prompt tokens. Use the usage object to reconcile your cost logs against failed requests. Requests that fail before reaching the model (quota errors, invalid parameters, network failures) do not include usage.

Error Reference

HTTP StatusMeaningResolution
400Bad request — invalid prompt or size formatCheck parameter values and supported aspect ratios
413Reference image too largeCompress the image to under 10 MB
429Rate limit exceededImplement exponential backoff or check your quota