-
Notifications
You must be signed in to change notification settings - Fork 0
docs: publish Gemini native image references #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
model-api-reference/official-native-api/google/gemini-3-pro-image.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| --- | ||
| title: "Nano Banana Pro Native API Reference" | ||
| description: "Native Gemini GenerateContent API reference for google/gemini-3-pro-image (Nano Banana Pro) on SandBase." | ||
| aside: false | ||
| outline: false | ||
| apiReference: | ||
| title: Nano Banana Pro (Gemini 3 Pro Image) | ||
| operation: Gemini GenerateContent | ||
| method: POST | ||
| path: /v1beta/models/gemini-3-pro-image:generateContent | ||
| description: Generate or edit images with Nano Banana Pro through the native Google Gemini protocol. SandBase preserves the provider request and response payload instead of converting it to Chat Completions. | ||
| groups: | ||
| - title: Request body | ||
| description: Send a native Gemini GenerateContent body. Provider-defined fields are passed through for this model. | ||
| fields: | ||
| - { name: contents, type: array, required: true, description: Gemini Content objects containing the prompt and optional input images. } | ||
| - { name: generationConfig.responseModalities, type: "array<string>", required: true, description: "Requested output modalities. Include IMAGE; include TEXT when you also want a text part." } | ||
| - { name: generationConfig.imageConfig, type: object, required: false, description: "Image options such as aspectRatio, when supported by the provider." } | ||
| examples: | ||
| - label: cURL | ||
| language: bash | ||
| code: |- | ||
| curl -X POST \ | ||
| "https://api.sandbase.ai/v1beta/models/gemini-3-pro-image:generateContent" \ | ||
| -H "x-goog-api-key: $SANDBASE_API_KEY" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "contents": [{ | ||
| "role": "user", | ||
| "parts": [{"text": "Create a studio product photo of a translucent blue perfume bottle on white marble."}] | ||
| }], | ||
| "generationConfig": { | ||
| "responseModalities": ["TEXT", "IMAGE"], | ||
| "imageConfig": {"aspectRatio": "1:1"} | ||
| } | ||
| }' | ||
| response: | ||
| status: 200 OK | ||
| code: |- | ||
| { | ||
| "candidates": [{ | ||
| "content": { | ||
| "role": "model", | ||
| "parts": [ | ||
| {"text": "Here is the generated image."}, | ||
| {"inlineData": {"mimeType": "image/png", "data": "<base64-image>"}} | ||
| ] | ||
| }, | ||
| "finishReason": "STOP", | ||
| "index": 0 | ||
| }], | ||
| "usageMetadata": {"totalTokenCount": 1290} | ||
| } | ||
| seo: | ||
| modelName: "Nano Banana Pro (Gemini 3 Pro Image)" | ||
| modelId: "google/gemini-3-pro-image" | ||
| vendor: "Google" | ||
| vendorSlug: "google" | ||
| modelSlug: "gemini-3-pro-image" | ||
| protocol: "Gemini GenerateContent API" | ||
| endpoint: "/v1beta/models/gemini-3-pro-image:generateContent" | ||
| publishedAt: "2026-08-31T00:00:00Z" | ||
| capabilities: ["image_generation", "image_editing"] | ||
| category: "Official Native API" | ||
| --- | ||
|
|
||
| <ApiReferencePage /> | ||
|
|
||
| ## Edit an image | ||
|
|
||
| Add the source image as an `inlineData` part next to the text instruction. Use the MIME type of the bytes you send: | ||
|
|
||
| ```json | ||
| { | ||
| "contents": [{ | ||
| "role": "user", | ||
| "parts": [ | ||
| {"text": "Replace the background with a warm sunset gradient."}, | ||
| {"inlineData": {"mimeType": "image/jpeg", "data": "<base64-input-image>"}} | ||
| ] | ||
| }], | ||
| "generationConfig": {"responseModalities": ["IMAGE"]} | ||
| } | ||
| ``` | ||
|
|
||
| ## Response handling | ||
|
|
||
| Read generated media from the returned candidate parts. Because this model uses native passthrough, provider-defined | ||
| field casing and MIME metadata are returned as received. Decode the base64 payload and verify the actual media bytes | ||
| before choosing a file extension. | ||
|
|
||
| ## Official Google resources | ||
|
|
||
| - [Gemini API documentation](https://ai.google.dev/gemini-api/docs) | ||
| - [Image generation documentation](https://ai.google.dev/gemini-api/docs/image-generation) | ||
| - [GenerateContent API reference](https://ai.google.dev/api/generate-content) |
95 changes: 95 additions & 0 deletions
95
model-api-reference/official-native-api/google/gemini-3.1-flash-image.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| --- | ||
| title: "Nano Banana 2 Native API Reference" | ||
| description: "Native Gemini GenerateContent API reference for google/gemini-3.1-flash-image (Nano Banana 2) on SandBase." | ||
| aside: false | ||
| outline: false | ||
| apiReference: | ||
| title: Nano Banana 2 (Gemini 3.1 Flash Image) | ||
| operation: Gemini GenerateContent | ||
| method: POST | ||
| path: /v1beta/models/gemini-3.1-flash-image:generateContent | ||
| description: Generate or edit images with Nano Banana 2 through the native Google Gemini protocol. SandBase preserves the provider request and response payload instead of converting it to Chat Completions. | ||
| groups: | ||
| - title: Request body | ||
| description: Send a native Gemini GenerateContent body. Provider-defined fields are passed through for this model. | ||
| fields: | ||
| - { name: contents, type: array, required: true, description: Gemini Content objects containing the prompt and optional input images. } | ||
| - { name: generationConfig.responseModalities, type: "array<string>", required: true, description: "Requested output modalities. Include IMAGE; include TEXT when you also want a text part." } | ||
| - { name: generationConfig.imageConfig, type: object, required: false, description: "Image options such as aspectRatio, when supported by the provider." } | ||
| examples: | ||
| - label: cURL | ||
| language: bash | ||
| code: |- | ||
| curl -X POST \ | ||
| "https://api.sandbase.ai/v1beta/models/gemini-3.1-flash-image:generateContent" \ | ||
| -H "x-goog-api-key: $SANDBASE_API_KEY" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "contents": [{ | ||
| "role": "user", | ||
| "parts": [{"text": "Create a wide editorial illustration of a solar-powered city at sunrise."}] | ||
| }], | ||
| "generationConfig": { | ||
| "responseModalities": ["IMAGE"], | ||
| "imageConfig": {"aspectRatio": "16:9"} | ||
| } | ||
| }' | ||
| response: | ||
| status: 200 OK | ||
| code: |- | ||
| { | ||
| "candidates": [{ | ||
| "content": { | ||
| "role": "model", | ||
| "parts": [ | ||
| {"inline_data": {"mime_type": "image/png", "data": "<base64-image>"}} | ||
| ] | ||
| }, | ||
| "finishReason": "STOP", | ||
| "index": 0 | ||
| }], | ||
| "usageMetadata": {"totalTokenCount": 980} | ||
| } | ||
| seo: | ||
| modelName: "Nano Banana 2 (Gemini 3.1 Flash Image)" | ||
| modelId: "google/gemini-3.1-flash-image" | ||
| vendor: "Google" | ||
| vendorSlug: "google" | ||
| modelSlug: "gemini-3.1-flash-image" | ||
| protocol: "Gemini GenerateContent API" | ||
| endpoint: "/v1beta/models/gemini-3.1-flash-image:generateContent" | ||
| publishedAt: "2026-08-31T00:00:00Z" | ||
| capabilities: ["image_generation", "image_editing"] | ||
| category: "Official Native API" | ||
| --- | ||
|
|
||
| <ApiReferencePage /> | ||
|
|
||
| ## Edit an image | ||
|
|
||
| Add the source image as an `inlineData` part next to the text instruction. Use the MIME type of the bytes you send: | ||
|
|
||
| ```json | ||
| { | ||
| "contents": [{ | ||
| "role": "user", | ||
| "parts": [ | ||
| {"text": "Keep the subject unchanged and turn the background into a paper-cut landscape."}, | ||
| {"inlineData": {"mimeType": "image/png", "data": "<base64-input-image>"}} | ||
| ] | ||
| }], | ||
| "generationConfig": {"responseModalities": ["IMAGE"]} | ||
| } | ||
| ``` | ||
|
|
||
| ## Response handling | ||
|
|
||
| Read generated media from the returned candidate parts. Because this model uses native passthrough, provider-defined | ||
| field casing and MIME metadata are returned as received. Decode the base64 payload and verify the actual media bytes | ||
| before choosing a file extension. | ||
|
|
||
| ## Official Google resources | ||
|
|
||
| - [Gemini API documentation](https://ai.google.dev/gemini-api/docs) | ||
| - [Image generation documentation](https://ai.google.dev/gemini-api/docs/image-generation) | ||
| - [GenerateContent API reference](https://ai.google.dev/api/generate-content) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clients following this response example will look for
inline_data.mime_type, but GenerateContent JSON usesinlineData.mimeType, as shown by the request on this page, the companion Gemini 3 Pro Image response, and the shared OpenAPI schema. Since this page documents native Gemini passthrough, use the actual camelCase response keys so copied parsing code can find and decode the returned image.Useful? React with 👍 / 👎.