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

# Ming Image Text to Image

Ming Image — an image generation model family. `ming-image-0.1-design` supports text-to-image generation using the OpenAI Image generations protocol.

* `ming-image-0.1-design`: Supports text-to-image, using the OpenAI Image generations protocol.
* `ming-image-0.1-design-layer`: Only supports layer decoupling, using the OpenAI Image edits protocol (see the [Ming Image Layer Decoupling](/api-reference/model-apis-ming-image-layer) API).

## Request Headers

<ParamField header="Content-Type" type="string" required={true}>
  Supports: `application/json`
</ParamField>

<ParamField header="Authorization" type="string" required={true}>
  Bearer authentication format, for example: Bearer \{\{API Key}}.
</ParamField>

## Request Body

<ParamField body="model" type="enum" required={true}>
  The model name. Available values: `ming-image-0.1-design`
</ParamField>

<ParamField body="prompt" type="string" required={true}>
  The text description of the image.
</ParamField>

<ParamField body="output_format" type="string" default="png" required={false}>
  The output image format. Must be one of `png` or `jpeg`.
</ParamField>

<ParamField body="response_format" type="string" default="b64_json" required={false}>
  The form in which the image is returned, default is `b64_json`. Available values: `url`, `b64_json`. Note: `url` is valid for 24 hours.
</ParamField>

<ParamField body="size" type="string" default="auto" required={false}>
  The output image size, default `auto` selects automatically based on the model. Format `"{w}x{h}"`, e.g. `"1024x1024"`.

  `ming-image-0.1-design` size only supports 1k and above, e.g. `"1024x1024"`, `"2048x2048"`.
</ParamField>

<ParamField body="watermark" type="boolean" default={false} required={false}>
  Controls whether a watermark is added to the AI-generated image. `true`: enables the explicit watermark and implicit digital watermark on AI-generated images, complying with policy requirements. `false`: disables all watermarks.
</ParamField>

## Response

<ResponseField name="created" type="integer" required={true}>
  The Unix timestamp (seconds) when the response was created.
</ResponseField>

<ResponseField name="data" type="array" required={true}>
  The array of returned images, each element contains the information of one generated image.

  <Expandable title="properties">
    <ResponseField name="b64_json" type="string">
      The base64-encoded generated image data.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="output_format" type="string" required={true}>
  The actual output image format, e.g. `png`, `jpeg`.
</ResponseField>

<ResponseField name="size" type="string">
  `null`
</ResponseField>

<ResponseField name="usage" type="object" required={true}>
  Token usage statistics.

  <Expandable title="properties">
    <ResponseField name="input_tokens" type="integer">
      Total input tokens (0 for text-to-image).
    </ResponseField>

    <ResponseField name="input_tokens_details" type="object">
      Input token details.

      <Expandable title="properties">
        <ResponseField name="image_tokens" type="integer">
          The number of image tokens in the input (0 for text-to-image).
        </ResponseField>

        <ResponseField name="text_tokens" type="integer">
          The number of text tokens in the input.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="output_tokens" type="integer">
      Total output tokens (i.e. the tokens consumed by the generated image).
    </ResponseField>

    <ResponseField name="total_tokens" type="integer">
      The total of input + output tokens.
    </ResponseField>

    <ResponseField name="output_tokens_details" type="object">
      Output token details.

      <Expandable title="properties">
        <ResponseField name="image_tokens" type="integer">
          The number of image tokens in the output.
        </ResponseField>

        <ResponseField name="text_tokens" type="integer">
          The number of text tokens in the output.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="model" type="string" required={true}>
  The name of the model that actually processed the request.
</ResponseField>

<ResponseField name="id" type="string" required={true}>
  The unique identifier ID of this request.
</ResponseField>

## Example

`Request:`

```bash theme={"system"}
curl --location --request POST 'https://api.novita.ai/v1/images/generations' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'content-type: application/json' \
--data-raw '{
  "model": "ming-image-0.1-design",
  "prompt": "Generate a banana"
}'
```

`Response:`

```js theme={"system"}
{
  "created": 1789642354,
  "data": [
    {
      "b64_json": "..."
    }
  ],
  "output_format": "png",
  "size": null,
  "usage": {
    "input_tokens": 0,
    "input_tokens_details": {
      "image_tokens": 0,
      "text_tokens": 0
    },
    "output_tokens": 16384,
    "total_tokens": 16384,
    "output_tokens_details": {
      "image_tokens": 16384,
      "text_tokens": 0
    }
  },
  "model": "Ming-Image-0.1-Design-StressTest",
  "id": "2180534417896423312485570e8523"
}
```
