POST /v1/images/generations コードをコピーcURL Python Node.js
TASK_ID=$(curl https://api.apiko.app/v1/images/generations \
-H "Authorization: Bearer $APIKO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5.5",
"prompt": "A white cat sits elegantly among bottles and glasses in a bar at night. Shoot from a low angle with a tilted composition, using flash, Fujifilm Provia colors and film grain. Capture dappled light, bright highlights and crisp detail for a vintage photographic feel.",
"size": "auto",
"resolution": "1K",
"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