curl --request POST \
--url https://api.omniall.ai/v1beta/models/{model}:generateContent \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Create a product photo of a yellow ceramic mug on a wooden desk."
}
]
}
],
"generationConfig": {
"responseModalities": [
"TEXT",
"IMAGE"
],
"imageConfig": {
"aspectRatio": "3:2",
"imageSize": "1K"
}
}
}
'Gemini image
Gemini native format
Native Gemini generateContent for image generation.
Path: POST https://api.omniall.ai/v1beta/models/{model}:generateContent
Prefer gemini-nano-banana-2.1 for PDF / short-video reference generation.
Put media bytes in inlineData.data as raw Base64 (no data: prefix).
Output images appear in candidates[].content.parts[].inlineData.
Auth: Authorization: Bearer sk-... or x-goog-api-key.
POST
/
v1beta
/
models
/
{model}
:generateContent
curl --request POST \
--url https://api.omniall.ai/v1beta/models/{model}:generateContent \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Create a product photo of a yellow ceramic mug on a wooden desk."
}
]
}
],
"generationConfig": {
"responseModalities": [
"TEXT",
"IMAGE"
],
"imageConfig": {
"aspectRatio": "3:2",
"imageSize": "1K"
}
}
}
'Banana 2.1 (gemini-nano-banana-2.1)
Use native generateContent for text-to-image, image-to-image, PDF reference, and short video reference.
| Input | inlineData.mimeType | inlineData.data |
|---|---|---|
| Image | image/jpeg / image/png / … | Raw Base64 (no data: prefix) |
application/pdf | Raw Base64 | |
| Short video | video/mp4 | Raw Base64 |
generationConfig.responseModalities to include IMAGE.
PDF reference (complete)
export BASE_URL="https://api.omniall.ai"
export API_KEY="sk-xxx"
PDF_B64=$(base64 < reference.pdf | tr -d '\n')
cat > request.json <<EOF
{
"contents": [{
"role": "user",
"parts": [
{"inlineData": {"mimeType": "application/pdf", "data": "$PDF_B64"}},
{"text": "Read every page of the PDF. List labels, colors and shapes in page order, then generate a reference-sheet image preserving them."}
]
}],
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"],
"imageConfig": {"aspectRatio": "3:2", "imageSize": "1K"}
}
}
EOF
curl --fail-with-body --max-time 180 \
"$BASE_URL/v1beta/models/gemini-nano-banana-2.1:generateContent" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
--data-binary @request.json -o response.json
Short video reference (complete)
VIDEO_B64=$(base64 < reference.mp4 | tr -d '\n')
cat > request.json <<EOF
{
"contents": [{
"role": "user",
"parts": [
{"inlineData": {"mimeType": "video/mp4", "data": "$VIDEO_B64"}},
{"text": "Watch the entire video. List labels, colors and shapes chronologically, then generate a reference-sheet image preserving them."}
]
}],
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"],
"imageConfig": {"aspectRatio": "3:2", "imageSize": "1K"}
}
}
EOF
curl --fail-with-body --max-time 180 \
"$BASE_URL/v1beta/models/gemini-nano-banana-2.1:generateContent" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
--data-binary @request.json -o response.json
candidates[].content.parts[].inlineData (scan all parts; skip thought: true). Prefer short H.264 MP4 and small PDFs; Base64 expands roughly one third.
Optional: Thinking
Banana 2.1 supportsthinkingLevel: minimal / medium (default) / high. Omit for typical use; when needed, set generationConfig.thinkingConfig:
"generationConfig": {
"responseModalities": ["TEXT", "IMAGE"],
"imageConfig": { "aspectRatio": "3:2", "imageSize": "1K" },
"thinkingConfig": {
"thinkingLevel": "high",
"includeThoughts": false
}
}
includeThoughts only controls whether thought text is returned; it does not disable internal thinking. See Overview · Thinking.Headers
Bearer API key.
Example:
"Bearer sk-..."
Path Parameters
Gemini image model id. Examples: gemini-nano-banana-2.1, gemini-3.1-flash-image-preview.
Example:
"gemini-nano-banana-2.1"
Body
application/json
Response
OK — read text/images from candidates[].content.parts.