Skip to main content
Content updated: 2026-06-09

Gemini OpenAI compatible format

You can call Gemini using a format compatible with OpenAI Chat Completions.
This page only documents the behavior of the compatibility layer 2026-03-22 that has already been reviewed in the Crazyrouter production environment. Current main example model:
  • gemini-3.1-pro

Current main conclusions

Production review in this round confirms:
  • gemini-3.1-pro can interact normally via /v1/chat/completions
  • Streaming responses are compatible with chat.completion.chunk SSE structure
  • If you need Gemini’s structured output, Google Search, thinking capabilities, etc., you should still prioritize Gemini native format for now

Basic conversation

cURL
Key structures returned in current production validation:

Python example

Python

Streaming output

This round of production has also reviewed streaming compatible returns:
Python
Typical SSE segment shapes received in current production look like:

When to use the compatible format, and when to use the native format

  • If you already have OpenAI SDK code and only need standard conversations: prioritize compatible format
  • If you need Gemini’s structured output, Google Search, thinking, or native fields: prioritize Gemini native format
This page only covers the /v1/chat/completions compatibility layer. For Gemini image workloads, please use the unified Images API: POST https://api.crazyrouter.com/v1/images/generations, and see Nano Banana, Nano Banana Pro, Nano Banana 2 for reference.