Gemini generates images (native format)

Use Gemini's native generateContent interface to generate images. Using an image-capable model (such as gemini-2.5-flash-image), the generated image is base64 inlined in parts[].inlineData of the response.

Shares the same endpoint /v1beta/models/{model}:generateContent as the text conversation, except using the image model and declaring IMAGE in generationConfig.responseModalities. When images and text are mixed, TEXT can be returned at the same time.

POST /v1beta/models/{model}:generateContent https://api.covanexus.com
Authorization
Body

Authorization

Authorization BearerAuth

Authorization Bearer <token>

Use Bearer Token authentication: Authorization: Bearer $COVA_NEXUS_API_KEY. Also compatible with Gemini-style x-goog-api-key: $COVA_NEXUS_API_KEY request header.

in: header

Request Body

application/json

contents* array[object]
Generate hints for each of role and parts (text, or inlineData image for graphics)
generationConfig? object
Generate configuration. responseModalities is required for drawing, such as ["TEXT","IMAGE"] or ["IMAGE"]; imageConfig.aspectRatio (such as "1:1", "16:9"), etc. is also supported.
systemInstruction? object
System-level instructions (including parts)
safetySettings? array[object]
Security filtering settings

Response Body

status codeType
200application/json
400application/json
429application/json
curl -X POST \
  "https://api.covanexus.com/v1beta/models/gemini-2.5-flash-image:generateContent" \
  -H "Authorization: Bearer $COVA_NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {"role": "user", "parts": [{"text": "画一只戴贝雷帽的柴犬"}]}
  ],
  "generationConfig": {"responseModalities": ["TEXT", "IMAGE"]}
}'
200
400
429
{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          {
            "inlineData": {
              "mimeType": "image.png",
              "data": "<base64>"
            }
          }
        ]
      },
      "finishReason": "STOP",
      "index": 0
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 0,
    "candidatesTokenCount": 0,
    "totalTokenCount": 0
  }
}

BearerAuth