Skip to main content
LemonData supports the native Google Gemini API format for Gemini models. This allows direct compatibility with Google AI SDKs.

Path Parameters

model
string
required
Model name (e.g., gemini-2.5-pro, gemini-2.5-flash).

Query Parameters

key
string
API key (alternative to header authentication).

Authentication

Gemini endpoints support multiple authentication methods:
  • ?key=YOUR_API_KEY query parameter
  • x-goog-api-key: YOUR_API_KEY header
  • Authorization: Bearer YOUR_API_KEY header

Request Body

contents
array
required
Conversation contents.Each content object contains:
  • role (string): user or model
  • parts (array): Content parts (text parts or inline_data image parts)
systemInstruction
object
System instruction for the model.
generationConfig
object
Generation configuration:
  • temperature (number): Sampling temperature
  • topP (number): Nucleus sampling probability
  • topK (integer): Top-K sampling
  • maxOutputTokens (integer): Maximum output tokens
  • stopSequences (array): Stop sequences
safetySettings
array
Safety filter settings.

Response

candidates
array
Generated content candidates.
usageMetadata
object
Token usage information.
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
    }
  }'

Vision Input Example

For Gemini vision requests, place images inside contents[].parts[] as structured inline_data parts. The data field should contain Base64-encoded file bytes, and mime_type should match the uploaded image format.
{
  "contents": [
    {
      "role": "user",
      "parts": [
        { "text": "Please describe this image." },
        {
          "inline_data": {
            "mime_type": "image/jpeg",
            "data": "/9j/4AAQSkZJRgABAQ..."
          }
        }
      ]
    }
  ]
}
{
  "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
  }
}