Saltar al contenido principal
POST
/
v1beta
/
models
/
{model}
:generateContent
Generar contenido compatible con Gemini
curl --request POST \
  --url https://apiany.ai/v1beta/models/{model}:generateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "parts": [
        {}
      ],
      "role": "<string>"
    }
  ],
  "generationConfig": {
    "temperature": 1,
    "topP": 123,
    "topK": 123,
    "maxOutputTokens": 123,
    "stopSequences": [
      "<string>"
    ],
    "responseMimeType": "<string>",
    "responseSchema": {},
    "responseModalities": [
      "<string>"
    ]
  },
  "tools": [
    {}
  ],
  "systemInstruction": {}
}
'
{
  "candidates": [
    {}
  ],
  "usageMetadata": {}
}

Autorizaciones

Authorization
string
header
requerido

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

Parámetros de ruta

model
string
requerido

Cuerpo

application/json
contents
object[]
requerido
generationConfig
object

Configuración de generación. Además: llamar a :streamGenerateContent (en lugar de :generateContent) permite obtener un flujo SSE de Gemini.

tools
object[]

Declaraciones de herramientas con functionDeclarations.

systemInstruction
object

Instrucción del sistema, como objeto Content de Gemini ({ parts: [{ text }] }).

Respuesta

Respuesta compatible con Gemini.

candidates
object[]
requerido
usageMetadata
object