StarMagicStarMagic
한국어
简体中文简繁體中文繁EnglishEN日本語日EspañolES한국어KO
통합 가이드
Gemini 2.5 Flash Lite - OpenAI SDK - 快速开始Gemini 2.5 Flash Lite - OpenAI SDK - API Reference
StarMagicStarMagic
한국어
简体中文简繁體中文繁EnglishEN日本語日EspañolES한국어KO
텍스트GeminiGemini.2.5.Flash.LiteOpenai.Sdk

Gemini 2.5 Flash Lite - OpenAI SDK - API 레퍼런스

  • OpenAI SDK 형식을 사용하여 gemini-2.5-flash-lite 모델 호출
  • 동기 처리 모드, 대화 내용을 실시간으로 반환
  • 일반 텍스트 대화: 단일 턴 또는 다중 턴 컨텍스트 대화, 코드 샘플의 simple_text 및 multi_turn 예제 참조
  • 시스템 프롬프트: AI 역할 및 동작 사용자 정의, 코드 샘플의 system_prompt 예제 참조
  • 멀티모달 입력: 텍스트 + 이미지 혼합 입력 지원, 코드 샘플의 vision 및 multi_image 예제 참조
<Note> **BaseURL**: 기본 BaseURL은 `https://api.starmagic.ai`이며, 텍스트 모델 지원이 더 우수하고 장시간 연결을 지원합니다. `https://api.starmagic.ai`는 멀티모달 서비스의 주력 엔드포인트이며, 텍스트 모델에 대해서는 대체 주소로 사용됩니다. </Note>

인증

Authorizationstringheader필수

##모든 API는 Bearer Token 인증이 필요합니다## **API Key 받기:** [API Key 관리 페이지](https://starmagic.ai/app/api-keys)를 방문하여 API Key를 받으세요 **요청 헤더에 추가:** ``` Authorization: Bearer YOUR_API_KEY ```

Authorization: Bearer YOUR_API_KEY

요청 본문

application/json
modelenum<gemini-2.5-flash-lite>필수

채팅 모델 이름

"gemini-2.5-flash-lite"
messagesobject[]필수

채팅 메시지 목록, 다중 턴 대화 및 멀티모달 입력 지원

[
  {
    "role": "user",
    "content": null,
    "tool_call_id": "string"
  }
]
streamboolean

스트리밍 모드로 응답을 반환할지 여부 - `true`: 스트리밍 반환, 실시간 청크로 내용 수신 - `false`: 완전한 응답을 한 번에 반환

false
max_completion_tokensinteger

Maximum number of completion tokens for the generated response, corresponding to Gemini's maxOutputTokens.

2000
max_tokensinteger

Maximum number of tokens for the generated response, compatible with the legacy OpenAI parameter.

2000
temperaturenumber

샘플링 온도, 출력의 무작위성을 제어합니다 **설명**: - 낮은 값 (예: 0.2): 더 결정적이고 집중된 출력 - 높은 값 (예: 1.5): 더 무작위적이고 창의적인 출력

0.7
top_pnumber

Nucleus Sampling 매개변수 **설명**: - 누적 확률을 기반으로 토큰에서 샘플링을 제어합니다 - 예를 들어, 0.9는 누적 확률 상위 90%까지의 토큰에서 선택하는 것을 의미합니다 - 기본값: 1.0 (모든 토큰 고려) **권장 사항**: temperature와 top_p를 동시에 조정하지 마세요

0.9
frequency_penaltynumber

Frequency penalty coefficient. Range: -2.0 to 2.0. Corresponds to Gemini's frequencyPenalty.

0
presence_penaltynumber

Presence penalty coefficient. Range: -2.0 to 2.0. Corresponds to Gemini's presencePenalty.

0
stopobject

Stop sequences. Supports a string or string array, corresponding to Gemini's stopSequences.

ninteger

Number of generated candidates.

1
reasoning_effortenum<none | low | medium | high>

추론 부담을 제한합니다. Gemini 2.5 Flash와 Flash Lite는 none으로 사고를 끌 수 있으며, low/medium/high는 서로 다른 사고 예산에 대응합니다.

"medium"
seedinteger

Random seed used to make output as reproducible as possible, corresponding to Gemini's seed.

12345
logprobsboolean

Whether to return token logprob information, corresponding to Gemini's responseLogprobs.

true
top_logprobsinteger

Number of top logprob values returned for each token, corresponding to Gemini's logprobs.

5
response_formatobject

Response format settings, supporting JSON mode and JSON Schema, corresponding to Gemini's responseMimeType, responseSchema and responseJsonSchema.

