Skip to main content
For authentication and model list, see Overview.

Endpoint

POST https://api.pipellm.ai/v1beta/models/{model}:generateContent
This free route accepts Gemini native requests and routes only to Gemini platforms. To keep the Gemini format while calling OpenAI or Anthropic models, use the Gemini Format Converter.

Install SDK

pip install google-genai

Code Examples

curl "https://api.pipellm.ai/v1beta/models/gemini-3-flash-preview:generateContent" \
  -H "Content-Type: application/json" \
  -H "x-goog-api-key: $PIPELLM_API_KEY" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [
          {"text": "Why is the sky blue?"}
        ]
      }
    ]
  }'

Request Format

{
  "contents": [
    {
      "role": "user",
      "parts": [
        {"text": "Your message here"}
      ]
    }
  ],
  "generationConfig": {
    "temperature": 0.7,
    "maxOutputTokens": 1024
  }
}

Response Format

{
  "candidates": [
    {
      "content": {
        "parts": [
          {"text": "The sky appears blue because..."}
        ],
        "role": "model"
      },
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 10,
    "candidatesTokenCount": 50,
    "totalTokenCount": 60
  }
}

Routing & Protocols

Native-route constraints and converter routes

Gemini Overview

Headers, models, and route family overview

Gemini Format Converter

Keep Gemini format while calling other providers