Gemini Native Format
Gemini native interface supports both text and image generation. This interface allows you to directly call Gemini's native capabilities, including the latest image generation features.
Interface Details
Endpoint: POST /v1beta/models/{model}:generateContent
Description: Generates content based on prompts and configurations. Supports multi-modal input (text, images) and multi-modal output (text, images).
Authentication: Bearer Token
Authorization: Bearer YOUR_API_TOKENRequest Parameters
Path Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| model | string | Yes | Model Name | gemini-2.0-flash-exp |
Header Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| Authorization | string | Yes | Bearer Token Auth | Bearer sk-xxx... |
| Content-Type | string | Yes | Content Type | application/json |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| contents | array[object] | Yes | List of dialogue contents |
| contents[].role | string | No | Role (user, model) |
| contents[].parts | array[object] | Yes | Content parts |
| contents[].parts[].text | string | No | Text prompt |
| generationConfig | object | No | Generation config options |
| generationConfig.responseModalities | array[string] | No | Response modalities (TEXT, IMAGE) |
| generationConfig.imageConfig | object | No | Image generation configuration |
| generationConfig.imageConfig.aspectRatio | string | No | Aspect ratio (1:1, 16:9, 9:16, etc.) |
| generationConfig.imageConfig.imageSize | string | No | Output resolution tier, see "Image Resolution" below |
Image Resolution
Which imageSize tiers are available depends on the model. Omit the field to let the model apply its 1K default.
| Tier | Value | Supported models |
|---|---|---|
| 0.5K | 512 | gemini-3.1-flash-image family only |
| 1K | 1K | All image models (default) |
| 2K | 2K | gemini-3-pro-image family |
| 4K | 4K | gemini-3-pro-image family |
The wire value for the 0.5K tier is 512, not 0.5K. So that callers who write the tier by its documented name still work, the gateway rewrites 0.5K (case-insensitive), 512P and 512PX to 512, and all of these spellings are accepted.
Requesting the 0.5K tier on a model that does not support it makes the gateway drop the field and fall back to the model's 1K default rather than fail the request. A tier the gateway does not recognise is forwarded untouched for the model to validate.
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| candidates | array[object] | List of generation candidates |
| candidates[].content | object | Content object |
| candidates[].content.parts | array[object] | Content parts, containing text or generated image data |
| candidates[].finishReason | string | Reason for completion |
| usageMetadata | object | Usage statistics |
| usageMetadata.promptTokenCount | integer | Prompt token count |
| usageMetadata.candidatesTokenCount | integer | Generated token count |
| usageMetadata.totalTokenCount | integer | Total token count |
Code Examples
Curl Example (Image Generation)
curl -X POST "https://api.ezmodel.cloud/v1beta/models/gemini-2.0-flash-exp:generateContent" \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"parts": [
{
"text": "A cyberpunk style fox running in a forest"
}
]
}
],
"generationConfig": {
"responseModalities": ["IMAGE"],
"imageConfig": {
"aspectRatio": "16:9",
"imageSize": "1K"
}
}
}'Response Example
{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"inlineData": {
"mimeType": "image/png",
"data": "iVBORw0KGgoAAA..."
}
}
]
},
"finishReason": "STOP"
}
],
"usageMetadata": {
"promptTokenCount": 15,
"candidatesTokenCount": 0,
"totalTokenCount": 15
}
}