Google Gemini Generate Content
Generates a model response given an input prompt and other parameters.
POST
v1beta/models/{model}:generateContentAuthorizations
x-goog-api-keystringheader
Auth method 1 — Header: x-goog-api-key: sk-pat-YourAccessToken
keystringquery
Auth method 2 — Query parameter: ?key=sk-pat-YourAccessToken
The key value is your HAI Gateway Personal Access Token (starting with sk-pat-). No separate API key from Google is required. Either authentication method works.
Base URL
Body Parameters
The request body format is fully compatible with the official Google Gemini API. For detailed parameter descriptions, refer to the Google official documentation.
Streaming Requests
For streaming, use the :streamGenerateContent endpoint path instead of :generateContent.
cURL
curl https://api.hai.network/google/v1beta/models/gemini-2.5-pro:generateContent \
-H "Content-Type: application/json" \
-H "x-goog-api-key: sk-pat-YourAccessToken" \
-d '{
"contents": [
{
"parts": [
{
"text": "Write a story about a magic backpack."
}
]
}
]
}'