Passer au contenu principal
POST
/
v1beta
/
models
/
{model}
:generateContent
Générer du contenu compatible 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": {}
}

Autorisations

Authorization
string
header
requis

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

Paramètres de chemin

model
string
requis

Corps

application/json
contents
object[]
requis
generationConfig
object

Configuration de génération. À noter également : appelez :streamGenerateContent (au lieu de :generateContent) pour recevoir un flux SSE Gemini.

tools
object[]

Outils avec functionDeclarations que le modèle peut appeler.

systemInstruction
object

Instruction système sous forme d'objet Content Gemini ({ parts: [{ text }] }).

Réponse

Réponse compatible Gemini.

candidates
object[]
requis
usageMetadata
object