Krea 3 API

Submit an edit of an input image, then poll the job until it finishes. The finished job's result.urls holds the output images.

thinking_mode accepts "fast" or "high". Fast is the default and recommended setting; High adds more planning for complex edits and takes longer.

No API key found in this link. Replace YOUR_API_KEY with your key.

export KREA_API_KEY='YOUR_API_KEY'

RESPONSE=$(curl -s -X POST https://api.krea.ai/generate/image/krea/krea-3 \
  -H "Authorization: Bearer $KREA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "turn this into a watercolor painting", "image_urls": ["https://www.krea.ai/ethereal-houses.jpg"], "thinking_mode": "fast", "resolution": "2k"}')
JOB_ID=$(echo "$RESPONSE" | jq -r '.job_id // empty')

if [ -z "$JOB_ID" ]; then echo "$RESPONSE"; else
  while true; do
    JOB=$(curl -s https://api.krea.ai/jobs/$JOB_ID -H "Authorization: Bearer $KREA_API_KEY")
    case "$(echo "$JOB" | jq -r '.status // empty')" in
      completed|failed|"") echo "$JOB" | jq; break ;;
    esac
    sleep 2
  done
fi