典名词元DMTOKENSHome
API DocumentationThird-Party Tools Tutorial
AI Model APIImageImagen4

Text-to-Image

POST/api/v1/image/generation

Header Parameters

Authorization*string

Format: Authorization: Bearer sk-xxxxxx

Request Body

application/json

_action*string

Fixed value i

model*string

Model name, supported: I4YG1 I4FG1

Value in"I4YG1" | "I4FG1"
messages*array<object>

Message list, only one message is supported.

[]?object
role?string

Message role, fixed value: user

content?array<object>

Content List

[]?object
type*string

Content Type: text

text?string

Text content (required when type=text)

n?integer

Number of images to generate, range 1-4

quality?string

Image resolution, supported: 1K

response_modalities*array<string>

Response modality, if provided, must include "IMAGE"

[]?string

Response Body

application/json

Success

TypeScript Definitions

Use the response body type in TypeScript.

code*integer

Status Code

data*object

Data Object

urls*array<string>

Result Set

[]?string
usage*object

Usage Information

images*integer

Number of Images

seconds*integer

Video Duration in Seconds

input_tokens*integer

Input Token Count

total_tokens*integer

Total Token Count

output_tokens*integer

Output Token Count

expired*string

Validity Period

task_id*string

Task ID

task_status*string

Task Status

message*string

Status Information

request_id*string

Request ID

curl -X POST "https://api.ygw.ai/api/v1/image/generation" \  -H "Authorization: string" \  -H "Content-Type: application/json" \  -d '{    "_action": "string",    "model": "I4YG1",    "messages": [      {}    ],    "response_modalities": [      "string"    ]  }'
{
  "code": 0,
  "data": {
    "urls": [
      "string"
    ],
    "usage": {
      "images": 0,
      "seconds": 0,
      "input_tokens": 0,
      "total_tokens": 0,
      "output_tokens": 0
    },
    "expired": "string",
    "task_id": "string",
    "task_status": "string"
  },
  "message": "string",
  "request_id": "string"
}