404.aicu.ai
internal
A nicer 404.
This subdomain is not for end users — it's an API consumed by the
404.astro in every aicu.ai sub-section.
When a visitor hits a missing path on aicu.ai/game/dev/foo, the static 404 paints
immediately, then asynchronously fetches one short LLM-generated poem and a small image
gallery from here. If this service is down or slow, the 404 page is unaffected.
API
GET /api/decoration?path=/game/dev/foo&lang=ja
→ 200 application/json
{
"poem": "...two-line poem...",
"images": [
{ "src": "https://aicu.ai/images/games/oshi-cover.png",
"href": "https://aicu.ai/character",
"alt": "OSHI" },
...
],
"source": "ai" | "cache" | "fallback"
} Why this is low-risk
- · Only the request path is sent — no PII, no tokens
- · Poems cached 24h in KV by
(lang, path-hash) - · Static fallback if Workers AI fails or times out
- · Page renders without it — fully optional decoration
GA4 events emitted
- ·
decoration_loaded(source) - ·
decoration_failed(fetch error / timeout) - ·
404_image_clicked - ·
404_back_clicked
Lets us measure which decoration variants actually reduce bounce.