Skip to main content
Endpoint: POST /v1/projects/cognition/locations/us/publishers/google/models/{model}:generateContent Generate text or multimodal content with Google’s Gemini models.
import requests

url = "https://api.yourouter.ai/v1/projects/cognition/locations/us/publishers/google/models/gemini-1.5-pro-latest:generateContent"

response = requests.post(
    url,
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
        "vendor": "google"
    },
    json={
        "contents": [
            {"role": "user", "parts": [{"text": "hello gemini"}]}
        ]
    }
)
print(response.json())

Parameters

model
string
required
The Gemini model to use, e.g. gemini-1.5-pro-latest.
contents
array
required
Input text or multimedia parts for the model.
safetySettings
object
Optional safety settings to control content thresholds.
I