Skip to content

Commit b598700

Browse files
feat: gen wan2.2 and wan2.5 (t2i)
1 parent 7be8643 commit b598700

4 files changed

Lines changed: 604 additions & 6 deletions

File tree

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"title": "AIML API",
5+
"version": "1.0.0"
6+
},
7+
"servers": [
8+
{
9+
"url": "https://api.aimlapi.com"
10+
}
11+
],
12+
"paths": {
13+
"/v1/images/generations": {
14+
"post": {
15+
"operationId": "_v1_images_generations",
16+
"requestBody": {
17+
"required": true,
18+
"content": {
19+
"application/json": {
20+
"schema": {
21+
"type": "object",
22+
"properties": {
23+
"model": {
24+
"type": "string",
25+
"enum": [
26+
"alibaba/wan2.2-t2i-flash"
27+
]
28+
},
29+
"prompt": {
30+
"type": "string",
31+
"maxLength": 2000,
32+
"description": "The text prompt describing the content, style, or composition of the image to be generated."
33+
},
34+
"negative_prompt": {
35+
"type": "string",
36+
"maxLength": 500,
37+
"description": "The description of elements to avoid in the generated image."
38+
},
39+
"num_images": {
40+
"type": "integer",
41+
"minimum": 1,
42+
"maximum": 4,
43+
"default": 1,
44+
"description": "The number of images to generate."
45+
},
46+
"image_size": {
47+
"anyOf": [
48+
{
49+
"type": "object",
50+
"properties": {
51+
"width": {
52+
"type": "integer",
53+
"minimum": 512,
54+
"maximum": 1440
55+
},
56+
"height": {
57+
"type": "integer",
58+
"minimum": 512,
59+
"maximum": 1440
60+
}
61+
},
62+
"required": [
63+
"width",
64+
"height"
65+
],
66+
"description": "For both height and width, the value must be a multiple of 32."
67+
},
68+
{
69+
"type": "string",
70+
"enum": [
71+
"square_hd",
72+
"square",
73+
"portrait_4_3",
74+
"portrait_16_9",
75+
"landscape_4_3",
76+
"landscape_16_9"
77+
],
78+
"description": "The size of the generated image."
79+
}
80+
],
81+
"default": "landscape_4_3",
82+
"description": "The size of the generated image."
83+
},
84+
"enhance_prompt": {
85+
"type": "boolean",
86+
"default": true,
87+
"description": "Optional parameter to use an LLM-based prompt rewriting feature for higher-quality images that better match the original prompt. Disabling it may affect image quality and prompt alignment."
88+
},
89+
"watermark": {
90+
"type": "boolean",
91+
"default": false,
92+
"description": "Add an invisible watermark to the generated images."
93+
},
94+
"seed": {
95+
"type": "integer",
96+
"minimum": 0,
97+
"maximum": 2147483647,
98+
"description": "The same seed and the same prompt given to the same version of the model will output the same image every time."
99+
}
100+
},
101+
"required": [
102+
"model",
103+
"prompt"
104+
],
105+
"title": "alibaba/wan2.2-t2i-flash"
106+
}
107+
}
108+
}
109+
},
110+
"responses": {
111+
"200": {
112+
"content": {
113+
"application/json": {
114+
"schema": {
115+
"type": "object",
116+
"properties": {
117+
"data": {
118+
"type": "array",
119+
"nullable": true,
120+
"items": {
121+
"type": "object",
122+
"properties": {
123+
"url": {
124+
"type": "string",
125+
"nullable": true,
126+
"description": "The URL where the file can be downloaded from.",
127+
"example": "https://cdn.aimlapi.com/generations/hedgehog/1749730923700-29fe35d2-4aef-4bc5-a911-6c39884d16a8.png"
128+
},
129+
"b64_json": {
130+
"type": "string",
131+
"nullable": true,
132+
"description": "The base64-encoded JSON of the generated image.",
133+
"example": null
134+
}
135+
}
136+
},
137+
"description": "The list of generated images."
138+
},
139+
"meta": {
140+
"type": "object",
141+
"nullable": true,
142+
"properties": {
143+
"usage": {
144+
"type": "object",
145+
"nullable": true,
146+
"properties": {
147+
"credits_used": {
148+
"type": "number",
149+
"description": "The number of tokens consumed during generation.",
150+
"example": 120000
151+
}
152+
},
153+
"required": [
154+
"credits_used"
155+
]
156+
}
157+
},
158+
"description": "Additional details about the generation."
159+
}
160+
}
161+
}
162+
}
163+
}
164+
}
165+
},
166+
"x-hideTryItPanel": true,
167+
"x-codeSamples": [
168+
{
169+
"lang": "cURL",
170+
"source": "curl -L \\\n --request POST \\\n --url 'https://api.aimlapi.com/v1/images/generations' \\\n --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"model\": \"alibaba/wan2.2-t2i-flash\",\n \"prompt\": \"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.\"\n }'"
171+
},
172+
{
173+
"lang": "JavaScript",
174+
"source": "async function main() {\n const response = await fetch('https://api.aimlapi.com/v1/images/generations', {\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n model: 'alibaba/wan2.2-t2i-flash',\n prompt: 'A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.',\n }),\n });\n\n const data = await response.json();\n console.log(JSON.stringify(data, null, 2));\n}\n\nmain();"
175+
},
176+
{
177+
"lang": "Python",
178+
"source": "import requests\n\nresponse = requests.post(\n \"https://api.aimlapi.com/v1/images/generations\",\n headers={\n \"Content-Type\":\"application/json\", \n \"Authorization\":\"Bearer <YOUR_AIMLAPI_KEY>\",\n },\n json={\n \"model\":\"alibaba/wan2.2-t2i-flash\",\n \"prompt\": \"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.\"\n }\n)\n\ndata = response.json()\nprint(data)"
179+
}
180+
]
181+
}
182+
}
183+
},
184+
"components": {
185+
"securitySchemes": {
186+
"access-token": {
187+
"scheme": "bearer",
188+
"bearerFormat": "<YOUR_AIMLAPI_KEY>",
189+
"type": "http",
190+
"description": "Bearer key"
191+
}
192+
}
193+
}
194+
}
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"title": "AIML API",
5+
"version": "1.0.0"
6+
},
7+
"servers": [
8+
{
9+
"url": "https://api.aimlapi.com"
10+
}
11+
],
12+
"paths": {
13+
"/v1/images/generations": {
14+
"post": {
15+
"operationId": "_v1_images_generations",
16+
"requestBody": {
17+
"required": true,
18+
"content": {
19+
"application/json": {
20+
"schema": {
21+
"type": "object",
22+
"properties": {
23+
"model": {
24+
"type": "string",
25+
"enum": [
26+
"alibaba/wan2.2-t2i-plus"
27+
]
28+
},
29+
"prompt": {
30+
"type": "string",
31+
"maxLength": 2000,
32+
"description": "The text prompt describing the content, style, or composition of the image to be generated."
33+
},
34+
"negative_prompt": {
35+
"type": "string",
36+
"maxLength": 500,
37+
"description": "The description of elements to avoid in the generated image."
38+
},
39+
"num_images": {
40+
"type": "integer",
41+
"minimum": 1,
42+
"maximum": 4,
43+
"default": 1,
44+
"description": "The number of images to generate."
45+
},
46+
"image_size": {
47+
"anyOf": [
48+
{
49+
"type": "object",
50+
"properties": {
51+
"width": {
52+
"type": "integer",
53+
"minimum": 512,
54+
"maximum": 1440
55+
},
56+
"height": {
57+
"type": "integer",
58+
"minimum": 512,
59+
"maximum": 1440
60+
}
61+
},
62+
"required": [
63+
"width",
64+
"height"
65+
],
66+
"description": "For both height and width, the value must be a multiple of 32."
67+
},
68+
{
69+
"type": "string",
70+
"enum": [
71+
"square_hd",
72+
"square",
73+
"portrait_4_3",
74+
"portrait_16_9",
75+
"landscape_4_3",
76+
"landscape_16_9"
77+
],
78+
"description": "The size of the generated image."
79+
}
80+
],
81+
"default": "landscape_4_3",
82+
"description": "The size of the generated image."
83+
},
84+
"enhance_prompt": {
85+
"type": "boolean",
86+
"default": true,
87+
"description": "Optional parameter to use an LLM-based prompt rewriting feature for higher-quality images that better match the original prompt. Disabling it may affect image quality and prompt alignment."
88+
},
89+
"watermark": {
90+
"type": "boolean",
91+
"default": false,
92+
"description": "Add an invisible watermark to the generated images."
93+
},
94+
"seed": {
95+
"type": "integer",
96+
"minimum": 0,
97+
"maximum": 2147483647,
98+
"description": "The same seed and the same prompt given to the same version of the model will output the same image every time."
99+
}
100+
},
101+
"required": [
102+
"model",
103+
"prompt"
104+
],
105+
"title": "alibaba/wan2.2-t2i-plus"
106+
}
107+
}
108+
}
109+
},
110+
"responses": {
111+
"200": {
112+
"content": {
113+
"application/json": {
114+
"schema": {
115+
"type": "object",
116+
"properties": {
117+
"data": {
118+
"type": "array",
119+
"nullable": true,
120+
"items": {
121+
"type": "object",
122+
"properties": {
123+
"url": {
124+
"type": "string",
125+
"nullable": true,
126+
"description": "The URL where the file can be downloaded from.",
127+
"example": "https://cdn.aimlapi.com/generations/hedgehog/1749730923700-29fe35d2-4aef-4bc5-a911-6c39884d16a8.png"
128+
},
129+
"b64_json": {
130+
"type": "string",
131+
"nullable": true,
132+
"description": "The base64-encoded JSON of the generated image.",
133+
"example": null
134+
}
135+
}
136+
},
137+
"description": "The list of generated images."
138+
},
139+
"meta": {
140+
"type": "object",
141+
"nullable": true,
142+
"properties": {
143+
"usage": {
144+
"type": "object",
145+
"nullable": true,
146+
"properties": {
147+
"credits_used": {
148+
"type": "number",
149+
"description": "The number of tokens consumed during generation.",
150+
"example": 120000
151+
}
152+
},
153+
"required": [
154+
"credits_used"
155+
]
156+
}
157+
},
158+
"description": "Additional details about the generation."
159+
}
160+
}
161+
}
162+
}
163+
}
164+
}
165+
},
166+
"x-hideTryItPanel": true,
167+
"x-codeSamples": [
168+
{
169+
"lang": "cURL",
170+
"source": "curl -L \\\n --request POST \\\n --url 'https://api.aimlapi.com/v1/images/generations' \\\n --header 'Authorization: Bearer <YOUR_AIMLAPI_KEY>' \\\n --header 'Content-Type: application/json' \\\n --data '{\n \"model\": \"alibaba/wan2.2-t2i-plus\",\n \"prompt\": \"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.\"\n }'"
171+
},
172+
{
173+
"lang": "JavaScript",
174+
"source": "async function main() {\n const response = await fetch('https://api.aimlapi.com/v1/images/generations', {\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n model: 'alibaba/wan2.2-t2i-plus',\n prompt: 'A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.',\n }),\n });\n\n const data = await response.json();\n console.log(JSON.stringify(data, null, 2));\n}\n\nmain();"
175+
},
176+
{
177+
"lang": "Python",
178+
"source": "import requests\n\nresponse = requests.post(\n \"https://api.aimlapi.com/v1/images/generations\",\n headers={\n \"Content-Type\":\"application/json\", \n \"Authorization\":\"Bearer <YOUR_AIMLAPI_KEY>\",\n },\n json={\n \"model\":\"alibaba/wan2.2-t2i-plus\",\n \"prompt\": \"A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.\"\n }\n)\n\ndata = response.json()\nprint(data)"
179+
}
180+
]
181+
}
182+
}
183+
},
184+
"components": {
185+
"securitySchemes": {
186+
"access-token": {
187+
"scheme": "bearer",
188+
"bearerFormat": "<YOUR_AIMLAPI_KEY>",
189+
"type": "http",
190+
"description": "Bearer key"
191+
}
192+
}
193+
}
194+
}

0 commit comments

Comments
 (0)