Dokumentasi
generateContent dan streamGenerateContent.
| Method | Endpoint | Fungsi |
|---|---|---|
| POST | /v1beta/models/{model}:generateContent | Jawaban sekali kirim |
| POST | /v1beta/models/{model}:streamGenerateContent?alt=sse | Streaming |
| POST | /v1beta/models/{model}:countTokens | Perkiraan jumlah token |
| GET | /v1beta/models | Daftar model |
curl
curl "https://api.tokenbyte.biz.id/v1beta/models/smart-gemini:generateContent" \
-H "x-goog-api-key: sk-tkn-KEY_KAMU" \
-H "Content-Type: application/json" \
-d '{"contents": [{"role": "user", "parts": [{"text": "Halo!"}]}]}'python
from google import genai
client = genai.Client(api_key="sk-tkn-KEY_KAMU", http_options={"base_url": "https://api.tokenbyte.biz.id"})
res = client.models.generate_content(model="smart-gemini", contents="Halo!")
print(res.text)Yang didukung: systemInstruction, generationConfig (temperature, topP, maxOutputTokens, stopSequences, JSON mode), gambar lewat inlineData, dan function calling (functionDeclarations).
Fitur khusus Gemini seperti grounding Google Search, code execution, upload file, dan context caching belum didukung.