メインコンテンツへスキップ
POST
/
v1beta
/
models
/
{model}
:generateContent
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": {}
}

承認

Authorization
string
header
必須

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

パスパラメータ

model
string
必須

ボディ

application/json
contents
object[]
必須
generationConfig
object

生成設定。なお、:generateContent ではなく :streamGenerateContent を呼び出すと Gemini SSE ストリームを取得できます。

tools
object[]

functionDeclarations を含むツール宣言。

systemInstruction
object

システム指示。Gemini Content オブジェクト({ parts: [{ text }] })として指定します。

レスポンス

Gemini 互換レスポンス。

candidates
object[]
必須
usageMetadata
object