Zum Hauptinhalt springen
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
      }
    ]
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.apimart.ai/llms.txt

Use this file to discover all available pages before exploring further.

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
      }
    ]
  }
}

Autorisierung

Authorization
string
erforderlich
Alle API-Endpunkte erfordern eine Bearer-Token-AuthentifizierungSo erhalten Sie Ihren API-Key:Besuchen Sie die Seite zur API-Key-Verwaltung, um Ihren API-Key zu erhaltenFügen Sie ihn dem Anfrage-Header hinzu:
Authorization: Bearer YOUR_API_KEY

Pfadparameter

model
string
erforderlich
ModellnameIn den Beispielen wird gemini-2.5-pro verwendet, das durch andere unterstützte Gemini-Modelle ersetzt werden kann:
  • 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 mit tiefem Denken
method
enum<string>
erforderlich
Generierungsmethode (empfohlen: generateContent für den schnellen Einstieg):
  • generateContent: Auf die vollständige Antwort warten und auf einmal zurückgeben
  • streamGenerateContent: Streaming-Antwort, Inhalt in Teilen zurückgeben
Verfügbare Optionen: generateContent, streamGenerateContent

Body

contents
array
erforderlich
Liste der GesprächsinhalteMindestens 1 Nachricht erforderlichBeispiel:
[
  {
    "role": "user",
    "parts": [{ "text": "Hello, please introduce yourself" }]
  }
]
generationConfig
object
Generierungskonfiguration (optional)
safetySettings
array
Sicherheitseinstellungen (optional)

Response

candidates
array
Liste der Kandidaten-Antworten
promptFeedback
object
Feedback-Informationen zum Prompt
usageMetadata
object
Nutzungsstatistik