OpenAI Image Generation for Gemini
https://api.tokenbay.io/v1/chat/completionsGenerate 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
/v1/chat/completionsRequest
schemamodelstringRequiredAvailable Gemini image model ID.
streambooleanRequiredWhether to return a streaming response.
messagesarray<object>Required
OpenAI-compatible messages containing the image prompt.
messages[].rolestringRequiredMessage role, usually user.
messages[].contentstring | array<object>RequiredImage prompt or multimodal content.
modalitiesstring[]RequiredRequested response types, such as text and image.
extra_bodyobjectOptionalAdditional model-specific image generation options.
Response
schemaReturns an OpenAI-compatible Chat Completions response. Image content details depend on the selected Gemini image model.
idstringOptionalResponse ID returned by the upstream.
objectstringOptionalUsually chat.completion or chat.completion.chunk.
createdintegerOptionalCreation timestamp.
modelstringOptionalActual response model.
choices[]array<object>Optional
Candidate outputs. Non-streaming responses usually include message; streaming chunks usually include delta.
choices[].indexintegerOptionalCandidate index.
choices[].message.rolestringOptionalNon-streaming message role.
choices[].message.contentstring | arrayOptionalNon-streaming message content.
choices[].message.tool_callsarray<object>OptionalTool calls requested by the model.
choices[].deltaobjectOptionalStreaming delta payload.
choices[].finish_reasonstringOptionalStop reason, such as stop, length, tool_calls, or content_filter.
choices[].logprobsobjectOptionalToken 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_tokensintegerOptionalInput token count.
usage.completion_tokensintegerOptionalOutput token count.
usage.total_tokensintegerOptionalTotal token count.
