API ReferenceImage SeriesGemini FormatPOSTOpenAI Image Generation
Image SeriesPOSTOpenAI Image Generation for Gemini
API Reference

OpenAI Image Generation for Gemini

POSThttps://api.tokenbay.io/v1/chat/completions

Generate images with Gemini image models using the OpenAI-compatible chat format

Calls a Gemini image model through the OpenAI-compatible Chat Completions endpoint. Request image output with the modalities field.

OpenAI Image Generation for Gemini

openai
POST/v1/chat/completions

Request

schema
modelstringRequired

Available Gemini image model ID.

streambooleanRequired

Whether to return a streaming response.

messagesarray<object>Required

OpenAI-compatible messages containing the image prompt.

messages[].rolestringRequired

Message role, usually user.

messages[].contentstring | array<object>Required

Image prompt or multimodal content.

modalitiesstring[]Required

Requested response types, such as text and image.

extra_bodyobjectOptional

Additional model-specific image generation options.

Response

schema

Returns an OpenAI-compatible Chat Completions response. Image content details depend on the selected Gemini image model.

idstringOptional

Response ID returned by the upstream.

objectstringOptional

Usually chat.completion or chat.completion.chunk.

createdintegerOptional

Creation timestamp.

modelstringOptional

Actual response model.

choices[]array<object>Optional

Candidate outputs. Non-streaming responses usually include message; streaming chunks usually include delta.

choices[].indexintegerOptional

Candidate index.

choices[].message.rolestringOptional

Non-streaming message role.

choices[].message.contentstring | arrayOptional

Non-streaming message content.

choices[].message.tool_callsarray<object>Optional

Tool calls requested by the model.

choices[].deltaobjectOptional

Streaming delta payload.

choices[].finish_reasonstringOptional

Stop reason, such as stop, length, tool_calls, or content_filter.

choices[].logprobsobjectOptional

Token probability details when supported and requested.

usageobjectOptional

Token usage. For some streaming calls it may only appear in the final event or when supported upstream.

usage.prompt_tokensintegerOptional

Input token count.

usage.completion_tokensintegerOptional

Output token count.

usage.total_tokensintegerOptional

Total token count.

Related