POST /v1/images/generations TASK_ID=$(curl https://api.apiko.app/v1/images/generations \
-H "Authorization: Bearer $APIKO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-5-0-pro",
"prompt": "A magazine-style urban cycling data infographic with three bar charts, a route map and the bilingual title \"Urban Cycling Report / 城市骑行报告\", modern layout, blue and orange palette.",
"size": "1:1",
"async": true
}' | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
while :; do
TASK=$(curl -s https://api.apiko.app/v1/tasks/$TASK_ID \
-H "Authorization: Bearer $APIKO_API_KEY")
printf '%s\n' "$TASK"
printf '%s' "$TASK" | grep -qE '"status": *"(completed|failed)"|"error": *\{' && break
sleep 5
done