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

# Chỉnh sửa hình ảnh (tương thích với OpenAI Dall-E)

> OpenAI API chỉnh sửa hình ảnh định dạng Dall-E.

- `POST /v1/images/edits`: Chỉnh sửa hình ảnh

Header xác thực tiêu chuẩn:
- `Content-Type: application/json`

- `model: string`: Bắt buộc, tên mô hình công khai
- `prompt: string`: Khuyến nghị, mô tả tạo ảnh
- `n: number`: Tùy chọn, số lượng ảnh tạo
- `size: string`: Tùy chọn, biểu thức kích thước hoặc độ phân giải
- `quality: string`: Tùy chọn, mức chất lượng
- `response_format: string`: Tùy chọn, định dạng trả về

Các tham số mở rộng tương thích thường dùng:
- `image`
- `image_url`
- `image_urls`
- `image_list`
- `subject_image_list`
- `scene_image`
- `style_image`
- `negative_prompt`
- `aspect_ratio`
- `resolution`
- `callback_url`
- `external_task_id`

### 3.1 Dòng Nano Banana

Mô hình công khai:
- `nano-banana`
- `nano-banana-pro`
- `nano-banana-pro-2k`
- `nano-banana-pro-4k`
- `nano-banana-2`
- `nano-banana-2-2k`
- `nano-banana-2-4k`

Mô tả khả năng:
- `nano-banana`: Tạo ảnh từ văn bản cơ bản, cũng tương thích với chỉnh sửa ảnh
- `nano-banana-pro*`: Phiên bản chất lượng cao hơn
- `nano-banana-2*`: Họ phiên bản mới hơn
- `*-2k` / `*-4k`: Mẫu độ phân giải cao

Tham số thường dùng:
- Text-to-image: `model + prompt`
- Chỉnh sửa ảnh: `model + prompt + image`, cũng tương thích với `image_urls`
- Mở rộng thường dùng: `n` `size` `quality` `response_format`

Ví dụ:

```json
{
  "model": "nano-banana",
  "prompt": "a cute cat running in cloud",
  "n": 1,
  "size": "1024x1792"
}
```

```json
{
  "model": "nano-banana-pro",
  "prompt": "把主体改成赛博朋克夜景",
  "image": "https://example.com/input.png",
  "n": 1
}
```

### 3.2 Dòng Seedream

Mô hình công khai:
- `doubao-seedream-3-0-t2i-250415`
- `doubao-seedream-4-0-250828`
- `doubao-seedream-4-5-251128`
- `doubao-seedream-5-0-260128`

Mô tả khả năng:
- Thống nhất gọi theo cách text-to-image
- Khuyến nghị ưu tiên truyền tham số chuẩn: `prompt + model + size/aspect_ratio`

Tham số thường dùng:
- `model + prompt`
- Tùy chọn: `size` `aspect_ratio` `n`

### 3.3 Thử đồ ảo Kolors

Đây là dịch vụ thử đồ ảo độc lập, không thuộc phiên bản mô hình video Kling.
Hỗ trợ `kolors-virtual-try-on-v1`, `kolors-virtual-try-on-v1-5`.
Tham số đầu vào tối thiểu là `model + human_image + cloth_image`, không cần `model_name`.

```json
{
  "model": "kolors-virtual-try-on-v1",
  "human_image": "https://example.com/human.jpg",
  "cloth_image": "https://example.com/cloth.jpg"
}
```



## OpenAPI

````yaml api-reference/vi/openapi.json POST /v1/images/edits
openapi: 3.0.0
info:
  title: Tài liệu tham khảo API của NewAPIs
  version: 1.0.0
  description: Public AI Gateway API Reference
servers:
  - url: https://api.newapi.si
security:
  - BearerAuth: []
