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

# Qwen 이미지 생성

> OpenAI-compatible image generation. Also accepts Qwen-compatible payloads (`wanx-v1` style models) using an `input.messages` wrapper instead of `prompt`.

이 페이지는 [이미지 생성](/ko/api-reference/images/create-image)과 동일한 `images/generations` 작업을 사용하며, 위의 플레이그라운드에는 일반적인 OpenAI 스타일 이미지 스키마(`prompt`, `model`, `size` 등)가 미리 입력되어 있습니다. 아래 내용은 `wanx-v1` 스타일 모델을 위한 Qwen 전용 요청 형식을 설명합니다.

<Note>
  Qwen 이미지 모델은 최상위 `prompt` 필드 대신 프롬프트를 `input.messages` 안에 포함하는 대체 요청 형식을 사용합니다. 이 형식을 사용하려면 플레이그라운드의 요청 본문에 `model`과 `input`을 함께 제공하세요.
</Note>

### Qwen 전용 요청 필드

| 필드                         | 유형     | 필수 | 설명                                    |
| -------------------------- | ------ | -- | ------------------------------------- |
| `model`                    | string | 예  | `wanx-v1`과 같은 모델 식별자입니다.              |
| `input`                    | object | 예  | 최상위 `prompt` 대신 요청에 전달되는 입력 래퍼 객체입니다. |
| `input.messages`           | array  | 예  | `input` 하위에 중첩된 메시지 배열입니다.            |
| `input.messages[].role`    | string | 예  | 메시지 역할입니다 (예: `user`).                |
| `input.messages[].content` | string | 예  | 원하는 이미지를 설명하는 프롬프트 텍스트입니다.            |

<Tip>
  플레이그라운드에 표시된 표준 `prompt`/`size`/`quality` 필드와 달리, Qwen의 `wanx-v1` 모델은 `input.messages[].content`에서 프롬프트를 읽습니다. `n` 및 `response_format`과 같은 다른 최상위 필드는 이 형식에서 사용되지 않습니다.
</Tip>

### 예시: 이미지 생성

```json theme={null}
{
  "model": "wanx-v1",
  "input": {
    "messages": [
      {
        "role": "user",
        "content": "A serene mountain lake at dawn, photorealistic."
      }
    ]
  }
}
```

### 응답 필드

응답은 표준 이미지 생성 형식을 따릅니다.

<ResponseField name="created" type="integer">
  생성 타임스탬프입니다.
</ResponseField>

<ResponseField name="data" type="array">
  생성된 이미지 항목입니다.

  <Expandable title="data item properties">
    <ResponseField name="url" type="string">
      이미지 URL입니다.
    </ResponseField>

    <ResponseField name="b64_json" type="string">
      Base64 이미지 페이로드입니다.
    </ResponseField>

    <ResponseField name="revised_prompt" type="string">
      모델이 반환한 수정된 프롬프트입니다.
    </ResponseField>
  </Expandable>
</ResponseField>

### 응답 예시

```json 200 theme={null}
{
  "created": 1719859200,
  "data": [
    {
      "url": "https://cdn.dgrid.ai/generated/abc123.png",
      "b64_json": "",
      "revised_prompt": "A serene mountain lake at dawn with mist rising off the water, photorealistic."
    }
  ]
}
```


## OpenAPI

````yaml api-reference/openapi.json POST /v1/images/generations
openapi: 3.1.0
info:
  title: DGrid AI Gateway API
  description: >-
    A single, unified API to access 200+ leading AI models. OpenAI-, Claude-,
    and Gemini-compatible endpoints for chat, completions, embeddings, images,
    audio, and moderations.
  version: 1.0.0
  contact:
    name: DGrid AI
    url: https://dgrid.ai
servers:
  - url: https://api.dgrid.ai
    description: DGrid AI Gateway
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      tags:
        - Images
      summary: Create image
      description: >-
        OpenAI-compatible image generation. Also accepts Qwen-compatible
        payloads (`wanx-v1` style models) using an `input.messages` wrapper
        instead of `prompt`.
      operationId: createImage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  title: OpenAI format
                  required:
                    - prompt
                  properties:
                    prompt:
                      type: string
                      description: Image prompt.
                    model:
                      type: string
                      default: dall-e-2
                      description: Model such as `dall-e-2` or `dall-e-3`.
                    'n':
                      type: integer
                      default: 1
                      description: Number of images to generate.
                    quality:
                      type: string
                      enum:
                        - standard
                        - hd
                      default: standard
                    response_format:
                      type: string
                      enum:
                        - url
                        - b64_json
                      default: url
                    size:
                      type: string
                      default: 1024x1024
                      description: Output size.
                    style:
                      type: string
                      enum:
                        - vivid
                        - natural
                      default: vivid
                    user:
                      type: string
                      description: End-user identifier.
                - type: object
                  title: Qwen format
                  required:
                    - model
                    - input
                  properties:
                    model:
                      type: string
                      description: Model identifier, such as `wanx-v1`.
                    input:
                      type: object
                      description: Input wrapper object.
                      properties:
                        messages:
                          type: array
                          description: Messages array nested under `input`.
                          items:
                            type: object
            example:
              prompt: A cute baby sea otter wearing a beret
              model: dall-e-3
              size: 1024x1024
      responses:
        '200':
          description: Generated images.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  schemas:
    ImageResponse:
      type: object
      properties:
        created:
          type: integer
          description: Creation timestamp.
        data:
          type: array
          description: Generated image entries.
          items:
            type: object
            properties:
              url:
                type: string
                description: Image URL when using URL output.
              b64_json:
                type: string
                description: Base64 image payload when requested.
              revised_prompt:
                type: string
                description: Refined prompt returned by the model.
        usage:
          type: object
          properties:
            total_tokens:
              type: integer
            input_tokens:
              type: integer
            output_tokens:
              type: integer
            input_tokens_details:
              type: object
              properties:
                text_tokens:
                  type: integer
                image_tokens:
                  type: integer
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            param:
              type: string
            code:
              type: string
  responses:
    BadRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your DGrid API key. All endpoints use `Authorization: Bearer
        <DGRID_API_KEY>`.

````