POST
https://nezhagate.com/v1/chat/completions
OpenAI 兼容的对话补全接口,承载 Gemini 3 Flash 高速模型,低延迟、高性价比,支持流式输出。只需把 model 设为 gemini-3-flash-preview。
在 Playground 试用 →认证
Authorization: Bearer YOUR_API_KEY Content-Type: application/json
在控制台创建 API Key 后即可调用。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型 ID,此处为 gemini-3-flash-preview。 |
| messages | array | 是 | 对话消息数组,每项含 role(system/user/assistant)与 content。 |
| stream | boolean | 否 | 是否以 SSE 流式返回。默认 false。 |
| temperature | number | 否 | 采样温度,0–2,越高越随机。 |
| max_tokens | integer | 否 | 最大生成 token 数。 |
请求示例
curl https://nezhagate.com/v1/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "gemini-3-flash-preview", "messages": [{"role": "user", "content": "Hello"}], "stream": false}'响应示例
{
"id": "chatcmpl_xxx",
"object": "chat.completion",
"model": "gemini-3-flash-preview",
"choices": [
{"index": 0, "message": {"role": "assistant", "content": "Hello!"}, "finish_reason": "stop"}
],
"usage": {"prompt_tokens": 11, "completion_tokens": 7, "total_tokens": 18}
}错误码
| Code | 说明 |
|---|---|
| 401 | Invalid or missing API key |
| 402 | Insufficient balance / key limit reached |
| 400 | Invalid parameters or model |
| 429 | Rate limited |
| 502 | All upstream providers failed |