Gemini Native
Gemini groups use the Gemini Native API for text, image, and multimodal requests. Use these endpoints when your API key is bound to a Gemini group.
List Models
| Item | Value |
|---|---|
| Method | GET |
| Path | /v1beta/models |
| Authentication | Authorization: Bearer YOUR_API_KEY |
| Group requirement | Gemini group |
bash
curl https://api.llmapi.site/v1beta/models \
-H 'Authorization: Bearer YOUR_API_KEY'The response returns models available to the current Gemini group.
Response example:
json
{
"models": [
{
"name": "models/gemini-2.5-flash-image",
"displayName": "gemini-2.5-flash-image",
"supportedGenerationMethods": ["generateContent"]
}
]
}Get a Model
| Item | Value |
|---|---|
| Method | GET |
| Path | /v1beta/models/{model} |
bash
curl https://api.llmapi.site/v1beta/models/gemini-2.5-flash-image \
-H 'Authorization: Bearer YOUR_API_KEY'Response example:
json
{
"name": "models/gemini-2.5-flash-image",
"displayName": "gemini-2.5-flash-image",
"supportedGenerationMethods": ["generateContent"]
}Generate Content
| Item | Value |
|---|---|
| Method | POST |
| Path | /v1beta/models/{model}:generateContent |
| Content-Type | application/json |
| Authentication | Authorization: Bearer YOUR_API_KEY |
Path parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Gemini model name, such as gemini-2.5-flash-image. |
Common body parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
contents | array | Yes | Gemini content array. Put text and image inputs in parts. |
systemInstruction | object | No | System instruction. |
generationConfig | object | No | Generation configuration. Image models can set responseModalities and imageConfig. |
safetySettings | array | No | Safety settings. |
Text-to-image example:
bash
curl https://api.llmapi.site/v1beta/models/gemini-2.5-flash-image:generateContent \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"contents": [
{
"role": "user",
"parts": [
{ "text": "Generate a clean studio product image of a matte black water bottle on a white background." }
]
}
],
"generationConfig": {
"responseModalities": ["IMAGE"],
"imageConfig": {
"imageSize": "1K"
}
}
}'Multimodal example with an input image:
bash
curl https://api.llmapi.site/v1beta/models/gemini-2.5-flash-image:generateContent \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"contents": [
{
"role": "user",
"parts": [
{ "text": "Create a new product image using this object, with a bright studio background." },
{
"inlineData": {
"mimeType": "image/png",
"data": "BASE64_IMAGE_DATA"
}
}
]
}
],
"generationConfig": {
"responseModalities": ["IMAGE"],
"imageConfig": {
"imageSize": "1K"
}
}
}'Response example:
json
{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"text": "Generated result text."
}
]
},
"finishReason": "STOP"
}
]
}Streaming
Use streaming when the client needs incremental Gemini responses.
text
POST /v1beta/models/{model}:streamGenerateContent?alt=ssebash
curl -N 'https://api.llmapi.site/v1beta/models/gemini-2.5-flash-image:streamGenerateContent?alt=sse' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"contents": [
{
"role": "user",
"parts": [
{ "text": "Generate a square product image of a ceramic coffee cup." }
]
}
],
"generationConfig": {
"responseModalities": ["IMAGE"]
}
}'Streaming responses use Gemini-compatible SSE chunks. Clients should parse each data: event as a Gemini response object.
Errors
| Status | Cause |
|---|---|
400 | Request body, model name, or Gemini payload is invalid. |
401 | API key is missing or invalid. |
403 | Current API key group is not Gemini, or quota/balance checks failed. |
404 | Model is not available to the current Gemini group. |
429 | Rate limit or concurrency limit was reached. |
500 / 502 / 503 | Gateway or upstream Gemini account failed. |