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

# 生成图片

> 根据提示词创建图片

| 字段                   | 类型      | 必填 | 说明                    |
| -------------------- | ------- | -- | --------------------- |
| `model`              | string  | 是  | 图片生成模型 ID。            |
| `prompt`             | string  | 是  | 图片描述。                 |
| `n`                  | integer | 否  | 生成数量，模型可能限制该值。        |
| `size`               | string  | 否  | 模型支持的输出尺寸。            |
| `quality`            | string  | 否  | 输出质量。                 |
| `background`         | string  | 否  | 背景模式，如透明或不透明。         |
| `output_format`      | string  | 否  | 输出格式，如 png、jpeg、webp。 |
| `moderation`, `user` | string  | 否  | 审查级别与用户标识。            |

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.bianxie.ai/v1/images/generations \
    -H "Authorization: Bearer API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "your-model",
      "prompt": "蓝天下的未来城市"
    }'
  ```

  ```python Python theme={null}
  client.images.generate(model="your-model", prompt="蓝天下的未来城市")
  ```

  ```javascript Node.js theme={null}
  await client.images.generate({ model: "your-model", prompt: "A futuristic city" });
  ```
</CodeGroup>

响应包含 `created` 与 `data[]`；图片可能以 `b64_json` 或 URL 返回，并可包含修订后的提示词。是否支持流式进度取决于所选模型，默认按非流式处理。
