Zum Hauptinhalt springen
POST
/
v1beta
/
models
/
{model}
:generateContent
Gemini-kompatible Inhalte generieren
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": {}
}

Autorisierungen

Authorization
string
header
erforderlich

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

Pfadparameter

model
string
erforderlich

Body

application/json
contents
object[]
erforderlich
generationConfig
object

Generierungskonfiguration. Außerdem: Rufe :streamGenerateContent (statt :generateContent) auf, um einen Gemini-SSE-Stream zu erhalten.

tools
object[]

Tool-Deklarationen mit functionDeclarations, die das Modell aufrufen kann.

systemInstruction
object

Systemanweisung als Gemini-Content-Objekt ({ parts: [{ text }] }).

Antwort

Gemini-kompatible Antwort.

candidates
object[]
erforderlich
usageMetadata
object