Simple personal website, built with the vanilla-ts vite starter. Design is heavily inspired by paco.me.
The gallery export script syncs the Gallery folder from the Krea web app and writes the result to src/assets/gallery.json.
The script keeps the frontend contract unchanged and combines three Krea endpoints:
/api/assets/foldersfor the ordered asset IDs in theGalleryfolder./api/assetsfor image URLs and dimensions./api/assets/metadatafor prompts and provider metadata.
If Krea does not return a title for an asset, the script generates one with gpt-5-mini using metadata text only. The prompt is primed with real titles that already exist in the gallery, and generated titles are cached so reruns do not spend tokens again unless the metadata changes.
Auth uses your browser cookie, not a Krea API token.
Set these values in .env when you need them:
OPENAI_API_KEY=your_openai_key
KREA_WEB_COOKIE="cookie=value; ..."The easiest flow on macOS is:
- Open
https://www.krea.ai/assets. - In DevTools, copy any
/api/assets,/api/assets/metadata, or/api/assets/foldersrequest as cURL. - Run
bun run gallery. - If
KREA_WEB_COOKIEis not already set, the script will try to extract the cookie from your clipboard and offer to save it to.env.
You can also pass auth explicitly:
bun run gallery --curl "$(pbpaste)"
KREA_WEB_COOKIE="cookie=value; ..." bun run galleryUse --refresh to ignore the cached Krea page responses and refetch the data needed for the current Gallery folder.
bun run gallery --refreshTo keep a custom gallery order without hand-maintaining a separate config, edit src/assets/gallery.json directly while previewing the site, then persist that order for future syncs:
bun run gallery --persist-orderThat command snapshots the current item order from src/assets/gallery.json into src/assets/gallery-order.json. Future bun run gallery executions apply that saved order first and then append any brand new Krea assets after it.
The script caches raw Krea responses and normalized indexes under .cache/krea-gallery/, stores AI titles per workspace in .cache/krea-gallery/<workspace>/ai-titles.json, and keeps the thumbhash cache in .cache/thumbhash-cache.json so reruns only generate missing work.