Skip to main content
POST
/
v1
/
images
/
generations
Create image
curl --request POST \
  --url https://api.dgrid.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "A cute baby sea otter wearing a beret",
  "model": "dall-e-3",
  "size": "1024x1024"
}
'
{
  "created": 123,
  "data": [
    {
      "url": "<string>",
      "b64_json": "<string>",
      "revised_prompt": "<string>"
    }
  ],
  "usage": {
    "total_tokens": 123,
    "input_tokens": 123,
    "output_tokens": 123,
    "input_tokens_details": {
      "text_tokens": 123,
      "image_tokens": 123
    }
  }
}
This page uses the same images/generations operation as Create image, with the playground above pre-filled for the generic OpenAI-style image schema (prompt, model, size, etc.). The notes below describe the Qwen-specific request shape for wanx-v1 style models.
Qwen image models accept an alternate request shape that wraps your prompt inside input.messages rather than a top-level prompt field. Provide model and input together in the playground’s request body to use this shape.

Qwen-specific request fields

FieldTypeRequiredDescription
modelstringYesModel identifier, such as wanx-v1.
inputobjectYesInput wrapper object sent in the request, used instead of a top-level prompt.
input.messagesarrayYesMessages array nested under input.
input.messages[].rolestringYesMessage role, e.g. user.
input.messages[].contentstringYesPrompt text describing the desired image.
Unlike the standard prompt/size/quality fields shown in the playground, Qwen’s wanx-v1 models read the prompt from input.messages[].content. Other top-level fields such as n and response_format are not used by this format.

Example: generating an image

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

Response fields

The response follows the standard image generation shape:
created
integer
Creation timestamp.
data
array
Generated image entries.

Example response

200
{
  "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."
    }
  ]
}

Authorizations

Authorization
string
header
required

Your DGrid API key. All endpoints use Authorization: Bearer <DGRID_API_KEY>.

Body

application/json
prompt
string
required

Image prompt.

model
string
default:dall-e-2

Model such as dall-e-2 or dall-e-3.

n
integer
default:1

Number of images to generate.

quality
enum<string>
default:standard
Available options:
standard,
hd
response_format
enum<string>
default:url
Available options:
url,
b64_json
size
string
default:1024x1024

Output size.

style
enum<string>
default:vivid
Available options:
vivid,
natural
user
string

End-user identifier.

Response

Generated images.

created
integer

Creation timestamp.

data
object[]

Generated image entries.

usage
object