/v1beta/models/{model}:generateContentGenerate content (Gemini)
Google's generateContent. Every model in the catalog is callable here, not only Gemini. Both camelCase and snake_case field names are accepted.
Refused with a 400: cachedContent, Google server tools (googleSearch, codeExecution, urlContext), File API handles, candidateCount other than 1, and non-text responseModalities. safetySettings, labels and seed are dropped and named in x-experiential-ignored-parameters.
Authentication: Bearer API key in the Authorization header
Path parameters
modelstringrequiredA model slug.
Request body
contentsarray<object>requiredTurns of
parts: text,inlineData, publicfileDataURLs,functionCall,functionResponse.systemInstructionobjecttoolsarray<object>functionDeclarationsonly; Google server tools are refused.toolConfigobjectgenerationConfigobjectSampling,
maxOutputTokens,stopSequences,responseSchemaorresponseJsonSchema,thinkingConfig.providerobjectOpenRouter's routing-preference object, resolved against the model's own provider routes. Only tightens, never loosens, your organization's policy.
provider
zdrbooleantrueserves only zero-data-retention routes for this request, or refuses with a 403 naming the excluded providers.onlyarray<string>Keep only these providers.
ignorearray<string>Drop these providers.
orderarray<string>Try these providers first, in order; the rest stay as fallbacks.
allow_fallbacksbooleanfalsewithorderserves only the listed providers; withoutorder, only the first eligible route.
Responses
200One GenerateContentResponse.
Response
candidatesarray<object>usageMetadataanyGoogle's usage plus Experiential's
costandis_byok.usageMetadata
promptTokenCountintegercandidatesTokenCountintegertotalTokenCountintegerthoughtsTokenCountintegercachedContentTokenCountintegercostnumberUSD actually charged to your credits for this request, as a float (promotions and plan discounts already applied).
0on your own provider key.is_byokbooleanTrue when the request ran on your own provider key, which the platform never charges.
cost_detailsobjectPresent only in two cases:
upstream_inference_cost(USD, your own key: the provider's list charge to you) orlist_cost(USD, a platform-funded call charged below list: what it would have cost).cost_details
upstream_inference_costnumberlist_costnumber
responseIdstringmodelVersionstringproviderstringExperiential extension. The provider that served this request.
400Invalid request, in the Google envelope.
Response
errorobjecterror
codeintegerThe HTTP status.
messagestringstatusstringFor example
INVALID_ARGUMENT,UNAUTHENTICATED,RESOURCE_EXHAUSTED.detailsarray<object>
401The key is missing or invalid.
Response
errorobjecterror
codeintegerThe HTTP status.
messagestringstatusstringFor example
INVALID_ARGUMENT,UNAUTHENTICATED,RESOURCE_EXHAUSTED.detailsarray<object>
429Rate limited or out of credits. RetryInfo carries the wait when retrying helps.
Response
errorobjecterror
codeintegerThe HTTP status.
messagestringstatusstringFor example
INVALID_ARGUMENT,UNAUTHENTICATED,RESOURCE_EXHAUSTED.detailsarray<object>
Request
curl https://api.experientiallabs.ai/v1beta/models/gpt-6-luna:generateContent \
-H "x-goog-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"role": "user", "parts": [{"text": "Say hi."}]}]}'
Response
{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"text": "Hi!"
}
]
},
"finishReason": "STOP",
"index": 0
}
],
"usageMetadata": {
"promptTokenCount": 3,
"candidatesTokenCount": 2,
"totalTokenCount": 5,
"cost": 0.0000013,
"is_byok": false
},
"responseId": "resp_0b7e4f2a9c1d46e8b3a5f7c9e1d2b4a6",
"modelVersion": "gpt-6-luna",
"provider": "openai"
}https://api.experientiallabs.ai/v1beta/models/gpt-6-luna:generateContent