Zum Hauptinhalt springen
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 unterstützt das native Google Gemini API-Format für Gemini-Modelle. Dies ermöglicht eine direkte Kompatibilität mit Google AI SDKs.

Pfadparameter

model
string
erforderlich
Modellname (z. B. gemini-2.5-pro, gemini-2.5-flash).

Abfrageparameter

key
string
API-Key (Alternative zur Header-Authentifizierung).

Authentifizierung

Gemini-Endpunkte unterstützen mehrere Authentifizierungsmethoden:
  • ?key=YOUR_API_KEY Abfrageparameter
  • x-goog-api-key: YOUR_API_KEY Header
  • Authorization: Bearer YOUR_API_KEY Header

Request-Body

contents
array
erforderlich
Inhalte der Konversation.Jedes Inhaltsobjekt enthält:
  • role (string): user oder model
  • parts (array): Inhaltsteile (Text oder Inline-Daten)
systemInstruction
object
Systemanweisung für das Modell.
generationConfig
object
Generierungskonfiguration:
  • temperature (number): Sampling-Temperatur
  • topP (number): Nucleus-Sampling-Wahrscheinlichkeit
  • topK (integer): Top-K-Sampling
  • maxOutputTokens (integer): Maximale Anzahl an Output-Tokens
  • stopSequences (array): Stoppsequenzen
safetySettings
array
Einstellungen für Sicherheitsfilter.

Antwort

candidates
array
Generierte Inhaltskandidaten.
usageMetadata
object
Informationen zur Token-Nutzung.
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
  }
}