# Gemini 2.5 Flash — /chat/completions

OpenAI 兼容的对话补全接口，承载 Gemini 2.5 Flash 高速高性价比模型，支持多模态输入与流式输出。只需把 model 设为 gemini-2.5-flash。

**端点:** `POST https://nezhagate.com/v1/chat/completions`

## 认证
```
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
```

## 请求参数
| 参数 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| `model` | string | 是 | 模型 ID，此处为 gemini-2.5-flash。 |
| `messages` | array | 是 | 对话消息数组，每项含 role（system/user/assistant）与 content。content 可为字符串，或由 {type:text} 与 {type:image_url} 组成的数组以识别图片（多模态/Vision）。 |
| `stream` | boolean | 否 | 是否以 SSE 流式返回。默认 false。 |
| `temperature` | number | 否 | 采样温度，0–2，越高越随机。 |
| `max_tokens` | integer | 否 | 最大生成 token 数。 |

## 请求示例
```bash
curl https://nezhagate.com/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"}], "stream": false}'
```

## 响应示例
```json
{
  "id": "chatcmpl_xxx",
  "object": "chat.completion",
  "model": "gemini-2.5-flash",
  "choices": [
    {"index": 0, "message": {"role": "assistant", "content": "Hello!"}, "finish_reason": "stop"}
  ],
  "usage": {"prompt_tokens": 11, "completion_tokens": 7, "total_tokens": 18}
}
```

## 图片识别（Vision）
在 messages 的 content 数组里传入图片，即可让模型识别图片内容（看图问答、读图中文字/OCR 等）。image_url 支持公网图片链接，或 base64 内联（data:image/png;base64,...）。多模态模型可用（gpt-5.5、gemini 系列等）。

```bash
curl https://nezhagate.com/v1/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "gemini-2.5-flash", "messages": [{"role": "user", "content": [{"type": "text", "text": "What is in this image?"}, {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}]}]}'
```