Skip to main content
POST
/
v1
/
chat
/
completions
Text to Image
curl --request POST \
  --url https://gptproto.com/v1/chat/completions \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "role": "<string>",
      "content": "<string>"
    }
  ],
  "model": "<string>"
}'
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Overview

Google Gemini 2.5 Flash Image preview, a powerful new image generation and editing model with advanced features and creative control.

Supported inputs & outputs :

Inputs: Text Outputs: Text and image

Text-to-Image

The default output size for chat mode is 1:1 (1024x1024)

Authentication

This endpoint requires authentication using a Bearer token.
Authorization
string
default:"sk-***********"
required
Your API key in the format: YOUR_API_KEY

Request Body

messages
array
required
Array of message objects for the conversation
model
string
default:"gemini-2.5-flash-image-preview-preview"
required
The model to use for the request
curl -X POST "https://gptproto.com/v1/chat/completions" \
  -H "Authorization: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "messages": [
    {
      "role": "user",
      "content": "Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme"
    }
  ],
  "model": "gemini-2.5-flash-image-preview-preview"
}'

Response

{
    "choices": [
        {
            "finish_reason": "stop",
            "index": 0,
            "message": {
                "content": "Here's your nano banana dish in a fancy restaurant with a Gemini theme! \n![image](data:image/png;base64,iVBORw0....)",
                "role": "assistant"
            }
        }
    ],
    "created": 1762163196,
    "id": "chatcmpl-20251103174627570914749cO7T1Yq5",
    "model": "gemini-2.5-flash-image-preview-preview",
    "object": "chat.completion",
    "usage": {
        "completion_tokens": 1307,
        "completion_tokens_details": {
            "accepted_prediction_tokens": 0,
            "audio_tokens": 0,
            "reasoning_tokens": 0,
            "rejected_prediction_tokens": 0
        },
        "prompt_tokens": 16,
        "prompt_tokens_details": {
            "audio_tokens": 0,
            "cached_tokens": 0
        },
        "total_tokens": 1323
    }
}
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}