stream_optionsobject

Streaming response options. Can be set when stream is true.

{
  "include_usage": true
}
toolsobject[]

List of tool definitions for Function Calling.

[
  {
    "type": "function",
    "function": {
      "name": "string",
      "description": "string",
      "parameters": {}
    }
  }
]
tool_choiceobject

Controls tool-calling behavior.

extra_bodyobject

Gemini extension parameters.

{
  "google": {
    "cached_content": "string",
    "thinking_config": {}
  }
}

응답

application/json
成功

응답 본문

idstring

채팅 완성의 고유 식별자

"chatcmpl-20251010015944503180122WJNB8Eid"
modelstring

실제 사용된 모델 이름

"gemini-2.5-flash-lite"
objectenum<chat.completion>

응답 유형

"chat.completion"
createdinteger

생성 타임스탬프

1760032810
choicesobject[]

채팅 완성 선택지 목록

[
  {
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello! I'm pleased to introduce myself.\n\nI'm a Large Language Model, trained and developed by Google.\n\nSimply put, you can think of me as a \"smart brain\" that has been trained on massive amounts of text data and is able to understand and generate human language. My core capability is processing and generating text. Specifically, I can do the following:\n\n**1. Information Query & Knowledge Answering**\nI can act like a \"talking encyclopedia,\" answering various questions, whether they're about scientific knowledge, historical events, or everyday facts.\n\n**2. Creative Writing & Text Generation**\nI can create various types of text based on your requirements, such as:\n*   **Writing**: Poetry, stories, scripts, emails, speeches, advertising copy, etc.\n*   **Planning**: Travel plans, study outlines, event proposals, etc.\n*   **Brainstorming**: Working with you to generate new ideas and spark creativity.\n\n**3. Translation & Language Processing**\nI'm proficient in multiple languages and can provide fast, fluent translation services. I can also help you polish, proofread, summarize, or rewrite text to make your expression clearer and more professional.\n\n**4. Programming & Code Assistance**\nI can write code snippets, explain code logic, debug errors, or \"translate\" code from one programming language to another, making me a helpful companion for programmers.\n\n**5. Logical Analysis & Reasoning**\nI can help you analyze complex problems, organize logical chains, and make inferences and summaries based on the information you provide.\n\n---\n\n**In summary**, my goal is to be a powerful and useful tool that helps you obtain information more efficiently, complete tasks, and spark creativity through natural language communication.\n\n**Remember:** I'm an artificial intelligence, my knowledge comes from the data I've learned, and it may not be the most up-to-date. Sometimes I may also make mistakes, so for very important information, I recommend you verify it again.",
      "tool_calls": [
        null
      ]
    },
    "logprobs": {
      "content": [
        {
          "token": null,
          "logprob": null,
          "bytes": null,
          "top_logprobs": null
        }
      ]
    },
    "finish_reason": "stop"
  }
]
usageobject

토큰 사용 통계

{
  "prompt_tokens": 13,
  "completion_tokens": 1891,
  "total_tokens": 1904,
  "prompt_tokens_details": {
    "cached_tokens": 0,
    "text_tokens": 13,
    "audio_tokens": 0,
    "image_tokens": 0
  },
  "completion_tokens_details": {
    "text_tokens": 0,
    "audio_tokens": 0,
    "reasoning_tokens": 1480
  },
  "input_tokens": 0,
  "output_tokens": 0,
  "input_tokens_details": null
}
POST/v1/chat/completions
curl --request POST \
  --url https://api.starmagic.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "gemini-2.5-flash-lite",
  "messages": [
    {
      "role": "user",
      "content": "Please introduce yourself"
    }
  ]
}'
응답: 成功
{
  "id": "chatcmpl-20251010015944503180122WJNB8Eid",
  "model": "gemini-2.5-flash-lite",
  "object": "chat.completion",
  "created": 1760032810,
  "choices": [
    {
      "index": 0,
      "message": {
        "role": null,
        "content": null,
        "tool_calls": null
      },
      "logprobs": {
        "content": [
          null
        ]
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 13,
    "completion_tokens": 1891,
    "total_tokens": 1904,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "text_tokens": 13,
      "audio_tokens": 0,
      "image_tokens": 0
    },
    "completion_tokens_details": {
      "text_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 1480
    },
    "input_tokens": 0,
    "output_tokens": 0,
    "input_tokens_details": null
  }
}

Gemini 2.5 Flash Lite - OpenAI SDK - 快速开始

Previous Page

Gemini 2.5 Flash - Native API - 快速开始

Next Page