Skip to content

Gemini native (generateContent)

POST https://gateway.mindproxy.ai/v1beta/models/<model>:generateContent
POST https://gateway.mindproxy.ai/v1beta/models/<model>:streamGenerateContent

Compatible with Google Gemini's native API. The model goes in the path.

Authentication

Accepts the URL query parameter ?key=sk-..., or Authorization: Bearer sk-....

Request

bash
curl "https://gateway.mindproxy.ai/v1beta/models/gemini-1.5-pro:generateContent?key=$TT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {"parts": [{"text": "Introduce Guangzhou in one sentence."}]}
    ]
  }'
FieldDescription
contentsConversation content (parts array, supports text / multimodal)
generationConfigSampling params (temperature, maxOutputTokens, etc.)
systemInstructionSystem instruction

Response

json
{
  "candidates": [
    {
      "content": {"parts": [{"text": "Guangzhou is the capital of Guangdong, a Lingnan culture hub."}], "role": "model"},
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {"promptTokenCount": 12, "candidatesTokenCount": 14, "totalTokenCount": 26}
}

usageMetadata is the billing basis.

Streaming

Switch the endpoint to :streamGenerateContent; output streams in Gemini's streaming format.

Path prefix

The branded equivalent path also works: /gemini/v1beta/models/<model>:generateContent.

Gateway: gateway.mindproxy.ai · Built with VitePress