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

# 改图(Image 格式)

> 基于原图和文本描述进行图像编辑

## 功能说明

使用启航 AI 的图像编辑模型，通过上传原图并提供文本描述（Prompt）来修改图像内容。

## 请求参数

| 名称       | 类型       | 必选 | 说明                     |
| :------- | :------- | :- | :--------------------- |
| `model`  | `string` | 是  | 模型名称，如 `nano-banana-1` |
| `image`  | `file`   | 是  | 待修改的原图文件（binary）       |
| `prompt` | `string` | 是  | 修改描述，如 "改成白色背景"        |

## 调用示例

<CodeGroup>
  ```python Python theme={null}
  import requests

  url = "https://api.qhaigc.net/v1/images/edits"
  headers = {
      "Authorization": "Bearer sk-your-api-key-here"
  }

  files = {
      "image": open("original_image.png", "rb")
  }
  data = {
      "model": "nano-banana-1",
      "prompt": "改成白色背景"
  }

  response = requests.post(url, headers=headers, files=files, data=data)
  print(response.json())
  ```

  ```bash cURL theme={null}
  curl https://api.qhaigc.net/v1/images/edits \
    -H "Authorization: Bearer sk-your-api-key-here" \
    -F "model=nano-banana-1" \
    -F "image=@/path/to/your/image.png" \
    -F "prompt=改成白色背景"
  ```
</CodeGroup>

## 返回结果

<CodeGroup>
  ```json 成功响应 theme={null}
  {
    "created": 1761223754,
    "data": [
      {
        "url": "https://images.qhaigc.net/img/edited_image.webp"
      }
    ]
  }
  ```
</CodeGroup>

## 相关参考

* [绘图(Image 格式)](/docs/api-reference/images/generate)
* [模型列表](/docs/models#图像生成模型)


## OpenAPI

````yaml POST /v1/images/edits
openapi: 3.1.0
info:
  title: 启航 AI API
  version: 1.0.0
  description: 启航 AI API 文档，支持绘图、语音生成、视频生成、音乐生成等多种 AIGC 接口。
servers:
  - url: https://api.qhaigc.net
    description: 生产服务器
security:
  - bearerAuth: []
paths:
  /v1/images/edits:
    post:
      tags:
        - 绘图模型
      summary: 改图
      description: 基于原图和文本描述进行图像编辑
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                image:
                  type: string
                  format: binary
                  description: 待修改的原图文件
                model:
                  type: string
                  description: 模型名称
                prompt:
                  type: string
                  description: 修改描述
              required:
                - image
                - model
                - prompt
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                type: object
                properties:
                  created:
                    type: integer
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````