> For the complete documentation index, see [llms.txt](https://nsclouds.gitbook.io/aillm.nscloud.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nsclouds.gitbook.io/aillm.nscloud.ai/api-reference-cn/tu-xiang-bian-ji/dashscope.md).

# DashScope

### 1. 概述

DashScope 在当前环境中提供的图像编辑能力。

{% hint style="success" %}
本接口提供与 OpenAI Images 兼容的请求路径。不同厂家和模型的实际能力可能不同。
{% endhint %}

**模型列表：**

* `qwen-image-2.0`
* `qwen-image-2.0-pro`

### 2. 接口详情

## 编辑图像

> 提供与 OpenAI Images 兼容的图像编辑接口。具体支持的能力因模型而异。

```json
{"openapi":"3.1.0","info":{"title":"NSCloud AI API 文档","version":"1.11.0"},"tags":[{"name":"image_edits_dashscope","description":"DashScope 的图像编辑 API"}],"servers":[{"url":"https://aillm.nscloud.ai","description":"国际服务器"}],"security":[{"APIKeyHeader":[]}],"components":{"securitySchemes":{"APIKeyHeader":{"type":"http","scheme":"bearer","description":"使用 Bearer 令牌进行认证，格式：'Bearer YOUR_SECRET_TOKEN'"}},"schemas":{"CreateImageEditRequest":{"type":"object","description":"图像编辑请求体。","properties":{"model":{"type":"string","description":"要调用的模型 ID。"},"image":{"type":"array","description":"要编辑的一张或多张输入图片文件。请求参数名为 image；使用原始 multipart/curl 上传多文件时，可重复发送 image[] 表单项。","items":{"type":"string","format":"binary"}},"mask":{"type":"string","format":"binary","description":"可选蒙版文件，用于指定可编辑区域。"},"prompt":{"type":"string","description":"图像编辑提示词。"},"n":{"type":"integer","description":"期望生成的图片数量。","default":1},"size":{"type":"string","description":"输出图片尺寸。","default":"1024x1024"},"response_format":{"type":"string","description":"图片返回格式。","enum":["url","b64_json"],"default":"url"}},"required":["model","image","prompt"]},"ImageResponse":{"type":"object","description":"图像生成或编辑成功响应。","properties":{"created":{"type":"integer","description":"响应创建时间戳（Unix 秒）。"},"data":{"type":"array","description":"图片结果列表。","items":{"$ref":"#/components/schemas/ImageDataItem"}},"background":{"type":"string","description":"生成图像的背景类型。"},"output_format":{"type":"string","description":"输出图片格式，例如 png。"},"quality":{"type":"string","description":"实际使用的图像质量等级。"},"size":{"type":"string","description":"实际返回的图像尺寸。"},"usage":{"$ref":"#/components/schemas/ImageUsage"}}},"ImageDataItem":{"type":"object","description":"单张生成图片的返回对象。","properties":{"url":{"type":"string","description":"图片访问 URL，response_format=url 时返回。"},"b64_json":{"type":"string","description":"Base64 编码的图片数据，response_format=b64_json 时返回。"},"revised_prompt":{"type":"string","description":"模型实际使用或修正后的提示词。"}}},"ImageUsage":{"type":"object","description":"图像生成的资源使用统计。","properties":{"total_tokens":{"type":"integer","description":"总 token 数。"},"input_tokens":{"type":"integer","description":"输入 token 数。"},"output_tokens":{"type":"integer","description":"输出 token 数。"},"input_tokens_details":{"type":"object","description":"输入 token 使用明细。","properties":{"text_tokens":{"type":"integer","description":"文本提示消耗的 token 数。"},"image_tokens":{"type":"integer","description":"图片输入消耗的 token 数。"}},"additionalProperties":true}}},"ErrorResponse":{"type":"object","description":"错误响应。","properties":{"error":{"$ref":"#/components/schemas/ErrorDetail"}}},"ErrorDetail":{"type":"object","description":"错误详情对象。","properties":{"message":{"type":"string","description":"错误说明。"},"type":{"type":"string","description":"错误类型。"},"param":{"description":"与错误相关的参数名。","type":["string","null"]},"code":{"description":"错误码。","type":["string","null"]}}}},"responses":{"ErrorResponse":{"description":"错误响应","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v1/images/edits":{"post":{"tags":["image_edits_dashscope"],"summary":"编辑图像","description":"提供与 OpenAI Images 兼容的图像编辑接口。具体支持的能力因模型而异。","operationId":"createImageEdit_dashscope","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/CreateImageEditRequest"},"encoding":{"image":{"style":"form","explode":true}}}}},"responses":{"200":{"description":"成功响应","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImageResponse"}}}},"400":{"$ref":"#/components/responses/ErrorResponse"},"401":{"$ref":"#/components/responses/ErrorResponse"},"429":{"$ref":"#/components/responses/ErrorResponse"}}}}}}
```
