엔드포인트: 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).
모델에 전달할 텍스트 또는 멀티미디어 parts.
이미지 입력
이미지 콘텐츠에는 base64로 인코딩한 이미지 바이트를 inlineData로 전달하세요.
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>"
}
}
]
}
]
}'
더 자세한 연동은 멀티모달 가이드를 참고하세요.