Chat interface - supports text-to-image, image-to-image, and pure conversation
POST
/v1/chat/completions
Universal chat interface supporting Gemini model's text-to-image, image-to-image, and pure conversation features.Interface features:
Supports streaming output: Receive generation progress in real-time
Shows reasoning process: Returns the model's reasoning process (reasoning_content)
More flexible interaction: Can chat without generating images, or generate images
Multimodal support: Naturally mix text and image inputs in conversations
Fast generation: Faster generation speed compared to Pro version
Request
Authorization
API Key
Add parameter in header
Authorization
Example:
Authorization: ********************
or
Body Params application/jsonRequired
Examples
{"model":"gemini-2.5-flash-image","stream":true,"messages":[{"role":"user","content":"Draw a cute orange cat sitting on a windowsill watching the sunset"}]}
Request Code Samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl--location'https://api-xmodel.nexconn.ai/v1/chat/completions' \
--header'Authorization: <api-key>' \
--header'Content-Type: application/json' \
--data'{
"model": "gemini-2.5-flash-image",
"stream": true,
"messages": [
{
"role": "user",
"content": "Draw a cute orange cat sitting on a windowsill watching the sunset"
}
]
}'
Responses
🟢200Success
application/json
Request successful
Bodyapplication/json
Example
{"id":"chatcmpl-2f8236e9f2b34bd391289576d0e23e72","object":"chat.completion","created":1764574464,"model":"gemini-2.5-flash-image","choices":[{"index":0,"message":{"role":"assistant","content":"","reasoning_content":"**Analyzing the request**\n\nProcessing the image generation task...","images":[{"type":"image_url","image_url":{"url":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABYAAAAMACAIAAAASU1SbA.........."},"index":0}]},"finish_reason":"stop"}],"usage":{"prompt_tokens":19,"completion_tokens":1120,"total_tokens":1139,"prompt_tokens_details":{"text_tokens":19},"completion_tokens_details":{"reasoning_tokens":100,"image_tokens":1020}}}