メインコンテンツへスキップ
更新日: 2026-06-06

Gemini OpenAI-Compatible Format

You can call Gemini through the OpenAI Chat Completions compatible route.
This page only documents compatibility-layer behavior that was revalidated against Crazyrouter production on 2026-03-22. Current primary example model:
  • gemini-3.1-pro

Current conclusion

This production recheck confirmed that:
  • gemini-3.1-pro works through /v1/chat/completions for normal text chat
  • streaming returns standard chat.completion.chunk SSE objects
  • for Gemini-specific capabilities such as structured outputs, Google Search, and thinking, you should still prefer Gemini Native Format

Basic conversation

cURL
Verified response shape:

Python example

Python

Streaming output

This production recheck also confirmed streaming compatibility:
Python
Observed SSE shape:

When to use compatible vs native

  • If you already have OpenAI SDK code and only need standard chat, use the compatible route
  • If you need Gemini-native structured outputs, Google Search, thinking, or native metadata, use Gemini Native Format
This page still only covers the /v1/chat/completions compatibility layer and does not fold Gemini-backed image behavior into it. For image workloads, do not keep documenting the Nano Banana family as a stable /v1/images/generations contract. The currently preferred entry point is Nano Banana 2, which now points to native Gemini POST /v1beta/models/nano-banana-2:generateContent. Nano Banana remains controlled-testing only.