Docs Native format /v1beta/models/{modeName}:generateContent
API reference

Image generation

Official documentation: https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn

POST/v1beta/models/{modeName}:generateContent

Body Parametersapplication/json

contents* array

List of conversation contents; each item has parts (text/image/etc.)

items
object object
generationConfig object

Generate configuration

properties
imageConfig object

Picture configuration

responseModalities array

Response mode: Text, Image Default: ["Text", "Image"]

response_format string

Fill in the url and return the url, if not fill in the default base64

Responses

200 application/json
response-200 object
400 Bad request or validation failed application/json
response-400 object
properties
error* object
401 Missing or invalid API Key application/json
response-401 object
Request Body Example
1{
2"contents": [
3{
4"parts": [
5{
6"inline_data": {
7"data": "string",
8"mime_type": "string"
9},
10"text": "string"
11}
12]
13}
14]
15}
Code Sample cURL
1curl -X POST "https://api.digislash.com/v1beta/models/{modeName}:generateContent" \
2-H "Authorization: Bearer <API Key>" \
3-H "Content-Type: application/json" \
4-d '{
5"contents": [
6{
7"parts": [
8{
9"inline_data": {
10"data": "string",
11"mime_type": "string"
12},
13"text": "string"
14}
15]
16}
17]
18}'
Response
1▼{
2"id": "resp_example",
3"object": "response",
4"status": "completed"
5}