Language Models

Gemini-Compatible Generate Content Format

Gemini-compatible endpoint for models that expose native Gemini contents, parts, and generationConfig semantics.

Base URL: https://shark.ai/api/v1
Endpoint
POST /models/{model}:generateContent
Use when

The selected model is Gemini-family and lists gemini_generate_content in supportedProtocols.

Protocol Support

Use this endpoint only when the selected model lists gemini_generate_content in supportedProtocols. For OpenAI SDK compatibility, use /chat/completions.

Request Body

The request body follows Google Gemini generateContent shape.

FieldTypeDescription
contentsarrayConversation turns, each with role and parts.
systemInstructionobjectOptional system instruction in Gemini format.
generationConfigobjectTemperature, max output tokens, response modalities, and provider-supported generation options.
{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Hello!"
        }
      ]
    }
  ],
  "generationConfig": {
    "temperature": 0.7,
    "maxOutputTokens": 2048
  }
}

Multimodal Parts

Gemini represents text, inline files, and file references as parts. Use inlineData for base64 payloads and fileData for HTTPS, Google File API, YouTube, or gs:// references.

{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Describe this image"
        },
        {
          "fileData": {
            "mimeType": "image/jpeg",
            "fileUri": "https://example.com/photo.jpg"
          }
        }
      ]
    }
  ]
}

Code Examples

curl -X POST https://shark.ai/api/v1/models/google%2Fgemini-3.1-flash-image-preview:generateContent \
  -H "Authorization: Bearer <api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      { "role": "user", "parts": [{ "text": "Hello!" }] }
    ],
    "generationConfig": { "temperature": 0.7, "maxOutputTokens": 2048 }
  }'

Response

{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          {
            "text": "Hello!"
          }
        ]
      },
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 10,
    "candidatesTokenCount": 20,
    "totalTokenCount": 30
  },
  "credit": 4.5
}