Gemini API 가이드
이 플랫폼은 OpenAI 호환 endpoint를 통해 Gemini 모델을 호출하므로 openai SDK를 사용할 수 있습니다.
설치
- Python
- JavaScript
- curl
pip install openai
npm install openai
# curl은 보통 시스템에 이미 있으므로 SDK 설치가 필요하지 않습니다
기본 사용법
- Python
- JavaScript
- curl
from openai import OpenAI
client = OpenAI(
api_key="your-api-key",
base_url="https://aisupermarket.work/v1",
)
response = client.chat.completions.create(
model="gemini-2.5-flash",
messages=[{"role": "user", "content": "Hello, please introduce yourself"}],
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://aisupermarket.work/v1",
});
const response = await client.chat.completions.create({
model: "gemini-2.5-flash",
messages: [{ role: "user", content: "Hello, please introduce yourself" }],
});
console.log(response.choices[0].message.content);
curl https://aisupermarket.work/v1/chat/completions \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-2.5-flash",
"messages": [{"role": "user", "content": "Hello, please introduce yourself"}]
}'
주요 모델
| 모델 | 설명 |
|---|---|
gemini-2.5-flash | 빠르고 대부분의 작업에 적합한 모델 |
gemini-2.5-pro | 깊은 추론을 지원하는 최고 성능 모델 |
gemini-3.5-flash | 차세대 Flash 모델 |