Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

39.8 KB
Raw Blame

Text & Image to 3D (Forge)

This atlas entry traces the "Text/Image-to-3D (Forge)" cluster end-to-end from real source. Routes are resolved through vercel.json rewrites (not the default pages/<route>.html convention in every case).

Routing facts (from vercel.json):

  • /forge → pages/forge.html (loads src/forge.js + 29 sibling src/forge-*.js modules).
  • /image-to-3d → pages/forge.html (same app; lands with the photos tab preselected and its own document title; ?mode=image on any forge URL does the same).
  • /forge-max → pages/forge.html (same app; lands with the High tier pinned and "Forge Max" header copy; ?tier=draft|standard|high presets the selector on any forge URL).
  • /forge/share/<id> → api/forge-share.js (SSR page that bakes OG/Twitter/Farcaster preview meta plus a schema.org 3DModel JSON-LD node for crawlers (built by api/_lib/creation-jsonld.js: the GLB, a poster rendered by /api/render/glb, the creator, the date); stored preview-image URLs pass through normalizeStoredUrl() before they reach a browser, so a raw r2.dev URL never lands in the OG/Twitter/Farcaster tags, then JS-redirects browsers to /forge?share=<id>, which opens the creation in the viewer; a private or unknown id redirects to /forge instead).
  • /features/forge → pages/features/forge.html (static marketing landing, no app module).
  • /create/prompt → pages/create-prompt.html → src/create-prompt.js (text → rigged avatar, a different backend from Forge).
  • /tutorials/text-to-3d and /tutorials/image-to-3d → pages/tutorial.html (one shared template) which fetches /docs/tutorials/<slug>.md and renders it with marked.js. Read-only content pages.

