Skip to main content
This is a compatibility endpoint for existing Gemini-style integrations. For new integrations, use the OpenAI-compatible API.
POST https://api.freemodel.app/v1beta/models/{model}:generateContent Choose a Gemini-compatible model ID returned by GET /v1/models. Substitute it for <gemini-model-id> in the path.

Generate content

Authenticate with a Bearer key. The gateway also accepts a FreeModel key in the key query parameter for Gemini-style clients.
curl "https://api.freemodel.app/v1beta/models/<gemini-model-id>:generateContent" \
  -H "Authorization: Bearer sk-xxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [
          {"text": "Explain an API gateway in one sentence."}
        ]
      }
    ],
    "generationConfig": {
      "temperature": 0.2,
      "maxOutputTokens": 100
    }
  }'
Response
{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          {
            "text": "An API gateway provides a single entry point that routes requests to backend APIs."
          }
        ]
      },
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 9,
    "candidatesTokenCount": 15,
    "totalTokenCount": 24
  }
}

Request body

FieldTypeRequiredDescription
Path modelstringYesA Gemini-compatible model ID available to your key.
contentsarrayYesGemini-style content objects containing parts.
generationConfig.temperaturenumberNoSampling variation.
generationConfig.maxOutputTokensintegerNoMaximum tokens to generate when supported.
Model availability can change. The models page lists the current catalog and pricing.