Skip to main content
POST
/
v1beta
/
models
/
gemini-3.1-flash-lite-preview:
{action}

Authorization

  • Auth Type: Bearer Auth (In: header)
  • Format: Authorization: Bearer <YOUR_API_KEY>
  • Description: Use Bearer <YOUR_API_KEY>. Format: Authorization: Bearer sk-xxxxxx.
  • API Key: where API Key is your AGCloud API KEY

Request Body

Core Parameters

FieldTypeRequiredDefaultDescription
contentsarray-Content of the current conversation with the model. For single-turn queries, this contains one instance. For multi-turn queries (e.g., chat), this contains the conversation history and the latest request.
>contents.rolestring-The role of the message sender. Can be user model.
>contents.partsarray-The content parts of the message, which can contain different types of content (text, inlineData, etc.).
>>contents.parts.textstring-Text content of the part. For multimodal input details

Advanced Parameters

FieldTypeRequiredDescription
generationConfigobject-Configuration options for content generation. See Generation Configuration
safetySettingsarray<object>-List of unique SafetySetting instances for filtering unsafe content. Each SafetyCategory should have at most one setting. See Safety Settings
toolsarray<object>-List of tools the model may use to generate the next response. Supported tools include Function and codeExecution.
systemInstructionobject-See System instruction.
asyncboolean-Whether to provide asynchronous responses (only supports non-streaming requests)

Generation Configuration Structure

FieldTypeRequiredDescription
temperaturenumber-Controls the randomness of the output. Range in 0.0 - 1.0.
topPnumber-Nucleus sampling probability threshold. Range in 0.0 - 1.0.
topKinteger-Top-k sampling parameter.
maxOutputTokensinteger-Maximum number of tokens to generate.
stopSequencesarray<string>-Sequences at which to stop generation.
responseMimeTypestring-MIME type of the response. Can be text/plain application/json.

Safety Settings Structure

FieldTypeRequiredRangeDescription
categorystringHARM_CATEGORY_HATE_SPEECH HARM_CATEGORY_SEXUALLY_EXPLICIT HARM_CATEGORY_DANGEROUS_CONTENT HARM_CATEGORY_HARASSMENT HARM_CATEGORY_CIVIC_INTEGRITYThe harm category to apply the safety setting to.
thresholdstringBLOCK_ONLY_HIGH BLOCK_MEDIUM_AND_ABOVE BLOCK_LOW_AND_ABOVE BLOCK_NONEThe threshold for blocking content.

Tools Structure

FieldTypeRequiredRangeDescription
googleSearchobject--Array of tools to use for the request.
>googleSearch.timeRangeFilterobject--Optional time range filter for the search.
>>googleSearch.timeRangeFilter.startTimestring-2024-01-01T00:00:00Z or timestampOptional start time for the search in ISO 8601 format or timestamp.
>>googleSearch.timeRangeFilter.endTimestring-2024-01-01T00:00:00Z or timestampOptional end time for the search in ISO 8601 format or timestamp. Note: For Gemini 3 models, the time span cannot exceed 24 hours.

System Instruction Structure

FieldTypeRequiredRangeDescription
rolestring-userThe role for the system instruction. If specified, must be user.
partsarray<object>-The content parts of the system instruction, containing the instructional text for the model.
>parts.textstring-The text content of the system instruction. Used to set the model’s behavior, persona, or context before the conversation begins.