Gemini API

Chuizi.AI proxies the Gemini API as a native passthrough. Requests follow Google's generateContent / streamGenerateContent format and go directly to Google with automatic failover for high availability. No format conversion happens in either direction.

Use this protocol when you work with the Google AI SDK or any tool that expects the Gemini API format.

Endpoints

MethodPathDescription
POST/gemini/v1beta/models/{model}:generateContentGenerate content (non-streaming)
POST/gemini/v1beta/models/{model}:streamGenerateContentGenerate content (streaming SSE)
GET/gemini/v1beta/modelsList available Gemini models

The {model} parameter is the bare model name (e.g., gemini-2.5-flash, gemini-2.5-pro). The provider/model prefix format (google/gemini-2.5-flash) also works.

Authentication

Chuizi.AI accepts your ck- API key through these headers:

HeaderFormatNotes
x-goog-api-keyck-your-key-hereGoogle AI SDK default
AuthorizationBearer ck-your-key-hereGeneral convention

Both resolve to the same user account, balance, and rate limits.

Request Format

The Gemini API uses a contents array where each entry has a role (user or model) and parts (an array of content pieces).

config.json
json
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {"text": "Explain how garbage collection works in Go."}
      ]
    }
  ],
  "generationConfig": {
    "temperature": 0.7,
    "maxOutputTokens": 1024,
    "topP": 0.9,
    "topK": 40
  }
}

Supported Parameters

ParameterTypeRequiredDescription
contentsarrayYesConversation turns. Each entry has role and parts.
generationConfigobjectNoControls generation behavior.
systemInstructionobjectNoSystem-level instruction. Same format as a content entry.
toolsarrayNoTool/function definitions.
toolConfigobjectNoTool calling configuration.
safetySettingsarrayNoContent safety thresholds.

generationConfig Options

FieldTypeDescription
temperaturenumberSampling temperature, 0-2.
topPnumberNucleus sampling threshold.
topKintegerTop-K sampling.
maxOutputTokensintegerMaximum tokens to generate.
stopSequencesarrayUp to 5 custom stop sequences.
responseMimeTypestringtext/plain or application/json for JSON mode.
responseSchemaobjectJSON schema for structured output (when responseMimeType is application/json).

Next Steps