跳转到主要内容
POST
/
v1beta
/
models
/
{model}
:generateContent
Gemini 图片(Nano Banana)
curl --request POST \
  --url https://api.ldx.dev/v1beta/models/{model}:generateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "draw a cat"
        }
      ]
    }
  ],
  "generationConfig": {
    "responseModalities": [
      "TEXT",
      "IMAGE"
    ],
    "imageConfig": {
      "aspectRatio": "16:9",
      "imageSize": "4K"
    }
  }
}
'
{
  "candidates": [
    {
      "content": {
        "role": "<string>",
        "parts": [
          {}
        ]
      },
      "finishReason": "<string>",
      "safetyRatings": [
        {}
      ]
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 123,
    "candidatesTokenCount": 123,
    "totalTokenCount": 123
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.liandanxia.io/llms.txt

Use this file to discover all available pages before exploring further.

授权

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
必填

响应

200 - application/json

成功

candidates
object[]
usageMetadata
object