> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipellm.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 图像

> 用 GPT 和 Gemini 图像模型生成和编辑图像。

生成图像有两条路径，用哪条取决于模型属于哪一族。

| 模型族 | 路径 | 参考 |
| - | - | - |
| GPT 图像模型 | `POST /v1/images/generations` | [生成图像](/zh/api-reference/image/generations) |
| Gemini 图像模型 | `POST /v1beta/models/{model}:generateContent` | [用 Gemini 生成图像](/zh/api-reference/image/gemini) |

OpenAI 兼容路径是大家熟悉的那条：把 OpenAI SDK 的 base URL 指向 `https://api.pipellm.ai/v1`，原样调用即可。[编辑已有图像](/zh/api-reference/image/edits) 也走这条。

Gemini 图像模型没有自己的 `/v1/images/*` 路由，它和文本模型共用 `generateContent`，图像作为 inline part 返回。PipeLLM 没有 `/v2/images` 路由。

Gemini 的完整请求和响应示例见 [Nano Banana](/zh/use-cases/nano-banana)。

| 模型 | 典型用途 |
| - | - |
| `gemini-3.1-flash-lite-image` | 最便宜最快 |
| `gemini-3.1-flash-image` | 快速出图 |
| `gemini-3-pro-image` | 更高保真的生产图像 |

```bash theme={"dark"}
curl -X POST \
  "https://api.pipellm.ai/v1beta/models/gemini-3.1-flash-image:generateContent" \
  -H "x-goog-api-key: $PIPELLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{
      "role": "user",
      "parts": [{"text": "一辆红自行车靠在咖啡馆窗边"}]
    }]
  }'
```

当前图像模型 ID 请用 [`GET /v1/models`](/zh/api-reference/list-models) 确认。视频请使用 [`POST /v2/videos`](/zh/guides/video)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.