Gemini API Guide
This platform calls Gemini models through OpenAI-compatible endpoints, so the openai SDK can be used.
Installation
- Python
- JavaScript
- curl
pip install openai
npm install openai
# curl is usually available on the system; no SDK installation is required
Basic Usage
- 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"}]
}'
Common Models
| Model | Description |
|---|---|
gemini-2.5-flash | Fast and suitable for most tasks |
gemini-2.5-pro | Strongest capability with deep reasoning support |
gemini-3.5-flash | Next-generation Flash model |