Endpoint: POST /projects/cognition/locations/us/publishers/google/models/{model}:generateContent
Google Gemini でテキストまたは多モーダル生成を行います。
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())
パラメータ
使用する Gemini モデル(例: gemini-1.5-pro-latest)。
画像入力
画像バイトは inlineData(base64)で渡します。
curl https://api.yourouter.ai/v1/projects/cognition/locations/us/publishers/google/models/gemini-2.5-flash:generateContent \
-H "Authorization: Bearer $YOUROUTER_API_KEY" \
-H "Content-Type: application/json" \
-H "vendor: google" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{ "text": "Describe this image in one sentence." },
{
"inlineData": {
"mimeType": "image/jpeg",
"data": "<BASE64_IMAGE>"
}
}
]
}
]
}'
全体の導線は マルチモーダル を参照してください。