# Enqueue, capture the generation id.
GEN_ID=$(curl -s -X POST https://hub.oxen.ai/api/ai/queue \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OXEN_API_KEY" \
-d '{
"model": "qwen-image-2512",
"prompt": "A bald eagle sitting on a vast frozen lake, centered in the shot facing the camera. The eagle is in it'\''s natural habitat and being photographed from a medium distance. The background is a vast lake surrounded by a forest going up a hill. Photorealistic - it is high enough quality that it could be used for a National Geographic cover, but is just a stand alone photo without any graphics.",
"negative_prompt": " ",
"aspect_ratio": "16:9",
"image_size": "optimize_for_quality",
"num_inference_steps": 30,
"guidance": 3,
"output_format": "webp",
"output_quality": 80,
"disable_safety_checker": false
}' | jq -r '.generations[0].generation_id')
# Stream the SSE channel, grab the data line that follows a
# media_generation_completed event for our id, and pretty-print it.
curl -sN -H "Authorization: Bearer $OXEN_API_KEY" https://hub.oxen.ai/api/events \
| awk -v id="$GEN_ID" '
/^event: media_generation_completed$/ { expect=1; next }
/^data: / && expect {
payload = substr($0, 7)
if (index(payload, "\"generation_id\":\"" id "\"")) { print payload; exit }
expect = 0
}
' | jq .