Text-to-Image/Image-to-Image
/api/v1/image/generationHeader Parameters
Format: Authorization: Bearer sk-xxxxxx
Request Body
application/json
Fixed value i
Model name, supported: NB NBP NB2
"NB" | "NBP" | "NB2"Message list, only one message is supported.
Message role, fixed value: user
Content List
Content type: text or image_url
Text content (required when type=text)
Image information (required when type=image_url)
Image URL
NB/NBP/NB2 only support 1
Image aspect ratio, supported: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9, 1:4, 1:8, 4:1, 8:1 (1:4, 1:8, 4:1, 8:1 supported only by NB2)
Image resolution: NB supports 1K, NBP supports 1K/2K/4K, and NB2 supports 512/1K/2K/4K.
Response modality, if provided, must include "IMAGE".
Tool definition, supported by NBP/NB2, not supported by NB
Tool type, fixed value: function
Function Definition
Function name, such as GWebSearch (Web Search)
Model Extension Configuration
Google/Gemini Model Configuration
Thinking mode configuration, supported only by NB2
Thinking level, supported only by NB2, accepting only MINIMAL and HIGH.
Response Body
application/json
Success
TypeScript Definitions
Use the response body type in TypeScript.
Status Code
Data Object
Result Set
Usage Information
Number of Images
Video Duration in Seconds
Input Token Count
Total Tokens
Output token count
Validity Period
Task ID
Task Status
Status Information
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": "NB", "messages": [ {} ] }'{
"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"
}