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": [
    {}
  ],
  "model": "<string>"
}'
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Overview

  • Text-to-Image: Generate high-quality images from simple or complex text descriptions.

Supported inputs & outputs :

Inputs: Text Outputs: Text and image

Text-to-Image

The default output size for chat mode is 1:1 (1024x1024)
curl -X POST "https://gptproto/v1/chat/completions" \
  -H "Authorization: Bearer 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"
}'

Authentication

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

Request Body

messages
array
required
Array of message objects for the conversation
model
string
default:"gemini-2.5-flash-image"
required
The model to use for the request

Response

Success
200
{
    "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",
    "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"
  }
}

Scenes Example

Photorealistic scenes

For realistic images, use photography terms. Mention camera angles, lens types, lighting, and fine details to guide the model toward a photorealistic result.
curl --location 'https://gptproto/v1/chat/completions' \
--header 'Authorization: sk-xxxx' \
--header 'Content-Type: application/json' \
--data '{
  "messages": [
    {
      "role": "user",
      "content": "A photorealistic close-up portrait of an elderly Japanese ceramicist with deep, sun-etched wrinkles and a warm, knowing smile. He is carefully inspecting a freshly glazed tea bowl. The setting is his rustic, sun-drenched workshop with pottery wheels and shelves of clay pots in the background. The scene is illuminated by soft, golden hour light streaming through a window, highlighting the fine texture of the clay and the fabric of his apron. Captured with an 85mm portrait lens, resulting in a soft, blurred background (bokeh). The overall mood is serene and masterful."
    }
  ],
  "model": "gemini-2.5-flash-image"
}'
Alt text describing the image

Stylized illustrations & stickers

To create stickers, icons, or assets, be explicit about the style and request a transparent background.
curl --location 'https://gptproto/v1/chat/completions' \
--header 'Authorization: sk-xxxx' \
--header 'Content-Type: application/json' \
--data '{
  "messages": [
    {
      "role": "user",
      "content": "A kawaii-style sticker of a happy red panda wearing a tiny bamboo hat. It'"'"'s munching on a green bamboo leaf. The design features bold, clean outlines, simple cel-shading, and a vibrant color palette. The background must be white."
    }
  ],
  "model": "gemini-2.5-flash-image"
}'
Alt text describing the image

Accurate text in images

Gemini excels at rendering text. Be clear about the text, the font style (descriptively), and the overall design.
curl --location 'https://gptproto/v1/chat/completions' \
--header 'Authorization: sk-xxxx' \
--header 'Content-Type: application/json' \
--data '{
  "messages": [
    {
      "role": "user",
      "content": "Create a modern, minimalist logo for a coffee shop called '"'"'The Daily Grind'"'"'. The text should be in a clean, bold, sans-serif font. The design should feature a simple, stylized icon of a a coffee bean seamlessly integrated with the text. The color scheme is black and white."
    }
  ],
  "model": "gemini-2.5-flash-image"
}'
Alt text describing the image

Product mockups & commercial photography

Gemini excels at rendering text. Be clear about the text, the font style (descriptively), and the overall design.
curl --location 'https://gptproto/v1/chat/completions' \
--header 'Authorization: sk-xxxx' \
--header 'Content-Type: application/json' \
--data '{
  "messages": [
    {
      "role": "user",
      "content": "A high-resolution, studio-lit product photograph of a minimalist ceramic coffee mug in matte black, presented on a polished concrete surface. The lighting is a three-point softbox setup designed to create soft, diffused highlights and eliminate harsh shadows. The camera angle is a slightly elevated 45-degree shot to showcase its clean lines. Ultra-realistic, with sharp focus on the steam rising from the coffee. Square image."
    }
  ],
  "model": "gemini-2.5-flash-image"
}'
Alt text describing the image

Minimalist & negative space design

Excellent for creating backgrounds for websites, presentations, or marketing materials where text will be overlaid.
curl --location 'https://gptproto/v1/chat/completions' \
--header 'Authorization: sk-xxxx' \
--header 'Content-Type: application/json' \
--data '{
  "messages": [
    {
      "role": "user",
      "content": "A minimalist composition featuring a single, delicate red maple leaf positioned in the bottom-right of the frame. The background is a vast, empty off-white canvas, creating significant negative space for text. Soft, diffused lighting from the top left. Square image."
    }
  ],
  "model": "gemini-2.5-flash-image"
}'
Alt text describing the image

Sequential art (Comic panel / Storyboard)

Builds on character consistency and scene description to create panels for visual storytelling.
curl --location 'https://gptproto/v1/chat/completions' \
--header 'Authorization: sk-xxxx' \
--header 'Content-Type: application/json' \
--data '{
  "messages": [
    {
      "role": "user",
      "content": "A single comic book panel in a gritty, noir art style with high-contrast black and white inks. In the foreground, a detective in a trench coat stands under a flickering streetlamp, rain soaking his shoulders. In the background, the neon sign of a desolate bar reflects in a puddle. A caption box at the top reads \"The city was a tough place to keep secrets.\" The lighting is harsh, creating a dramatic, somber mood. Landscape."
    }
  ],
  "model": "gemini-2.5-flash-image"
}'
Alt text describing the image