tags:
  - name: Định dạng OpenAI (Chat)
  - name: Định dạng OpenAI (Responses)
  - name: Định dạng Gemini cho tạo ảnh
  - name: Tạo hình ảnhOpenAI định dạng DALL-E
  - name: Lấy danh sách mô hình
  - name: Tạo video HappyHorse và Wan
  - name: Định dạngKling tạo video
  - name: Định dạng Video Generation Omni và Veo
  - name: Tạo video Seedance
  - name: Định dạng tương thích Sora cho tạo video
  - name: Tạo video Vidu
  - name: Định dạng tác vụ tạo nhạc
paths:
  /v1/images/edits:
    post:
      tags:
        - Tạo hình ảnhOpenAI định dạng DALL-E
      summary: Chỉnh sửa hình ảnh (tương thích với OpenAI Dall-E)
      description: >-
        OpenAI API chỉnh sửa hình ảnh định dạng Dall-E.


        - `POST /v1/images/edits`: Chỉnh sửa hình ảnh


        Header xác thực tiêu chuẩn:

        - `Content-Type: application/json`


        - `model: string`: Bắt buộc, tên mô hình công khai

        - `prompt: string`: Khuyến nghị, mô tả tạo ảnh

        - `n: number`: Tùy chọn, số lượng ảnh tạo

        - `size: string`: Tùy chọn, biểu thức kích thước hoặc độ phân giải

        - `quality: string`: Tùy chọn, mức chất lượng

        - `response_format: string`: Tùy chọn, định dạng trả về


        Các tham số mở rộng tương thích thường dùng:

        - `image`

        - `image_url`

        - `image_urls`

        - `image_list`

        - `subject_image_list`

        - `scene_image`

        - `style_image`

        - `negative_prompt`

        - `aspect_ratio`

        - `resolution`

        - `callback_url`

        - `external_task_id`


        ### 3.1 Dòng Nano Banana


        Mô hình công khai:

        - `nano-banana`

        - `nano-banana-pro`

        - `nano-banana-pro-2k`

        - `nano-banana-pro-4k`

        - `nano-banana-2`

        - `nano-banana-2-2k`

        - `nano-banana-2-4k`


        Mô tả khả năng:

        - `nano-banana`: Tạo ảnh từ văn bản cơ bản, cũng tương thích với chỉnh
        sửa ảnh

        - `nano-banana-pro*`: Phiên bản chất lượng cao hơn

        - `nano-banana-2*`: Họ phiên bản mới hơn

        - `*-2k` / `*-4k`: Mẫu độ phân giải cao


        Tham số thường dùng:

        - Text-to-image: `model + prompt`

        - Chỉnh sửa ảnh: `model + prompt + image`, cũng tương thích với
        `image_urls`

        - Mở rộng thường dùng: `n` `size` `quality` `response_format`


        Ví dụ:


        ```json

        {
          "model": "nano-banana",
          "prompt": "a cute cat running in cloud",
          "n": 1,
          "size": "1024x1792"
        }

        ```


        ```json

        {
          "model": "nano-banana-pro",
          "prompt": "把主体改成赛博朋克夜景",
          "image": "https://example.com/input.png",
          "n": 1
        }

        ```


        ### 3.2 Dòng Seedream


        Mô hình công khai:

        - `doubao-seedream-3-0-t2i-250415`

        - `doubao-seedream-4-0-250828`

        - `doubao-seedream-4-5-251128`

        - `doubao-seedream-5-0-260128`


        Mô tả khả năng:

        - Thống nhất gọi theo cách text-to-image

        - Khuyến nghị ưu tiên truyền tham số chuẩn: `prompt + model +
        size/aspect_ratio`


        Tham số thường dùng:

        - `model + prompt`

        - Tùy chọn: `size` `aspect_ratio` `n`


        ### 3.3 Thử đồ ảo Kolors


        Đây là dịch vụ thử đồ ảo độc lập, không thuộc phiên bản mô hình video
        Kling.

        Hỗ trợ `kolors-virtual-try-on-v1`, `kolors-virtual-try-on-v1-5`.

        Tham số đầu vào tối thiểu là `model + human_image + cloth_image`, không
        cần `model_name`.


        ```json

        {
          "model": "kolors-virtual-try-on-v1",
          "human_image": "https://example.com/human.jpg",
          "cloth_image": "https://example.com/cloth.jpg"
        }

        ```
      operationId: createImageEdit
      parameters: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                model:
                  type: string
                  example: dall-e-2
                  description: Tên mô hình hình ảnh công khai.
                  enum:
                    - nano-banana
                    - doubao-seedream-3-0-t2i-250415
                    - seedream-5.0-flash
                    - seedream-5.0-pro
                    - seedream-5.5
                    - kolors-virtual-try-on-v1
                    - kolors-virtual-try-on-v1-5
                image:
                  type: string
                  format: binary
                  description: >-
                    Đầu vào một ảnh, thường dùng cho tạo ảnh từ ảnh và mở rộng
                    ảnh.
                mask:
                  type: string
                  format: binary
                  description: Ảnh mặt nạ tùy chọn
                prompt:
                  type: string
                  description: Mô tả tạo ảnh.
                'n':
                  type: integer
                  description: Số lượng ảnh được tạo.
                  default: 1
                size:
                  type: string
                  enum:
                    - 256x256
                    - 512x512
                    - 1024x1024
                  description: Biểu thị kích thước hoặc độ phân giải.
                response_format:
                  type: string
                  description: Định dạng trả về.
                  enum:
                    - url
                    - b64_json
                user:
                  type: string
              required:
                - model
                - image
                - prompt
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  example: dall-e-2
                  description: Tên mô hình hình ảnh công khai.
                  enum:
                    - nano-banana
                    - doubao-seedream-3-0-t2i-250415
                    - seedream-5.0-flash
                    - seedream-5.0-pro
                    - seedream-5.5
                    - kolors-virtual-try-on-v1
                    - kolors-virtual-try-on-v1-5
                image:
                  type: string
                  format: binary
                  description: >-
                    Đầu vào một ảnh, thường dùng cho tạo ảnh từ ảnh và mở rộng
                    ảnh.
                mask:
                  type: string
                  format: binary
                  description: Ảnh mặt nạ tùy chọn
                prompt:
                  type: string
                  description: Mô tả tạo ảnh.
                'n':
                  type: integer
                  description: Số lượng ảnh được tạo.
                  default: 1
                size:
                  type: string
                  enum:
                    - 256x256
                    - 512x512
                    - 1024x1024
                  description: Biểu thị kích thước hoặc độ phân giải.
                response_format:
                  type: string
                  description: Định dạng trả về.
                  enum:
                    - url
                    - b64_json
                user:
                  type: string
              required:
                - model
                - image
                - prompt
            examples:
              nano_banana_text2img:
                summary: Nano Banana Tạo ảnh từ văn bản
                value:
                  model: nano-banana
                  prompt: a cute cat running in cloud
                  'n': 1
                  size: 1024x1792
              seedream_text2img:
                summary: Seedream tạo ảnh từ văn bản
                value:
                  model: doubao-seedream-3-0-t2i-250415
                  prompt: 一张电影感海边日落人像
                  size: 1536x1024
                  'n': 1
              seedream_canvas_generation:
                summary: Seedream tạo ảnh từ văn bản
                value:
                  model: seedream-5.5
                  prompt: A mountain lake in morning light.
                  size: 2k
              kolors_virtual_try_on:
                summary: Thử đồ ảo Kolors
                value:
                  model: kolors-virtual-try-on-v1
                  human_image: https://example.com/human.jpg
                  cloth_image: https://example.com/cloth.jpg
      responses:
        '200':
          description: Tạo hình ảnh thành công
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
        data:
          type: array
          items:
            type: object
            properties:
              url:
                type: string
              b64_json:
                type: string
              revised_prompt:
                type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |-
        Sử dụng xác thực Bearer Token.
        Định dạng: `Authorization: Bearer sk-xxxxxx`

````

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