Passer au contenu principal
POST
/
v1beta
/
models
/
{model}
:generateContent
curl -X POST "https://api.lemondata.cc/v1beta/models/gemini-2.5-pro:generateContent?key=sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [{"text": "Hello, Gemini!"}]
      }
    ],
    "generationConfig": {
      "temperature": 0.7,
      "maxOutputTokens": 1024
    }
  }'
{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          {"text": "Hello! How can I assist you today?"}
        ]
      },
      "finishReason": "STOP",
      "safetyRatings": [
        {"category": "HARM_CATEGORY_HARASSMENT", "probability": "NEGLIGIBLE"}
      ]
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 5,
    "candidatesTokenCount": 10,
    "totalTokenCount": 15
  }
}
LemonData prend en charge le format natif de l’API Google Gemini pour les modèles Gemini. Cela permet une compatibilité directe avec les SDK Google AI.

Paramètres de chemin

model
string
requis
Nom du modèle (par ex., gemini-2.5-pro, gemini-2.5-flash).

Paramètres de requête

key
string
Clé API (alternative à l’authentification par en-tête).

Authentification

Les points de terminaison Gemini prennent en charge plusieurs méthodes d’authentification :
  • Paramètre de requête ?key=YOUR_API_KEY
  • En-tête x-goog-api-key: YOUR_API_KEY
  • En-tête Authorization: Bearer YOUR_API_KEY

Corps de la requête

contents
array
requis
Contenu de la conversation.Chaque objet de contenu contient :
  • role (string) : user ou model
  • parts (array) : Parties du contenu (texte ou données inline)
systemInstruction
object
Instruction système pour le modèle.
generationConfig
object
Configuration de génération :
  • temperature (number) : Température d’échantillonnage
  • topP (number) : Probabilité d’échantillonnage nucleus
  • topK (integer) : Échantillonnage Top-K
  • maxOutputTokens (integer) : Nombre maximum de tokens de sortie
  • stopSequences (array) : Séquences d’arrêt
safetySettings
array
Paramètres des filtres de sécurité.

Réponse

candidates
array
Candidats de contenu générés.
usageMetadata
object
Informations sur l’utilisation des tokens.
curl -X POST "https://api.lemondata.cc/v1beta/models/gemini-2.5-pro:generateContent?key=sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [{"text": "Hello, Gemini!"}]
      }
    ],
    "generationConfig": {
      "temperature": 0.7,
      "maxOutputTokens": 1024
    }
  }'
{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          {"text": "Hello! How can I assist you today?"}
        ]
      },
      "finishReason": "STOP",
      "safetyRatings": [
        {"category": "HARM_CATEGORY_HARASSMENT", "probability": "NEGLIGIBLE"}
      ]
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 5,
    "candidatesTokenCount": 10,
    "totalTokenCount": 15
  }
}