Theme
Image Generation
POST
https://www.kkiai.com/v1beta/models/{modeName}:generateContent
Official Documentation: https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn
Request Parameters
Authorization
Add the Authorization parameter to the Header. Its value is the Token concatenated after Bearer.
Example: Authorization: Bearer ********************
Path Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
modeName | string | Required | Model name: gemini-2.5-flash-image gemini-2.5-flash-image-preview gemini-3-pro-image-preview gemini-3.1-flash-image-preview |
Query Parameters
| Parameter Name | Type | Required | Description | Example |
|---|---|---|---|---|
key | string | Required | {{YOUR_API_KEY}} |
Header Parameters
| Parameter Name | Type | Required | Description | Example |
|---|---|---|---|---|
Content-Type | string | Required | application/json |
Body Parameters (application/json)
| Parameter Name | Type | Required | Description |
|---|---|---|---|
contents | array[object] | Required | |
└ parts | array[object] | Required | |
generationConfig | object | Optional | |
└ responseModalities | array[string] | Optional | Response modalities: Text、Image Default: ["Text", "Image"] |
└ imageConfig | object | Optional |
Request Example
json
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hi, can you create a 3d rendered image of a pig with wings and a top hat flying over a happy futuristic scifi city with lots of greenery?"
}
]
}
],
"generationConfig": {
"responseModalities": [
"IMAGE"
]
}
}cURL Example
bash
curl --location -g --request POST 'https://www.kkiai.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent?key=' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hi, can you create a 3d rendered image of a pig with wings and a top hat flying over a happy futuristic scifi city with lots of greenery?"
}
]
}
],
"generationConfig": {
"responseModalities": [
"IMAGE"
]
}
}'Response
🟢 200 Success
Response Example
json
{}