API Hop 文件
Gemini 模型
透過共用 Chat Completions 端點呼叫 Gemini 3.6 Flash、3.7 Flash、3.8 Flash、3.5 Flash-Lite 與 4 Argon。
https://api.apihop.ai/v1/chat-completionsGemini 模型使用共用 Chat Completions 端點。本頁記錄支援的 model 值與文字對話協定。
POST https://api.apihop.ai/v1/chat-completions可用模型
model 值 | 非串流 JSON | SSE 串流 |
|---|---|---|
gemini-3.6-flash | 支援 | 支援 |
gemini-3.7-flash | 支援 | 支援 |
gemini-3.8-flash | 支援 | 支援 |
gemini-3.5-flash-lite | 支援 | 支援 |
gemini-4-argon | 支援 | 支援 |
gemini-4-argon 需要部署並啟用。列入本參考文件不代表正式環境已可用。
模型名稱區分產品層級,不是延遲、吞吐量或品質 SLA。請以實際工作負載比較模型;發出請求前,用 GET https://api.apihop.ai/v1/models 確認金鑰可用性。
驗證
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json非串流請求
{
"model": "gemini-3.7-flash",
"messages": [
{
"role": "system",
"content": "You are a concise and accurate technical assistant."
},
{
"role": "user",
"content": "Explain idempotent APIs in five sentences."
}
],
"stream": false
}串流請求
{
"model": "gemini-3.6-flash",
"messages": [
{
"role": "user",
"content": "Show a TypeScript API error-handling example."
}
],
"stream": true
}此端點預設回傳一個完整 JSON 回應。需要 SSE 串流時,請明確設定 stream: true。
請求欄位
modelstring必填使用 gemini-3.6-flash 或 gemini-3.7-flash 或 gemini-3.8-flash 或 gemini-3.5-flash-lite 或 gemini-4-argon。
messagesobject[]必填OpenAI Chat Completions 風格的訊息,每則訊息包含 role 與 content。
streamboolean預設: falsetrue 回傳 SSE;false 回傳一個完整 JSON 回應。
max_tokensinteger選填的輸出 Token 上限,須為正整數。省略時使用所選模型的上游預設值。依模型而定,此額度可能同時包含推理 Token 與最終文字。過小的額度可能截斷回答,或在產生最終文字前耗盡;提高額度可能增加費用。
max_completion_tokensintegermax_tokens 的選填相容替代欄位,具有相同額度注意事項。支援情況由所選模型決定;省略兩個欄位可使用上游預設值。
關於 temperature、top_p、frequency_penalty、presence_penalty、stop 與 n 等共用欄位,請參閱共用 Chat Completions。選填欄位的支援與行為依模型而定;本頁不保證所有共用欄位都可用。
成功回應
{
"id": "chatcmpl_...",
"object": "chat.completion",
"created": 1787200000,
"model": "gemini-3.7-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "An idempotent API produces the same effective result when..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 26,
"completion_tokens": 118,
"total_tokens": 144
}
}usage 可能包含選填的推理 Token 明細;用戶端應容許其缺少或因模型而變化。
使用注意事項
- 主體的
model必須是可用模型表中的公開 ID 之一。 - 不接受產品名稱、顯示名稱或其他別名取代公開模型 ID。
- 本頁僅適用於傳至
POST https://api.apihop.ai/v1/chat-completions的 Chat Completions 請求,不適用 OpenAI Responses 或 Claude Messages。 - 以
GET https://api.apihop.ai/v1/models查看目前金鑰可見的模型,並在控制台查看現行價格。