Gemini generateContent / streamGenerateContent
POST
/v1beta/models/{modelAndAction}
const url = 'https://api.saygm.com/v1beta/models/gemini-2.5-pro%3AgenerateContent';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.saygm.com/v1beta/models/gemini-2.5-pro%3AgenerateContent \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{}'Gemini-compatible endpoint. modelAndAction is the model id and method joined by a colon, for example gemini-2.5-pro:generateContent or gemini-2.5-pro:streamGenerateContent. Use the Google GenAI client with the base URL set to https://api.saygm.com. Authenticate with a GM API key as a bearer token or through Gemini’s native key query parameter.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”modelAndAction
required
string
Example
gemini-2.5-pro:generateContentRequest Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
Examplegenerated
{}Responses
Section titled “Responses”A Gemini response object, or a text/event-stream for streamGenerateContent.
object
Examplegenerated
{}string
Invalid request (e.g. unknown model).
Media typeapplication/json
object
error
object
message
string
type
string
code
string | null
Examplegenerated
{ "error": { "message": "example", "type": "example", "code": "example" }}