Generate image
POST
/v1/images/generations
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.mirapi.ai/v1/images/generations"
payload := strings.NewReader("{ \"model\": \"qwen-image-plus\", \"input\": { \"messages\": [ { \"role\": \"user\", \"content\": [ { \"text\": \"An elegant, dignified Chinese couplet hangs in a hall with a quiet, classical Chinese interior; some blue-and-white porcelain sits on the table. The left scroll reads \\\"义本生知人机同道善思新\\\", the right scroll reads \\\"通云赋智乾坤启数高志远\\\", and the top banner reads \\\"智启通义\\\", in a flowing calligraphic hand. In the middle hangs a Chinese-style painting of Yueyang Tower.\" } ] } ] }, \"parameters\": { \"negative_prompt\": \"\", \"prompt_extend\": true, \"watermark\": false, \"size\": \"1328*1328\" } }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.mirapi.ai/v1/images/generations';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"model":"qwen-image-plus","input":{"messages":[{"role":"user","content":[{"text":"An elegant, dignified Chinese couplet hangs in a hall with a quiet, classical Chinese interior; some blue-and-white porcelain sits on the table. The left scroll reads \"义本生知人机同道善思新\", the right scroll reads \"通云赋智乾坤启数高志远\", and the top banner reads \"智启通义\", in a flowing calligraphic hand. In the middle hangs a Chinese-style painting of Yueyang Tower."}]}]},"parameters":{"negative_prompt":"","prompt_extend":true,"watermark":false,"size":"1328*1328"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.mirapi.ai/v1/images/generations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "qwen-image-plus", "input": { "messages": [ { "role": "user", "content": [ { "text": "An elegant, dignified Chinese couplet hangs in a hall with a quiet, classical Chinese interior; some blue-and-white porcelain sits on the table. The left scroll reads \"义本生知人机同道善思新\", the right scroll reads \"通云赋智乾坤启数高志远\", and the top banner reads \"智启通义\", in a flowing calligraphic hand. In the middle hangs a Chinese-style painting of Yueyang Tower." } ] } ] }, "parameters": { "negative_prompt": "", "prompt_extend": true, "watermark": false, "size": "1328*1328" } }'Bailian qwen-image series image generation
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Media typeapplication/json
object
model
required
string
input
required
object
messages
required
Array<object>
object
role
string
content
Array<object>
object
text
string
parameters
object
negative_prompt
string
prompt_extend
boolean
watermark
boolean
size
string
Example
{ "model": "qwen-image-plus", "input": { "messages": [ { "role": "user", "content": [ { "text": "An elegant, dignified Chinese couplet hangs in a hall with a quiet, classical Chinese interior; some blue-and-white porcelain sits on the table. The left scroll reads \"义本生知人机同道善思新\", the right scroll reads \"通云赋智乾坤启数高志远\", and the top banner reads \"智启通义\", in a flowing calligraphic hand. In the middle hangs a Chinese-style painting of Yueyang Tower." } ] } ] }, "parameters": { "negative_prompt": "", "prompt_extend": true, "watermark": false, "size": "1328*1328" }}Responses
Section titled “Responses”Image generated
Media typeapplication/json
object
created
integer
data
Array<object>
object
url
string
b64_json
string
revised_prompt
string
Examplegenerated
{ "created": 1, "data": [ { "url": "example", "b64_json": "example", "revised_prompt": "example" } ]}