cURL
curl --request POST \ --url https://api.tkhub.ai/v1/v1beta/models/{model}:generateContent \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "contents": [ { "role": "user", "parts": [ { "text": "draw a cat" } ] } ], "generationConfig": { "responseModalities": [ "TEXT", "IMAGE" ], "imageConfig": { "aspectRatio": "16:9", "imageSize": "4K" } } } '
{ "candidates": [ { "content": { "role": "<string>", "parts": [ {} ] }, "finishReason": "<string>", "safetyRatings": [ {} ] } ], "usageMetadata": { "promptTokenCount": 123, "candidatesTokenCount": 123, "totalTokenCount": 123 } }
Gemini 图片生成
使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx
Authorization: Bearer sk-xxxxxx
模型名称
Show child attributes
成功
Was this page helpful?