Skip to main content
POST
/
v1beta
/
models
/
{model}
:
{method}
curl --request POST \
  --url https://api.apimart.ai/v1beta/models/gemini-2.5-pro:generateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Hello, please introduce yourself"
        }
      ]
    }
  ]
}'
{
  "code": 200,
  "data": {
    "candidates": [
      {
        "content": {
          "role": "model",
          "parts": [
            {
              "text": "Hello! I'm pleased to introduce myself.\n\nI am a large language model, trained and developed by Google..."
            }
          ]
        },
        "finishReason": "STOP",
        "index": 0,
        "safetyRatings": [
          {
            "category": "HARM_CATEGORY_HATE_SPEECH",
            "probability": "NEGLIGIBLE"
          }
        ]
      }
    ],
    "promptFeedback": {
      "safetyRatings": [
        {
          "category": "HARM_CATEGORY_HATE_SPEECH",
          "probability": "NEGLIGIBLE"
        }
      ]
    ]
  },
  "usageMetadata": {
    "promptTokenCount": 4,
    "candidatesTokenCount": 611,
    "totalTokenCount": 2422,
    "thoughtsTokenCount": 1807,
    "promptTokensDetails": [
      {
        "modality": "TEXT",
        "tokenCount": 4
      }
    ]
  }
}
curl --request POST \
  --url https://api.apimart.ai/v1beta/models/gemini-2.5-pro:generateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Hello, please introduce yourself"
        }
      ]
    }
  ]
}'
{
  "code": 200,
  "data": {
    "candidates": [
      {
        "content": {
          "role": "model",
          "parts": [
            {
              "text": "Hello! I'm pleased to introduce myself.\n\nI am a large language model, trained and developed by Google..."
            }
          ]
        },
        "finishReason": "STOP",
        "index": 0,
        "safetyRatings": [
          {
            "category": "HARM_CATEGORY_HATE_SPEECH",
            "probability": "NEGLIGIBLE"
          }
        ]
      }
    ],
    "promptFeedback": {
      "safetyRatings": [
        {
          "category": "HARM_CATEGORY_HATE_SPEECH",
          "probability": "NEGLIGIBLE"
        }
      ]
    ]
  },
  "usageMetadata": {
    "promptTokenCount": 4,
    "candidatesTokenCount": 611,
    "totalTokenCount": 2422,
    "thoughtsTokenCount": 1807,
    "promptTokensDetails": [
      {
        "modality": "TEXT",
        "tokenCount": 4
      }
    ]
  }
}

Authorizations

Authorization
string
required
All API endpoints require Bearer Token authenticationGet your API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:
Authorization: Bearer YOUR_API_KEY

Path Parameters

model
string
required
Model nameThe examples use gemini-2.5-pro, which you can replace with other supported Gemini models:
  • gemini-2.5-flash - Gemini 2.5 Flash
  • gemini-2.5-pro - Gemini 2.5 Pro
  • gemini-2.5-flash-lite - Gemini 2.5 Flash Lite
  • gemini-2.5-pro-thinking - Gemini 2.5 Pro Deep Thinking
method
enum<string>
required
Generation method (recommended: generateContent for quick start):
  • generateContent: Wait for complete response and return at once
  • streamGenerateContent: Stream response, return content in chunks
Available options: generateContent, streamGenerateContent

Body

contents
array
required
List of conversation contentsMinimum 1 message requiredExample:
[
  {
    "role": "user",
    "parts": [{ "text": "Hello, please introduce yourself" }]
  }
]
generationConfig
object
Generation configuration (optional)
safetySettings
array
Safety settings (optional)

Response

candidates
array
List of candidate responses
promptFeedback
object
Prompt feedback information
usageMetadata
object
Usage statistics