/v1/images/generations endpoint. It produces native 2K resolution images by default and supports reference-image-driven generation, multi-image style fusion, and 4K upscaling via the extra_fields parameter.
Endpoint: POST https://api.qhaigc.net/v1/images/generations
Supported Models
| Model ID | Description |
|---|---|
nano-banana-2 | Google image model. Native 2K resolution, reference image support, 4K upscaling. |
nano-banana-pro | Enhanced character consistency and complex image understanding. |
Request Parameters
Use
nano-banana-2 or nano-banana-pro.Text description of the image you want to generate.
Image dimensions. You can use either OpenAI-style
If you pass a size not in this table (e.g.
widthxheight values or Nano Banana native resolution names:size value | Resolution | Aspect Ratio |
|---|---|---|
1024x1024 | 1K | 1:1 |
1024x1792 | 1K | 9:16 |
1792x1024 | 1K | 16:9 |
512 | 512 | native |
1K | 1K | native |
2K | 2K | native |
4K | 4K | native |
800x600), the model falls back to its default resolution.Nano Banana-specific advanced parameters. All fields are optional.
Response Fields
Unix timestamp of when the image was generated.
Array containing the generated image object.
Code Examples
Basic generation
Native 2K with custom aspect ratio
Reference image URL
Multi-image style fusion
4K upscaled output with base64 reference
When you pass both
extra_fields.image_size and extra_fields.aspect_ratio, they override whatever resolution and ratio would have been inferred from the size field.Fallback Behavior
| Scenario | Behavior |
|---|---|
size not in the mapping table | No resolution mapping applied; model uses its default |
extra_fields not passed | Only prompt and size are used; fully OpenAI-compatible |
Invalid fields inside extra_fields | Invalid fields are ignored; generation proceeds normally |
| Reference image URL not accessible | URL is passed to the model as-is; model may return an error |
Common Errors
| Error | Cause |
|---|---|
no base64 image found in response | Model did not return an image. Check your prompt or model support. |
failed to upload image | Image upload to the proxy server failed. Contact support if this persists. |
chat response contains no choices | Model returned empty response, likely due to a safety filter. Adjust your prompt. |