Gemini Chat
Gemini text models are served through the OpenAI-compatible Chat Completions API. Client applications only need to call Cubicspaces /v1/chat/completions.
Endpoint
http
POST /v1/chat/completionsSupported Models
| Model |
|---|
gemini-3.1-flash-lite |
gemini-3-flash-preview |
gemini-3.1-pro-preview |
gemini-3-pro-preview |
Actual model availability depends on account permissions and platform configuration.
Request Example
bash
curl https://cubicspaces.cloud/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-lite",
"messages": [
{ "role": "user", "content": "Introduce Gemini in one sentence." }
],
"temperature": 0.2,
"stream": false
}'Response Format
Responses follow the OpenAI Chat Completions format. Read text from:
text
choices[0].message.contentStreaming
bash
curl https://cubicspaces.cloud/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3-pro-preview",
"messages": [
{ "role": "user", "content": "Write a short product tagline." }
],
"stream": true
}'Streaming responses follow the OpenAI SSE format. Read choices[0].delta.content from each data: chunk.
Notes
- Use
/v1/chat/completionsfor normal public calls. - The request body uses OpenAI Chat Completions fields, such as
model,messages,temperature, andstream. - Do not send Gemini-native
contents,generationConfig, orsafetySettingsto this endpoint.