Skip to main content
POST
/
v1beta
/
models
/
{model}
:generateContent
Generate Content
curl --request POST \
  --url https://www.anyfast.ai/v1beta/models/{model}:generateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Hello, Gemini!"
        }
      ]
    }
  ],
  "systemInstruction": {
    "parts": [
      {
        "text": "<string>"
      }
    ]
  },
  "generationConfig": {
    "temperature": 1,
    "topP": 0.5,
    "topK": 123,
    "maxOutputTokens": 123,
    "stopSequences": [
      "<string>"
    ],
    "responseMimeType": "text/plain",
    "responseSchema": {}
  },
  "tools": [
    {
      "functionDeclarations": [
        {
          "name": "<string>",
          "description": "<string>",
          "parameters": {}
        }
      ]
    }
  ],
  "toolConfig": {
    "functionCallingConfig": {
      "mode": "AUTO",
      "allowedFunctionNames": [
        "<string>"
      ]
    }
  },
  "safetySettings": [
    {
      "category": "HARM_CATEGORY_HARASSMENT",
      "threshold": "BLOCK_NONE"
    }
  ]
}
'
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "<string>"
          }
        ],
        "role": "model"
      },
      "finishReason": "STOP",
      "index": 123,
      "safetyRatings": [
        {
          "category": "<string>",
          "probability": "<string>"
        }
      ]
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 123,
    "candidatesTokenCount": 123,
    "totalTokenCount": 123
  },
  "modelVersion": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

model
enum<string>
required

The model name to use for generation.

Available options:
gemini-3.1-pro-preview,
gemini-3.1-flash-image-preview,
gemini-3.1-flash-lite-preview,
gemini-3-pro-preview,
gemini-3-pro-image-preview,
gemini-3-flash-preview,
gemini-2.5-pro,
gemini-2.5-flash,
gemini-2.5-flash-lite,
gemini-2.0-flash

Body

application/json
contents
object[]
required

The content of the current conversation with the model.

Minimum array length: 1
Example:
[
  {
    "role": "user",
    "parts": [{ "text": "Hello, Gemini!" }]
  }
]
systemInstruction
object

Developer set system instruction.

generationConfig
object

Configuration options for model generation and outputs.

tools
object[]

A list of tools the model may use to generate a response.

toolConfig
object

Tool configuration for any tools specified in the request.

safetySettings
object[]

A list of unique SafetySetting instances for blocking unsafe content.

Response

Content generated successfully

candidates
object[]
usageMetadata
object
modelVersion
string