curl --request POST \
--url https://api.omniall.ai/v1/chat/completions \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gemini-3.1-flash-image-preview",
"messages": [
{
"role": "user",
"content": "An orange cat sleeping under cherry blossoms, Japanese illustration, soft light"
}
],
"stream": false,
"extra_body": {
"google": {
"image_config": {
"aspect_ratio": "1:1",
"image_size": "2K"
}
}
}
}
'{}Gemini image
Chat image generation
POST
/
v1
/
chat
/
completions
curl --request POST \
--url https://api.omniall.ai/v1/chat/completions \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gemini-3.1-flash-image-preview",
"messages": [
{
"role": "user",
"content": "An orange cat sleeping under cherry blossoms, Japanese illustration, soft light"
}
],
"stream": false,
"extra_body": {
"google": {
"image_config": {
"aspect_ratio": "1:1",
"image_size": "2K"
}
}
}
}
'{}One endpoint, multiple use cases
POST /v1/chat/completions covers text-to-image and image-to-image (plus multi-image / PDF / short-video references). They differ only in messages content — not separate APIs.
| Use case | messages[].content |
|---|---|
| Text-to-image | Plain string, or only type: text |
| Image-to-image | text + image_url (one or more) |
| PDF reference (Banana 2.1) | text + file |
| Short video (Banana 2.1) | text + video_url (string) |
messages → download URL / decode data URL → Gemini inlineData → upstream generateContent.
Remote PDF / video URLs are supported; they are not forwarded as fileUri.
| Media | Content type | Value |
|---|---|---|
| Image | image_url | HTTPS URL or data:image/...;base64,... |
file | filename + file_data (HTTPS URL or data:application/pdf;base64,...) | |
| Video | video_url | String HTTPS URL or data:video/mp4;base64,... |
PDF URL (complete)
{
"model": "gemini-nano-banana-2.1",
"stream": false,
"extra_body": {
"google": {
"image_config": {
"aspect_ratio": "3:2",
"image_size": "1K"
}
}
},
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Read the PDF. List labels, colors and shapes by page, then generate a reference-sheet image on a white background."
},
{
"type": "file",
"file": {
"filename": "reference.pdf",
"file_data": "https://example.com/reference.pdf"
}
}
]
}
]
}
Video URL (complete)
{
"model": "gemini-nano-banana-2.1",
"stream": false,
"extra_body": {
"google": {
"image_config": {
"aspect_ratio": "3:2",
"image_size": "1K"
}
}
},
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Watch the video. List scene elements in order, then generate a reference-sheet image."
},
{
"type": "video_url",
"video_url": "https://example.com/clip.mp4"
}
]
}
]
}
curl --fail-with-body --max-time 180 \
"https://api.omniall.ai/v1/chat/completions" \
-H "Authorization: Bearer sk-xxx" \
-H "Content-Type: application/json" \
--data-binary @request.json
video_url as a string, not { "url": "..." }.
Optional: Thinking
Banana 2.1 supports thinking levelsminimal / medium (default) / high via extra_body.google.thinking_config (snake_case):
"extra_body": {
"google": {
"image_config": { "aspect_ratio": "3:2", "image_size": "1K" },
"thinking_config": {
"thinking_level": "high",
"include_thoughts": false
}
}
}
include_thoughts only controls whether thought text is returned; you can omit thinking_config for typical use. See Overview · Thinking.Headers
Bearer API key, e.g. Bearer sk-....
Example:
"Bearer sk-..."
Body
application/json
Gemini Chat image request body (POST /v1/chat/completions).
Gemini image model id. Examples: gemini-nano-banana-2.1, gemini-3.1-flash-image-preview.
Example:
"gemini-3.1-flash-image-preview"
Chat messages. Text-to-image is usually one user text; image-to-image adds media parts.
Show child attributes
Show child attributes
Whether to stream. Prefer false for Chat image generation (one-shot complete response).
Example:
false
Provider extensions under extra_body.google.
Show child attributes
Show child attributes
Response
Chat Completions response (SSE when streaming).
The response is of type object.