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 - API Reference

  • Call gemini-2.5-flash-lite model using Google Native API format
  • Can use synchronous processing mode, returns conversation content in real-time
  • Plain text conversation: Single-turn or multi-turn contextual dialogue, see simple_text and multi_turn examples in code samples
  • Multimodal input: Supports text + image/audio/video mixed input, see audio_analysis, image_understanding, and multi_file examples in code samples
  • Parameter tuning: Control generation quality via generationConfig
  • Streaming: Replace generateContent with streamGenerateContent in the URL
<Tip> **Streaming**: Replace `generateContent` with `streamGenerateContent` in the URL. The request body parameters are identical. Responses will be returned in streaming chunks. See the "Streaming Response" section below for the response format. </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, supports multi-turn dialogue and multimodal input

[
  {
    "role": "user",
    "parts": [
      null
    ]
  }
]
generationConfigobject

Generation configuration parameters

{
  "temperature": 0.7,
  "maxOutputTokens": 2000,
  "topP": 0.9,
  "topK": 40,
  "candidateCount": 1,
  "responseMimeType": "application/json",
  "responseSchema": {},
  "responseJsonSchema": {},
  "thinkingConfig": {}
}
systemInstructionobject
{
  "role": "user",
  "parts": [
    null
  ]
}
toolsobject[]

List of tools the model can call, such as function calling or code execution

[
  {}
]
toolConfigobject

Tool calling configuration (optional)

{}
safetySettingsobject[]

Safety settings list (optional)

[
  {}
]
cachedContentstring

Cached content name, in the form cachedContents/{cachedContent}

"string"

Response

application/json
请求错误

Response body

errorobject
{
  "code": 0,
  "message": "string",
  "type": "string",
  "fallback_suggestion": "string"
}
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": "Please introduce yourself"
        }
      ]
    }
  ]
}'
Response: 请求错误
{
  "error": {
    "code": 400,
    "message": "Invalid request parameters",
    "type": "invalid_request_error"
  }
}