cURL
curl --request POST \ --url https://www.anyfast.ai/v1beta/models/gemini-2.0-flash:generateContent \ --header 'Content-Type: application/json' \ --data ' { "contents": [ { "role": "user", "parts": [ { "text": "把背景换成蓝天白云" }, { "inline_data": { "mime_type": "image/png", "data": "BASE64_IMAGE_DATA" } } ] } ], "generationConfig": { "responseModalities": [ "IMAGE" ] } } '
{ "candidates": [ { "content": { "parts": [ { "inline_data": { "mime_type": "image/png", "data": "iVBORw0KGgo..." }, "text": "<string>" } ], "role": "model" }, "finishReason": "STOP" } ], "usageMetadata": { "promptTokenCount": 123, "candidatesTokenCount": 123, "totalTokenCount": 123 } }
使用 Gemini 模型编辑图片。
API 密钥
对话内容数组,包含编辑指令和待编辑图片。
Show child attributes
[ { "role": "user", "parts": [ { "text": "把背景换成蓝天白云" }, { "inline_data": { "mime_type": "image/png", "data": "BASE64_IMAGE_DATA" } } ] } ]
成功编辑图片