Image generation gemini-2.5-flash-image
Official documentation: https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cngemini-image-editing
POST
/v1beta/models/gemini-2.5-flash-image:generateContentBody Parametersapplication/json
contents* array
generationConfig* object
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
1{
2"contents": [
3{
4"parts": [
5{
6"text": "'Hi, This is a picture of me. Can you add a llama next to me"
7},
8{
9"inline_data": {
10"data": "iVBORw0KGgoAAAANSUhEUgAABAAAAAKoCAIA...",
11"mime_type": "image/jpeg"
12}
13}
14],
15"role": "user"
16}
17],
18"generationConfig": {
19"imageConfig": {
20"aspectRatio": "16:9"
21},
22"responseModalities": [
23"TEXT",
24"IMAGE"
25]
26}
27}
1curl -X POST "https://api.digislash.com/v1beta/models/gemini-2.5-flash-image:generateContent" \
2-H "Authorization: Bearer <API Key>" \
3-H "Content-Type: application/json" \
4-d '{
5"contents": [
6{
7"parts": [
8{
9"text": "'Hi, This is a picture of me. Can you add a llama next to me"
10},
11{
12"inline_data": {
13"data": "iVBORw0KGgoAAAANSUhEUgAABAAAAAKoCAIA...",
14"mime_type": "image/jpeg"
15}
16}
17],
18"role": "user"
19}
20],
21"generationConfig": {
22"imageConfig": {
23"aspectRatio": "16:9"
24},
25"responseModalities": [
26"TEXT",
27"IMAGE"
28]
29}
30}'
1▼{
2"id": "resp_example",
3"object": "response",
4"status": "completed"
5}
