curl --max-time 900 -X POST "https://api.mosi.cn/v1/images/generations" \
-H "Authorization: Bearer $MOSS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "moss-image-base-1.0",
"prompt": "{\"summary\":{\"meta\":[\"poster\"],\"canvas\":\"single\",\"caption\":\"A minimalist travel poster with a cream background, a blue mountain illustration, and the title EXPLORE at the top.\"},\"items\":[{\"label\":\"text\",\"caption\":\"Large dark-blue uppercase title centered at the top.\",\"text\":\"EXPLORE\",\"bbox\":[-416,-384,-288,384]},{\"label\":\"object\",\"caption\":\"A flat blue mountain illustration in the lower center.\",\"bbox\":[-192,-288,384,288]}],\"bbox_coord_space\":\"abs_centralized\",\"bbox_format\":\"yxyx\"}",
"size": "1024x1024",
"n": 1,
"response_format": "url"
}'
import json
import os
import requests
layout = {
"summary": {
"meta": ["poster"],
"canvas": "single",
"caption": "A minimalist travel poster with a cream background, a blue mountain illustration, and the title EXPLORE at the top."
},
"items": [
{
"label": "text",
"caption": "Large dark-blue uppercase title centered at the top.",
"text": "EXPLORE",
"bbox": [-416, -384, -288, 384]
},
{
"label": "object",
"caption": "A flat blue mountain illustration in the lower center.",
"bbox": [-192, -288, 384, 288]
}
],
"bbox_coord_space": "abs_centralized",
"bbox_format": "yxyx"
}
response = requests.post(
"https://api.mosi.cn/v1/images/generations",
headers={
"Authorization": f"Bearer {os.environ['MOSS_API_KEY']}",
"Content-Type": "application/json",
},
timeout=900,
json={
"model": "moss-image-base-1.0",
"prompt": json.dumps(layout, ensure_ascii=False),
"size": "1024x1024",
"n": 1,
"response_format": "url",
},
)
response.raise_for_status()
print(response.json())
const layout = {
"summary": {
"meta": ["poster"],
"canvas": "single",
"caption": "A minimalist travel poster with a cream background, a blue mountain illustration, and the title EXPLORE at the top."
},
"items": [
{
"label": "text",
"caption": "Large dark-blue uppercase title centered at the top.",
"text": "EXPLORE",
"bbox": [-416, -384, -288, 384]
},
{
"label": "object",
"caption": "A flat blue mountain illustration in the lower center.",
"bbox": [-192, -288, 384, 288]
}
],
"bbox_coord_space": "abs_centralized",
"bbox_format": "yxyx"
}
const response = await fetch("https://api.mosi.cn/v1/images/generations", {
method: "POST",
signal: AbortSignal.timeout(900_000),
headers: {
"Authorization": "Bearer " + process.env.MOSS_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"model": "moss-image-base-1.0",
"prompt": JSON.stringify(layout),
"size": "1024x1024",
"n": 1,
"response_format": "url"
}),
})
if (!response.ok) throw new Error(`HTTP ${response.status}`)
console.log(await response.json())