Use Google Gemini's native protocol directly. If you already have code built on the official Gemini SDK, just point the request URL at the gateway. You can also call Gemini models through the OpenAI-compatible Chat Completions endpoint.
The Gemini native protocol uses the x-goog-api-key header, or the URL query parameter ?key=sk-xxxxxxxx.
curl "https://cn.chatapi.app/v1beta/models/gemini-3-pro-preview:generateContent" \
-H "x-goog-api-key: sk-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{"parts": [{"text": "Introduce yourself in one sentence."}]}
]
}'
Use the :streamGenerateContent action for streaming output:
https://cn.chatapi.app/v1beta/models/gemini-3-pro-preview:streamGenerateContent
Common Gemini model names under the native protocol: gemini-3.1-pro-preview, gemini-3-pro-preview, gemini-3-flash-preview, gemini-2.5-pro, gemini-2.5-flash. See the full list at Models.
{
"candidates": [
{
"content": {"parts": [{"text": "..."}], "role": "model"},
"finishReason": "STOP"
}
],
"usageMetadata": {"promptTokenCount": 8, "candidatesTokenCount": 20}
}