Forge (Text / Photos / Sketch → 3D) at /forge

  • Source:
    • pages/forge.html (~4800 lines: full composer/stage markup + styles)
    • src/forge.js (~4400 lines: main controller, catalog, engine/tier selection, job submit, polling, result, gating; imports src/forge-timeline.js for the generation stage timeline and src/forge-compare.js for side-by-side compare)
    • src/forge-prompt-studio.js (Surprise-me + prompt coach; prompts come from the slot-grammar generator src/forge-prompt-gen.js), src/forge-enhance.js (AI prompt rewrite → /api/forge-enhance), src/forge-directed-prompt.js (reveals the server's art-director rewrite from the directed_prompt response field, with copy, "use as my prompt", and a one-click "Try a variation" that re-fires the generation on the unchanged brief, since the director and the reference painter are stochastic and resolve it differently each run)
    • src/forge-dropzone.js (paste/drop image handling), src/forge-reveal.js (WebGL "materialize" dissolve overlay), src/forge-wait.js (rotating craft tips while generating)
    • src/forge-refine.js (in-browser geometry refine, no API), src/forge-stylize.js (→ /api/forge-stylize), src/forge-optimize.js (→ /api/forge-remesh, and mounts the in-browser mesh tools from src/mesh-ops/), src/forge-gameready.js (→ /api/forge-gameready)
    • src/forge-rig.js (auto-rig → POST /api/forge?action=rig), src/forge-materials.js (PBR material restyle → POST /api/material-studio?action=restyle), src/forge-conversational-refine.js (free-text shape iteration → POST /api/forge-iterate), src/forge-more-like-this.js (one-tap material/finish variation chips), src/forge-segment.js
    • src/forge-export.js (the download format menu: in-browser OBJ/STL/PLY/USDZ export, GitHub README 3D copy, server-side FBX/3MF, and the slicer and Craftcloud print rows), src/forge-reel.js (client-side looping video + hero still + transparent-PNG cutout capture), src/forge-embed-panel.js, src/forge-ar.js, src/forge-showcase.js (community feed with upvotes)
    • src/forge-modly.js (the opt-in "Use your GPU" panel, transport in src/modly-local.js), src/forge-pay.js (pay-per-generation $THREE rail → src/token-pay.js → /api/token/quote|settle)
  • Entry point: Direct nav to /forge, /image-to-3d (photo tab preselected), or /forge-max (High tier pinned); CTAs from /features/forge ("Open Forge →"), the two tutorial pages, blog text-to-3d-is-live, gallery, and the /forge empty-state idle viewer. Also reachable as the "make an object/prop" alternative linked from /create/prompt.
  • Prerequisites / gates:
    • None for the default lane. Draft/Standard tiers on the free NVIDIA-hosted engine require no auth, no wallet, no payment ("No account required for your first model").
    • BYOK engines (Fast, Meshy, Tripo, Rodin, Stability, Replicate) require the user to paste their own provider API key (kept in-browser, sent as x-forge-provider-key header). Tripo is the exception: when the deployment sets TRIPO_API_KEY it is a house lane that needs no key from the user, and the result card and exported GLB name Tripo and its model version.
    • High quality tier is gated: it is a $THREE holder perk (hold-OR-pay). A holder clears it with a tier pass (attachTierPass); a non-holder gets a 402 three_hold_required and may pay-per-generation in $THREE via forge-pay.js, or hold $THREE. BYOK High is server-exempt (no pass needed). A server-side comp allowlist (api/_lib/comp-access.js, wired into requireFeatureAccess and GET /api/three/access) clears an allowlisted account through every $THREE gate (forge.high, forge.gameready, and any gate added later) with no holding, wallet, or payment.
    • Rate limiting applies on the paid lane (server-side, surfaced as a recoverable 429 state).
  • Steps (core text→3D path):
    1. User lands on /forge; forge.js fetches the engine/tier catalog (GET /api/forge?catalog=1) and live backend health (GET /api/forge?health=1), then builds the tier buttons (Draft/Standard/High) and the per-mode engine selector. The empty stage (#state-empty) shows an idle community/sample model.
    2. Mode tab defaults to Describe it (text). Tabs: Describe it, From photos, From a sketch (the sketch tab stays hidden until the catalog reports a live TripoSG sketch engine).
    3. (text) User types a prompt in #prompt (max 1000 chars). Live: a character counter, a prompt coach grading the prompt (tip/warn/strong, from forge-prompt-studio.js; its empty-prompt message is shipped inline in forge.html and marked data-no-i18n, because an empty span that filled in on boot wrapped onto its own line and pushed the tiles, composer and chips down 38px), and example chips with a "↻ More ideas" swap. The static chip labels in forge.html are written at the generator's 64-character cap ("a low-poly red fox sitting upright, matte fur, soft studio light", etc.) and carry no data-i18n; on every JS visit forge-prompt-studio.js swaps them for generated prompts (generateForgeChipSet) whose combined width never exceeds the labels they replace, so the flex-wrapped row cannot gain a line and shift the page.
    4. (optional) User clicks Surprise me to fill a random vivid prompt, or Enhance (injected by forge-enhance.js) to rewrite their text via POST /api/forge-enhance into a sharper single-subject FLUX→TRELLIS prompt.
    5. (optional) User picks a Quality tier (Draft / Standard / High). Selecting High while locked reveals the in-place lock panel + holder note linking to /three; a wallet-aware perk line / "Connect wallet" chip may appear under Generate.
    6. (optional) User picks an Engine. Engines are filtered by mode (text/photo/sketch input). BYOK engines show a key glyph; choosing one reveals the #byok-row API-key input with a provider-specific hint. Health-degraded engines show an amber dot; down/unconfigured ones show a red dot, are disabled, and carry the reason in the tooltip; a legend under the picker decodes both dots and the FREE/key pills.
    7. (optional) User sets the reference-image aspect ratio (1:1 / 4:3 / 3:4 / 16:9), shown only when relevant to the mode/engine. A live estimate line (#estimate) shows the catalog's real cost/time for the current tier+engine, and a quote line under it (#forge-quote, rendered by src/forge-keep.js from the public, no-spend GET /api/forge-quote) prices the generation for the current path, tier, engine and options from the same tier and pricing-catalog code the generator charges from.
    8. User clicks Generate (or ⌘/Ctrl+Enter). collectComposerCfg() validates (text ≥ 3 chars). If High is locked and submitted via keyboard, the gate/upsell opens instead of firing.
    9. startJob() POSTs to /api/forge with { prompt, aspect_ratio, path, tier, backend } plus headers (client id, BYOK key if any, $THREE tier pass if eligible/needed, minted/awaited before the request when highTierNeedsPass()). Stage switches to #state-generating.
    10. Generating state: a named stage timeline (#gen-stages, rendered by forge-timeline.js) animates; every row and state change is driven by a real /api/forge signal, so the lane decides which stages exist (a no-reference-image engine never shows one). Below it: an honest elapsed-vs-typical progress bar (asymptotic, never fakes 100%, recolors amber past the catalog ETA), a "feel free to leave this page" hint, and a Cancel button. When the API reports cold_start for a scale-to-zero self-hosted GPU lane, a "Waking up a GPU" warming card appears and is dismissed by the first real running poll, never by a timer (a keep-warm cron, /api/cron/gpu-keepwarm, holds allowlisted GPU workers open during peak hours; every routed scale-to-zero lane is registered there, including hunyuan3d, the High image tier's default engine and the fleet's longest spin-up at 75 s, though it stays off by default because the region's L4 grant is already spoken for). While waiting, forge-wait.js rotates curated craft tips. The reference image no longer waits for the job id: the page mints a trace id, sends it with the submit, and polls GET /api/forge?progress=<traceId> while its own POST is still open, so the director's rewrite, the reference view and the extra view count paint as the server passes each real milestone (api/_lib/forge-progress.js writes the crumbs). It is fail-open, with no timers and no guessed crumbs: without a trace id, or on a deployment that does not serve the channel, the submit response's own preview_image_url still paints the reference pane a moment later.
    11. If the engine is the synchronous free draft lane, the POST returns the finished glb_url directly; otherwise forge.js polls GET /api/forge?job=<id> every interval until status:"done" (with glb_url), failed, or timeout. The loop is built on src/shared/resilient-poll.js, so a backgrounded phone tab, a dropped radio, or the odd edge 502 is retried and woken on visibility rather than read as a dead job, with the give-up budget counted in attempts. A free-text NVIDIA job the lane never resolves gets one automatic resubmit, and a stall the cron observes cools that lane's circuit breaker so new free-text requests stop landing on it. When an async lane fails after accepting the job, the server's poll-time failover (api/_lib/forge-failover.js) continues it on the next configured lane under the same id and the generating panel says so (" hit a snag. Continuing on , no action needed."); TripoSG is the last photo rung, after every textured lane, and the note adds that it returns the shape without textures.
    12. On done: showResult() sets the <model-viewer src>, plays the WebGL materialize reveal (forge-reveal.js, skipped under reduced-motion), shows the result bar, wires the Download GLB anchor, and (if creation_id) shows a "Saved ✓" auto-save chip. Under prefers-reduced-motion the result viewer drops auto-rotate (camera controls stay, so the model is still fully inspectable by drag, pinch and arrow key), and the "Nice model. What now?" handoff card retracts on its own instead of sitting over the result bar's own next-step buttons. The result action row carries seventeen tools and wraps, so every one of them stays clickable at 320px. Geometry-first/sketch results with no reference image get a captured poster frame (POST /api/forge-poster).
    13. (optional) User rates the model: 👍 Keep / 👎 Discard (verdict) → POST /api/forge-feedback; or tags a category (Avatar/Creature/Item/Accessory/Scene/Vehicle) → POST /api/forge-categorize. A Making this for: chip row (Game / Web / Avatar / Simulation / Print / AR / Just playing, from src/shared/forge-destinations.js) asks once what the model is for: the answer is written onto the model on screen via POST /api/forge-feedback and remembered per browser, so every later generation sends it as destination. (Data flywheel.)
    14. (optional) Refine → : re-runs the exact same prompt/views one quality tier higher (re-enters step 9). Shown only when a higher tier exists and the job is re-runnable. Every user-initiated generation is stamped with a random seed that rides on the stored job, and Refine, Retry, "Generate anyway" and an automatic lane hop all replay it, so Refine returns this model at higher quality instead of a different object; only a fresh submit (and "Make another") mints a new seed.
    15. (optional) Refine panel (forge-refine.js), instant in-browser geometry passes (weld/smooth/relax/decimate/subdivide), non-destructive, no API call, no rate limit. Download the refined GLB.
    16. (optional) Iterate (forge-conversational-refine.js): a free-text instruction against the model on screen ("make the helmet red", "add a cape") via POST /api/forge-iterate (polled). The only post-result action that changes the model's shape from natural language; same core as the MCP refine_model tool.
    17. (optional) Stylize (forge-stylize.js): voxels/bricks/lattice/low-poly geometric filters via POST /api/forge-stylize (worker job, polled), with a resolution slider, download, and revert.
    18. (optional) Restyle materials (forge-materials.js): free-text or preset-chip PBR re-skin (chrome, brushed gold, weathered wood, ...) via synchronous POST /api/material-studio?action=restyle; geometry untouched. Same pipeline as the paid restyle_material MCP tool.
    19. (optional) Rig for animation (forge-rig.js): adds a humanoid skeleton + skin weights to the current GLB via POST /api/forge?action=rig (rigging runs on platform-paid capacity, so it is behind the same global hourly ceiling and per-client daily paid limit as the reconstruction lanes: a 429 with daily_limit_reached or an at-capacity message) (the self-hosted GCP model-rig worker, falling back to the configured Replicate rerig model), polled through the same GET /api/forge?job= contract.
    20. (optional) Optimize topology (forge-optimize.js): tri/quad/low-poly remesh via POST /api/forge-remesh (polled). Above the server remesh sit the in-browser mesh tools (src/mesh-ops/): repair, smooth and decimate run in a browser worker with undo, no upload.
    21. (optional) Game-Ready (forge-gameready.js): retopologize to a poly budget and export a textured GLB + FBX for Unity/Unreal via POST /api/forge-gameready (polled), with budget slider + wireframe preview. Gated on the same $THREE hold-or-pay model as High tier: the panel resolves the viewer's real entitlement first (a signed-in holding or a connected wallet, via getAccess/attachTierPass), a verified holder exports free, and a non-holder gets a server-quoted pay-per-export price in $THREE.
    22. (optional) Split into parts → links to /segment?mesh=<glb> (Parts Studio). Compose → /compose?glb=<glb> (Scene Composer / attach to avatar). Place IRL → /irl?avatar=<glb> (anchor the model in a real room).
    23. (optional) Export (forge-export.js): the download split-button's format menu carries GLB, OBJ, STL, PLY, USDZ, FBX, 3MF and GitHub README 3D (copies markup that GitHub renders as an interactive model; it works from the saved model URL, so an unsaved in-browser edit cannot use it). OBJ / STL / PLY / USDZ convert in the browser (lazy three.js exporters, no upload); FBX and 3MF have no browser exporter and are converted server-side by the remesh worker (POST /api/forge-remesh with operation:"convert"), which re-containers the mesh without touching geometry so a rigged model keeps its skeleton. A server format is a real polled job: it reports queued/converting, relays the converter's own reason on failure, and leaves a download-again link for a minute; starting a new generation retires a conversion still polling for the previous model. For a saved model the menu also offers Open in OrcaSlicer and Open in Bambu Studio (orcaslicer:// and bambustudio:// links to a sized STL served by /api/slicer; PrusaSlicer is download-only because it only accepts a fixed host allowlist) and Get it printed, live prices from Craftcloud's print network where the buyer pays Craftcloud directly (src/craftcloud-print.js). A footer credits meshoptimizer and glTF-Transform.
    24. (optional) Reel (forge-reel.js): fully client-side cinematic capture of the model into a looping video (MP4 or WebM), a hero still, and a transparent-PNG cutout; no upload, no worker.
    25. (optional) Embed (forge-embed-panel.js): generate an embeddable web-component snippet for the model.
    26. (optional) View in AR (forge-ar.js) / model-viewer's ar (webxr/scene-viewer/quick-look): place the model in the room. The AR panel also links to the multi-model AR Studio (/ar/studio?src=<glb>).
    27. (optional) Share → forge-share-btn: when the creation was persisted server-side it shares a real permalink, /forge/share/<id>, that unfurls with a preview card (an X player card pointing at /forge/embed for a finished creation, summary_large_image otherwise); otherwise it falls back to a remix link (/forge?prompt=). Cinema mode (fullscreen turntable for screen recording, F/Esc). More like this (forge-more-like-this.js): one-tap chips that re-run the same subject with a different material/finish via the forge:run-prompt event (text results only).
    28. User clicks Download GLB: first, for a saved creation, ensureKept() (src/forge-keep.js) asks GET /api/forge-keep?creation_id=<uuid> whether the original file may be released. Pay-to-keep is off unless the owner sets FORGE_PAY_TO_KEEP=on (npm run forge:pay-to-keep -- on|off|status); while off, every creation answers kept:true and Download behaves as it always did. When on, a $THREE holder keeps free, High is already paid or held at generation time, and everyone else pays the forge.keep.<tier> price once through the $THREE quote/sign/settle rail (POST /api/forge-keep, 402 three_hold_required with the price when unpaid); a refusal shows its message in the quote line and the download does not proceed, while a server fault fails open. Then the anchor fetches + "stamps" the GLB (#download[data-stamping]), reports downloaded:true feedback, and saves the file. OR clicks Make another to reset to the idle composer.
  • Photo / multi-view branch (steps 3-11 differ): "From photos" tab shows up to 6 view slots (Front/Back/Left/Right/Top/3-4) with a live "N of 6 views" counter + pips. Each photo is uploaded via presign POST /api/forge-upload → PUT to object storage; the public URL is recorded. Drag-to-reorder, paste (⌘V/Ctrl+V), drop, or click-to-browse (PNG/JPG/WebP, ≤8MB). An optional guidance prompt is allowed. Submit posts { image_urls, prompt?, ... }. A server-side vision pre-check can reject an unusable photo (422 image_not_usable) → recoverable "Generate anyway" override.
  • Use your GPU branch (photos tab, opt-in): the Use your GPU panel (forge-modly.js) probes a local Modly app on loopback only when the user presses Connect, never on page load. Its downloaded image-to-3D models join the engine picker badged "Your GPU, free"; the timeline shows Modly's real percent and step text, Cancel calls Modly's own cancel endpoint, and the finished GLB is copied to storage through /api/scene-glb-upload so rig, optimize, AR and embed get a public URL (a save row writes it to the avatar library via /api/avatars/from-forge). Not running, browser blocked (Chrome Local Network Access, Safari mixed content), no models and custom-port states are designed.
  • Sketch branch: "From a sketch" tab (only when a live sketch engine exists) takes one drawing + a required description; outputs untextured geometry (user is told to Stylize/Retexture after).
  • Decision points / branches:
    • Mode: text vs photos vs sketch (gates which engines/inputs are valid).
    • Tier: Draft/Standard (free) vs High ($THREE hold-or-pay or BYOK-exempt).
    • Engine: free NVIDIA lane vs BYOK engines (reveals key field; text-only engines disabled when photos are attached).
    • High gate resolution: hold $THREE (tier pass) → pay-per-generation ($THREE via forge-pay.js) → drop to Draft/Standard.
    • Sync draft (POST returns done) vs async poll loop.
    • Post-result fork: Refine-tier / Refine-local / Iterate / Stylize / Restyle-materials / Rig / Optimize / Game-Ready / Export / Reel / Embed / AR / Place-IRL / Share / More-like-this / Compose / Segment / Download / Make another.
    • Gallery: side-by-side Compare mode (forge-compare.js) when the same prompt was forged on 2+ engines; showcase cards are upvotable (auth-free, one vote per browser; the Forge-Off board) with a latest / top-this-week sort.
  • External calls / dependencies:
    • Catalog/health: GET /api/forge?catalog=1, GET /api/forge?health=1
    • Submit/poll: POST /api/forge, GET /api/forge?job=<id>
    • Uploads: POST /api/forge-upload (presign) + PUT object storage. The presign check is the only size gate at request time (the 8 MB image ceiling comes from ANON_UPLOAD_LIMITS['forge/uploads/'] in api/_lib/anon-upload-limits.js), so the hourly cron api/cron/anon-upload-sweep.js deletes anonymous objects that exceed their prefix ceiling after the fact. The presign handlers (forge-upload, scene-glb-upload) look the content type up with Object.hasOwn, so an inherited key such as constructor is a 400 invalid_content_type.
    • Cost preview and keep: GET /api/forge-quote (public, read-only, ?table=1 for all tiers); GET|POST /api/forge-keep (pay-to-keep, below)
    • Flywheel: POST /api/forge-feedback, POST /api/forge-categorize, POST /api/forge-poster
    • Galleries: GET /api/forge-gallery?limit=24 (your creations), GET /api/forge-gallery?scope=community&limit=24 (showcase, plus &sort= for the Forge-Off board), POST /api/forge-vote (showcase upvotes), GET /api/forge-creation?id= (share open); gallery and showcase card previews are requested through resizedImageUrl() (src/shared/image-url.js → /api/img), which asks for a 480px-wide server-resized WebP tile (20 to 40 KB) instead of the full-resolution render; same-origin, data: and blob: sources are passed through untouched. DELETE /api/forge-creation?id= (each "Your creations" card carries a two-tap arm-then-confirm delete, scoped to the owning x-forge-client; it erases the stored GLB, preview, and every recorded source photo upload, so an image-to-3D run's reference pictures leave object storage with it)
    • Post-processing jobs: POST /api/forge-stylize, POST /api/forge-remesh, POST /api/forge-gameready, POST /api/forge-enhance, POST /api/forge-iterate (all polled by ?job=); POST /api/forge?action=rig (auto-rig, polled by GET /api/forge?job=); POST /api/material-studio?action=restyle (synchronous)
    • Payment: forge-pay.js → src/token-pay.js → /api/token/quote + /api/token/settle ($THREE)
    • Access/tier pass: /api/three/access (read) + tier-pass mint (referenced via attachTierPass/getTierPass)
    • Generation engines: FLUX (image) → TRELLIS (mesh) free lane; BYOK Meshy / Tripo / Rodin / Stability / Replicate; Hunyuan3D / TripoSG (sketch). Hosted on NVIDIA NIM / providers; same pipeline exposed to agents over MCP at /api/mcp-3d.
    • Photoreal reference-image path (the realism lever): the final mesh reads as real only if the reference image the reconstructor sees is a photoreal, single-subject, plain-seamless-background, evenly-lit photograph. Two pieces drive that:
      • POST /api/forge-enhance (director): rewrites the raw prompt into one centered real-world subject with material + surface micro-detail + neutral studio-lighting cues. It classifies the subject (person / animal / vehicle / food / object) and returns a subject-aware negative_prompt targeting that class's failure modes (hands/faces for people, wheel-count/panel symmetry for vehicles, plastic-replica sheen for food). It prefers a Vertex Gemini rewrite (GCP credits) and falls through to the free-first LLM chain automatically, so it never hard-depends on Vertex. Response schema is unchanged apart from the additive subject field.
      • api/_lib/forge-reference-image.js → generateReferenceImage(directedPrompt, { aspectRatio, negativePrompt?, seed, skipNim }): generates the reconstruction reference image on the Vertex Gemini 2.5 Flash Image lane (imageConfig.imageSize:"2K"), tuned as a plain-background studio photo, with the director's negatives folded in as natural-language avoidance. Automatic fallthrough to the existing provider chain (textToImage: NIM FLUX free → Vertex Imagen → Replicate), returning { imageUrl, model, lane } (generated base64 output is persisted through the shared image-persist lib). The same directed prompt + aspect + negatives within 24h reuses its cached reference set instead of re-spending a Vertex generation. When negativePrompt is omitted it derives subject-aware negatives from the prompt itself, so a caller gets them for free. api/forge.js imports it on the text→3D path (dynamic import with textToImage as the fallback). The whole reference step (the Vertex lane, its QA score and corrective retry, and the fallthrough ladder) runs under one shared budget, TEXT_TO_IMAGE_BUDGET_MS (default 60 s), so a stalled image provider can no longer hold a submit open for minutes before a job exists. Separately from the client-side Enhance button, api/forge.js runs its own art-director rewrite on every text prompt by default (send director: false to skip it; it fails soft to the raw prompt).
    • 3rd-party viewer: model-viewer 4.4.0, loaded by src/shared/model-viewer-loader.js from the googleapis CDN with jsDelivr and unpkg as fallbacks.
  • Success state: A textured GLB standing in the in-page <model-viewer> (orbit/AR), auto-saved to "Your creations", with a downloadable file and all post-processing/export/embed/share actions enabled. Optional converted formats (OBJ/STL/PLY/USDZ/FBX) and a community showcase entry.
  • Empty / error states:
    • Empty/idle (#state-empty): isometric wireframe art + "Enter a prompt to generate", with a live sample/community model in the viewer.
    • Unconfigured (#state-unconfigured): only for the unconfigured error (no 3D engine reachable: none of NVIDIA_API_KEY, HF_TOKEN, or REPLICATE_API_TOKEN set); it names the env vars to set and offers no retry.
    • Generation failed (#state-error): generic failure with "Try again", plus contextual recovery buttons: "Refine current model instead" (rate-limited fallback), "Generate anyway" (vision override).
    • BYOK errors: needs_key / invalid_key reveal + focus the key field; insufficient_credits explains provider is out of credits.
    • 429/limiter-unavailable, and any other 503 (generation_unavailable: a worker still warming or a free lane that shed the request): the recoverable countdown state carrying the server's own message and retry_after (20 s when absent) + local-refine escape hatch.
    • Explicitly picked free engine unavailable (503 provider_busy, e.g. the Hugging Face lane, which pauses for 300 s after a chain-wide Space failure and reads as down in ?health=1 so the picker disables it): when the response names retry_backends, the page hops once automatically to the first one (the picker flips and the panel says " hit a snag. Retrying on "), and if that hop fails too it shows one-click engine switches; without suggestions it falls back to the recoverable countdown.
    • High gate 402 three_hold_required: designed upsell (held vs required, Get $THREE, Pay-per-use).
    • Payment errors: payment_invalid / payment_expired re-offer Pay; payment_already_used clears the stale proof; a settle call that cannot be reached after the $THREE transfer already confirmed surfaces settle_unreachable with the transaction signature, so the payment is reconciled rather than sent twice.
    • Upload errors: per-slot states (503 uploads unavailable, 429 rate-limited, too-large/empty/wrong-type, network). POST /api/forge-upload now asks whether storage will accept the bytes (objectStorageUsable(), a cached signed one-key list) rather than whether the credential vars merely exist, so a rotated or whitespace-only R2 token answers 503 storage_unavailable (or 503 unconfigured, which falls the page back to accepting a public image URL) instead of handing out a signed URL whose CORS-less 403 SignatureDoesNotMatch the browser could only report as "Network error during upload".
    • Viewer load failure: #viewer-load-error overlay → "use the download button to save the file directly".
  • Step count: ~12 required (text path, entry → download) + ~16 optional (surprise/enhance, tier/engine/aspect choices, refine-tier, refine-local, iterate, stylize, restyle-materials, rig, optimize, game-ready, export, reel, embed, AR, share/cinema/compare/compose/segment/verdict/category).

Forge marketing landing at /features/forge

  • Source: pages/features/forge.html (static; no app JS module, only nav/footer + an inline FAQ accordion script and model-viewer for the hero sample). Stylesheets: features-landing.css.
  • Entry point: /features index, SEO/search, social cards.
  • Prerequisites / gates: None, read-only marketing page.
  • Steps (3):
    1. User reads the hero ("Type a description. Get a 3D model.", Flux + TRELLIS) and orbits the sample GLB (/animations/robotexpressive.glb) in the hero model-viewer.
    2. User reads the "Three steps from prompt to model" how-it-works, the highlight cards (AR inspection, agent avatar, shareable link, data flywheel), and expands FAQ items (inline aria-expanded toggle script).
    3. User clicks Open Forge → (to /forge) or Try Scan instead (/features/scan).
  • Decision points / branches: Open Forge vs Try Scan vs All features; FAQ expand/collapse.
  • External calls / dependencies: model-viewer CDN only. No API calls. (FAQ schema mentions Flux + TRELLIS; advertises GLB output and commercial-use rights.)
  • Success state: User navigates into /forge.
  • Empty / error states: None (static content). FAQ items collapsed by default.
  • Step count: 3 required (read + click through) + 0 optional (FAQ expansion is incidental).

Describe it to 3D (prompt → rigged avatar) at /create/prompt

  • Source: pages/create-prompt.html + src/create-prompt.js. The page has a real light theme (:root[data-theme='light']) with AA-contrast secondary copy in both themes. Overlap note: this is the onboarding/avatar-creation cluster, not Forge. It shares the same conceptual "type a prompt → 3D" pattern but uses an entirely different backend: the selfie/avatar reconstruction + auto-rig pipeline, not the Forge engine catalog. It explicitly cross-links to /forge for "making an object, prop, or scene piece instead of a character." Entry points include /create, /create-agent, dashboard avatars/agents pages, and the gallery.
  • Entry point: From /create (and create.js), the create-agent flow, dashboard, and gallery "make one" CTAs.
  • Prerequisites / gates: Sign-in required ("Sign-in required" chip). A 401 on submit or poll redirects to /login?next=/create/prompt?prompt=<typed prompt>, so the words already typed come back with the user. No wallet / no $THREE gate. Avatars default to private visibility.
  • Steps (3 stages):
    1. Compose: User types a single-subject character description in #prompt (max 600; counter; Generate disabled under 3 chars). Optional example chips fill the box. A ?prompt= query param pre-fills the composer (remix/copy-prompt deep links; nothing auto-submits). Hint: "Single subject, full body works best." Cross-link offered to /forge for objects.
    2. User clicks Generate avatar (or ⌘/Ctrl+Enter). start() POSTs /api/avatars/reconstruct { name (derived from prompt), prompt, visibility:'private' }. UI switches to the Building stage (spinning orb).
    3. Building: Live phased progress, Rendering a reference image… (Flux) → Reconstructing it into 3D… → Adding a skeleton so it can move…, with an elapsed clock. Polls GET /api/avatars/regenerate-status?jobId= every 3s (up to 8 min).
    4. Done: On status:"done" + resultAvatarId, fetches GET /api/avatars/<id>, previews the rigged GLB in the done model-viewer, shows tags (Animation-ready / Static mesh, riggable / Private to you). CTAs: Open in editor (/avatars/<id>/edit) and Make another. If no model URL yet, it redirects straight to the editor.
  • Decision points / branches: Signed-in vs not (login redirect); rigged vs static-mesh tag; open editor vs make another; (offered) divert to /forge for non-characters.
  • External calls / dependencies: POST /api/avatars/reconstruct, GET /api/avatars/regenerate-status?jobId=, GET /api/avatars/<id>. Flux text→image + reconstruct + auto-rig backend (shared with the selfie pipeline). model-viewer CDN. Dispatches tws:feature-done for the site discovery layer.
  • Success state: A rigged GLB avatar saved to the user's account, previewed, ready to open in the avatar editor.
  • Empty / error states: Compose inline error ("Add a few words…"). Build error box with friendly mappings: rate-limited (txt2img_rate_limited/429), unconfigured (regen_unconfigured/txt2img_unconfigured → suggests /create/selfie), provider billing, unreachable, render error, no-face-detected, NSFW-blocked, timeout, OOM; plus a "Back" recovery button. Each failure carries a retryable flag that decides which recovery buttons render: a full avatar library (402/plan_limit, also detected when a job loses the race mid-build) drops "Try again" and links to /dashboard (delete one) and /pricing (upgrade); an unconfigured engine drops it too; a 429 quotes the server's Retry-After and holds the retry button for exactly that long. On failure the orb, progress bar and phase line freeze and Cancel goes away; the error box (role="alert") is the only live control. Cancel stays live for the whole building step, and every run holds a monotonic token so a cancelled build can never paint its late result over a newer one. Poll timeout message points the user to their dashboard.
  • Step count: 3 required (compose → generate → done) + 1 optional (pick an example chip), excludes downstream editor actions.

Tutorial: Text Prompt to 3D Model at /tutorials/text-to-3d

  • Source: pages/tutorial.html (shared template, renders any /tutorials/<slug>) + content docs/tutorials/text-to-3d.md. Slug resolved client-side, markdown fetched from /docs/tutorials/text-to-3d.md, rendered with marked.js + highlight.js. The server no longer ships that shell empty: server/crawler-body.mjs renders the same markdown into the response body (leading title stripped, since the hero already owns the h1), and the client replaces the root wholesale on load, so a crawler that never runs the fetch still reads the whole tutorial instead of the shell's "Tutorial not found" fallback. Metadata/preview model come from /tutorials-manifest.js (window.TUTORIALS). The template also loads /live-steps.js (runnable ```live blocks: real API calls rendered inline) and /tutorial-figures.js (resolves figure: directives in the markdown into captured media, live 3D viewers, and a keyboard-navigable lightbox). Relative links in the markdown resolve against docs/tutorials/<slug>.md: sibling tutorials go to /tutorials/<slug>, other docs to /docs/<name> (with #section preserved), and repo-only docs (docs/internal, docs/ops, docs/security) or cited source files open on GitHub.
  • Entry point: /tutorials index, /docs, in-Forge "/docs" hint, blog, search, and cross-links from the image-to-3d and prompts-for-3d tutorials.
  • Prerequisites / gates: None, read-only content page. (The tutorial itself states: "no account, no wallet, no code.")
  • Steps (read-only content page):
    1. Read intro + hero; orbit the interactive preview model (<model-viewer> injected from the manifest's previewModel).
    2. Read the 6 tutorial steps: Step 1 Open the Forge → Step 2 Describe the object → Step 3 Pick a quality tier → Step 4 Generate → Step 5 Inspect your model → Step 6 Download or share it; plus "Didn't get what you wanted?" troubleshooting and "What's next".
    3. (optional) Use the auto-generated heading anchors / table of contents; follow inline links to /forge, /tutorials/image-to-3d, /tutorials/prompts-for-3d.
    4. (optional) Use the prev/next pager (built from window.TUTORIALS) to move between tutorials.
  • Decision points / branches: Navigate to /forge to actually do it, or to adjacent tutorials via inline links / pager.
  • External calls / dependencies: GET /docs/tutorials/text-to-3d.md; marked.js + highlight.js CDNs; model-viewer CDN; /tutorials-manifest.js; /api/page-og (OG image only).
  • Success state: User understands the text→3D flow (content consumed); typically clicks through to /forge.
  • Empty / error states: Template handles a missing/invalid slug (no entry → redirect/empty handling in tutorial.html); a failed markdown fetch leaves the article empty. No interactive failure modes.
  • Step count: 2 required (read content + follow the embedded steps) + 2 optional (TOC anchors, prev/next pager / cross-links). Content covers 6 in-doc instructional steps.

Tutorial: Photos to 3D Model at /tutorials/image-to-3d

  • Source: pages/tutorial.html (same shared template) + content docs/tutorials/image-to-3d.md, fetched from /docs/tutorials/image-to-3d.md.
  • Entry point: /tutorials index, the text-to-3d tutorial's "What's next", Forge photo-mode help, search.
  • Prerequisites / gates: None, read-only content page ("A phone camera is plenty.").
  • Steps (read-only content page):
    1. Read intro + orbit the manifest preview model.
    2. Read the 5 tutorial steps: Step 1 Take good photos (1 object, plain bg, even light, fill frame, 4 angles) → Step 2 Open the Forge in photo mode → Step 3 Add guidance (optional) → Step 4 Pick a tier and generate → Step 5 Inspect, download, share; plus Troubleshooting and "What's next".
    3. (optional) Follow inline links to /forge and adjacent tutorials; use the pager.
  • Decision points / branches: Go to /forge (From photos tab) to execute; navigate to adjacent tutorials.
  • External calls / dependencies: GET /docs/tutorials/image-to-3d.md; marked.js + highlight.js + model-viewer CDNs; /tutorials-manifest.js; /api/page-og.
  • Success state: User understands the photo/multi-view→3D flow; clicks through to /forge photo mode.
  • Empty / error states: Same template-level handling as the text-to-3d tutorial (missing slug, failed md fetch). No interactive failure modes.
  • Step count: 2 required (read + follow embedded steps) + 2 optional (anchors, pager / cross-links). Content covers 5 in-doc instructional steps.

Notes

  • All five routes' sources were located and traced from real code. No missing sources.
  • /create/prompt is included here because it overlaps the "type a prompt → 3D" pattern, but it belongs to the onboarding/avatar cluster and uses the avatar reconstruct + auto-rig backend (/api/avatars/*), distinct from Forge's /api/forge engine catalog. It is the one route in this cluster that is auth-gated.
  • /features/forge is pure marketing (no app module); the two tutorials are read-only markdown rendered by one shared tutorial.html template.