StarMagicStarMagic
English
简体中文简繁體中文繁EnglishEN日本語日EspañolES한국어KO
Integration Guide
Gemini 2.5 Flash Lite - Native API - 快速开始Gemini 2.5 Flash Lite - Native API - API Reference
StarMagicStarMagic
English
简体中文简繁體中文繁EnglishEN日本語日EspañolES한국어KO
TextGeminiGemini.2.5.Flash.LiteNative.API

Gemini 2.5 Flash Lite - Native API - Quick Start

  • Call Gemini-2.5-flash-lite model using Google Native API format
  • Synchronous processing mode, returns conversation content in real-time
  • Minimal parameters for quick start
  • 💡 Need more features? Check Full API Reference
<Tip> **Streaming**: Replace `generateContent` with `streamGenerateContent` in the URL to enable streaming responses, receiving content in real-time chunks. </Tip> <Note> **BaseURL**: The default BaseURL is `https://api.starmagic.ai`, which has better support for text models and long-lived connections. `https://api.starmagic.ai` is the primary endpoint for multimodal services and serves as a fallback address for text models. </Note>

Authorization

AuthorizationstringheaderRequired

##All APIs require Bearer Token authentication## **Get API Key:** Visit [API Key Management Page](https://starmagic.ai/app/api-keys) to get your API Key **Add to request header:** ``` Authorization: Bearer YOUR_API_KEY ```

Authorization: Bearer YOUR_API_KEY

Request body

application/json
contentsobject[]Required

List of conversation contents

[
  {
    "role": "user",
    "parts": [
      {
        "text": "Hello, introduce yourself"
      }
    ]
  }
]

Response

application/json
成功

Response body

candidatesobject[]

List of candidate responses

[
  {
    "content": {
      "role": "model",
      "parts": [
        null
      ]
    },
    "finishReason": "STOP",
    "index": 0,
    "safetyRatings": [
      {}
    ]
  }
]
promptFeedbackobject
{
  "safetyRatings": [
    {}
  ]
}
usageMetadataobject

Usage statistics

{
  "promptTokenCount": 4,
  "candidatesTokenCount": 611,
  "totalTokenCount": 2422,
  "thoughtsTokenCount": 1807,
  "promptTokensDetails": [
    {
      "modality": "TEXT",
      "tokenCount": 4
    }
  ]
}
POST/v1beta/models/gemini-2.5-flash-lite:generateContent
curl --request POST \
  --url https://api.starmagic.ai/v1beta/models/gemini-2.5-flash-lite:generateContent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "contents": [
    {
      "role": "user",
      "parts": [
        {
          "text": "Hello, introduce yourself"
        }
      ]
    }
  ]
}'
Response: 成功
{
  "candidates": [
    {
      "content": {
        "role": null,
        "parts": null
      },
      "finishReason": "STOP",
      "index": 0,
      "safetyRatings": [
        {}
      ]
    }
  ],
  "promptFeedback": {
    "safetyRatings": [
      {}
    ]
  },
  "usageMetadata": {
    "promptTokenCount": 4,
    "candidatesTokenCount": 611,
    "totalTokenCount": 2422,
    "thoughtsTokenCount": 1807,
    "promptTokensDetails": [
      {
        "modality": null,
        "tokenCount": null
      }
    ]
  }
}