@skyphusion/create-prism 0.1.0 → 0.175.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +5 -3
  2. package/index.js +4 -2
  3. package/package.json +1 -1
  4. package/template/CONTRIBUTING.md +6 -2
  5. package/template/README.md +45 -33
  6. package/template/docs/legal/README.md +1 -0
  7. package/template/migrations/0002_auth_public_mode.sql +32 -0
  8. package/template/package.json +6 -6
  9. package/template/public/app.js +44 -16
  10. package/template/public/index.html +47 -4
  11. package/template/src/auth-kdf.ts +7 -4
  12. package/template/src/auth.ts +11 -2
  13. package/template/src/control-plane.ts +254 -0
  14. package/template/src/env.ts +15 -0
  15. package/template/src/gateway-credentials.ts +23 -4
  16. package/template/src/health-schema.ts +4 -0
  17. package/template/src/index.ts +65 -3982
  18. package/template/src/longrun-params.ts +4 -2
  19. package/template/src/models.ts +65 -19
  20. package/template/src/output-extract.ts +58 -8
  21. package/template/src/parsers/openai-sse.ts +43 -14
  22. package/template/src/providers/anthropic.ts +105 -0
  23. package/template/src/providers/openai-image.ts +66 -0
  24. package/template/src/providers/openai.ts +79 -13
  25. package/template/src/providers/xai.ts +91 -0
  26. package/template/src/proxied-image-params.ts +29 -16
  27. package/template/src/routes/artifacts.ts +51 -0
  28. package/template/src/routes/chat.ts +1709 -0
  29. package/template/src/routes/conversations.ts +212 -0
  30. package/template/src/routes/documents.ts +262 -0
  31. package/template/src/routes/health.ts +105 -0
  32. package/template/src/routes/history.ts +92 -0
  33. package/template/src/routes/prefs.ts +95 -0
  34. package/template/src/routes/projects.ts +574 -0
  35. package/template/src/routes/rag.ts +657 -0
  36. package/template/src/routes/shared.ts +226 -0
  37. package/template/src/routes/workflow.ts +304 -0
  38. package/template/src/user-prefs.ts +10 -0
  39. package/template/src/zip.ts +7 -0
  40. package/template/tests/anthropic-binding.test.ts +181 -0
  41. package/template/tests/control-plane.test.ts +112 -0
  42. package/template/tests/gateway-credentials.test.ts +37 -0
  43. package/template/tests/longrun-params.test.ts +19 -0
  44. package/template/tests/openai-image.test.ts +47 -0
  45. package/template/tests/openai-responses.test.ts +78 -0
  46. package/template/tests/openai-sse.test.ts +28 -0
  47. package/template/tests/output-extract.test.ts +75 -1
  48. package/template/tests/proxied-image-params.test.ts +16 -7
  49. package/template/tests/sprint1-catalog.test.ts +27 -0
  50. package/template/tests/sprint2-catalog.test.ts +51 -0
  51. package/template/tests/sprint3-catalog.test.ts +29 -0
  52. package/template/tests/xai-binding.test.ts +127 -0
  53. package/template/tests-integration/worker.test.ts +9 -2
  54. package/template/wrangler.example.toml +19 -7
package/README.md CHANGED
@@ -42,9 +42,11 @@ TypeScript.
42
42
 
43
43
  ## Cloudflare resources you provide
44
44
 
45
- Everything bills through **Cloudflare Unified Billing** on your own AI Gateway; there
46
- is no deployer BYOK key. Create these once and wire their ids into `wrangler.toml`
47
- (the scaffolder prints the exact commands):
45
+ Everything bills through **Cloudflare Unified Billing** on your own AI Gateway.
46
+ Optional: set `OPENAI_API_KEY` only if you want transparent `gpt-image-*` PNGs
47
+ (v0.174.0 carve-out; leave unset for fully keyless deploys). Create the resources
48
+ below once and wire their ids into `wrangler.toml` (the scaffolder prints the
49
+ exact commands):
48
50
 
49
51
  **Required bindings**
50
52
 
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // @skyphusion/create-prism (v0.168.0 release train; package v0.1.0)
2
+ // @skyphusion/create-prism (package version tracks root prism release train)
3
3
  // Scaffold a new prism deployment: a multimodal AI playground on one Cloudflare
4
4
  // Worker. Single file, zero runtime dependencies, Node >= 20.
5
5
  //
@@ -20,7 +20,9 @@ import { basename, dirname, join, resolve } from "node:path";
20
20
 
21
21
  const HERE = dirname(fileURLToPath(import.meta.url));
22
22
  const TEMPLATE_DIR = join(HERE, "template");
23
- const PKG_VERSION = "0.1.0";
23
+ // Keep in lockstep with packages/create-prism/package.json (publish-npm requires
24
+ // GitHub Release tag vX.Y.Z == this version). Read at runtime so they cannot drift.
25
+ const PKG_VERSION = JSON.parse(readFileSync(join(HERE, "package.json"), "utf8")).version;
24
26
 
25
27
  const EXIT = {
26
28
  OK: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyphusion/create-prism",
3
- "version": "0.1.0",
3
+ "version": "0.175.6",
4
4
  "description": "Scaffold a new prism deployment: a multimodal AI playground on Cloudflare Workers.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "author": "Conrad Rockenhaus",
@@ -8,7 +8,7 @@ This project is maintained as time allows. Response times on issues and PRs may
8
8
 
9
9
  ## Scope
10
10
 
11
- The project is a template for the Cloudflare AI stack: a single Worker that ties together Workers AI, AI Gateway, D1, R2, Vectorize, Workflows, and Cloudflare Access. Modalities covered: chat (text and vision), image generation, TTS, STT, video generation, music generation, and RAG over uploaded files. Paid third-party models run on **Cloudflare Unified Billing**; there is no deployer BYOK path (the last one, `OPENAI_API_KEY` for `gpt-image-1.5` transparent PNGs, was retired in v0.166.0 under prism#93).
11
+ The project is a template for the Cloudflare AI stack: a single Worker that ties together Workers AI, AI Gateway, D1, R2, Vectorize, Workflows, and Cloudflare Access. Modalities covered: chat (text and vision), image generation, TTS, STT, video generation, music generation, and RAG over uploaded files. Paid third-party models run on **Cloudflare Unified Billing**. The sole deployer-key exception is optional `OPENAI_API_KEY` for transparent `openai/gpt-image-*` PNG (v0.174.0); everything else stays keyless on Unified Billing.
12
12
 
13
13
  PRs that fit:
14
14
 
@@ -38,7 +38,11 @@ When adding a new third-party model that isn't already in the catalog, prefer th
38
38
  - It uses Cloudflare's AI Gateway natively, so observability, caching, and rate limiting come free.
39
39
  - It is less code on our side: no per-provider dispatch helper, no transform between our internal `messages` shape and the provider's format (when the binding handles it).
40
40
 
41
- Do not add a deployer BYOK path. Per prism#93 (2026-07-18), prism stays on the unified Cloudflare Workers AI / AI Gateway (Unified Billing) plane; new inference paths must be Unified-Billing-reachable. The former `OPENAI_API_KEY` transparent-PNG exception was retired in v0.166.0, so `gpt-image-*` now render opaque through the proxy like every other proxied image model.
41
+ Stay on Cloudflare Workers AI / AI Gateway (Unified Billing) for inference.
42
+ **Sole deployer-key exception (v0.174.0):** optional `OPENAI_API_KEY` for
43
+ `openai/gpt-image-*` transparent PNG only (the CF proxy rejects
44
+ `background`/`output_format`). No other provider may grow a deployer BYOK path;
45
+ if Unified Billing cannot do it, park the feature rather than minting a new key.
42
46
 
43
47
  ## Long-running operations
44
48
 
@@ -2,23 +2,23 @@
2
2
 
3
3
  [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](LICENSE)
4
4
  [![Typecheck](https://github.com/skyphusion-labs/prism/actions/workflows/typecheck.yml/badge.svg)](https://github.com/skyphusion-labs/prism/actions/workflows/typecheck.yml)
5
- [![Voice chat](https://img.shields.io/badge/%F0%9F%8E%99%EF%B8%8F_voice_chat-speak_%26_hear_36_chat_models-6d8cff)](#voice-chat)
5
+ [![Voice chat](https://img.shields.io/badge/%F0%9F%8E%99%EF%B8%8F_voice_chat-speak_%26_hear_chat_models-6d8cff)](#voice-chat)
6
6
 
7
- A multimodal AI playground deployed as a single Cloudflare Worker. **Live demo:** https://play.skyphusion.org (free signup, bring your own AI Gateway). 36 chat models across 5 providers, **hands-free voice chat** (talk to any model and hear it reply), image / TTS / STT / video / music generation, cross-model artifact reuse within a conversation (v0.21.7), RAG over files of any type (v0.23.0), projects that scope a knowledge base and system prompt, Discord chat-log ingestion, opt-in web search via self-hosted SearXNG and Wikipedia, SSE streaming on supported chat models, and multi-turn conversations. One web UI with first-party accounts, per-user history, R2 for all binary artifacts.
7
+ A multimodal AI playground deployed as a single Cloudflare Worker. **Live demo:** https://play.skyphusion.org (free signup, bring your own AI Gateway). **~45 chat models** across Workers AI, Anthropic, xAI, OpenAI, Google, and Moonshot (see `GET /api/models`), **hands-free voice chat** (talk to any chat model and hear it reply), image / TTS / STT / video / music generation, cross-model artifact reuse within a conversation (v0.21.7), RAG over files of any type (v0.23.0), projects that scope a knowledge base and system prompt, Discord chat-log ingestion, opt-in web search via self-hosted SearXNG and Wikipedia, SSE streaming on supported chat models, and multi-turn conversations. One web UI with first-party accounts, per-user history, R2 for all binary artifacts.
8
8
 
9
9
  <p align="center">
10
10
  <img src="docs/screenshot-desktop.jpg" alt="Desktop UI: image generation with Nano Banana Pro" width="800"><br><br>
11
11
  <img src="docs/screenshot-mobile.jpg" alt="Mobile UI: image generation with Nano Banana Pro" width="280">
12
12
  </p>
13
13
 
14
- > ### 🎙️ Speak to 36 AI models, and hear all 36 talk back
15
- > Not one voice assistant, **all 36 chat models**, by voice. Pick any model on the
16
- > list, tap the mic, and have a real spoken conversation: your speech is
17
- > transcribed by Deepgram Flux, sent to the model through the normal chat path,
18
- > and the reply is **spoken back** with Aura-2 TTS, hands-free. End to end on
19
- > Cloudflare, no third-party STT/TTS services. Every model on the list, from
20
- > Claude Opus to Llama to Grok to Gemini to GPT, answers out loud, and the
21
- > conversation saves to history like any other chat. See [Voice chat](#voice-chat).
14
+ > ### 🎙️ Speak to the chat catalog, and hear it talk back
15
+ > Not one voice assistant: **any chat model in the picker**, by voice. Pick a
16
+ > model, tap the mic, and have a real spoken conversation: your speech is
17
+ > transcribed by Deepgram Flux, sent through the normal chat path, and the reply
18
+ > is **spoken back** with Aura-2 TTS, hands-free. End to end on Cloudflare, no
19
+ > third-party STT/TTS services. Claude, Llama, Grok, Gemini, GPT, Kimi, and the
20
+ > rest answer out loud; conversations save to history like any other chat. See
21
+ > [Voice chat](#voice-chat).
22
22
 
23
23
  ## What this is
24
24
 
@@ -29,27 +29,28 @@ A working template for the Cloudflare AI stack and a self-hosted multimodal play
29
29
  One Worker, no framework, no build step beyond TypeScript. The interesting parts are the patterns, not the model count:
30
30
 
31
31
  - **Unified `env.AI.run()` binding** drives every modality through one call surface: chat, vision input, image gen, TTS, STT, conversational STT + voice chat (Flux over a WebSocket), video gen, and music gen. Paid third-party models bill through **Cloudflare Unified Billing** on your AI Gateway.
32
- - **Per-provider dispatch helpers** for Anthropic Claude, xAI Grok, and Google Gemini, each transforming our internal `messages` shape into the provider's native format while authorizing keylessly via `cf-aig-authorization`. OpenAI chat and Workers AI ride the `env.AI.run` binding directly. There is no deployer BYOK path: the last one, an optional `OPENAI_API_KEY` for `gpt-image-1.5` transparent PNGs, was retired in v0.166.0 (prism#93), so `gpt-image-*` render opaque through the Unified Billing proxy.
33
- - **SSE streaming** (v0.13.0+) for chat models on all five providers: Anthropic native SSE, Workers AI OpenAI-compatible SSE, xAI OpenAI-compatible SSE, OpenAI proxied (binding-based, v0.21.1), and Gemini (binding-based, v0.21.4).
32
+ - **Per-provider dispatch helpers** for Anthropic Claude, xAI Grok, and Google Gemini, each transforming our internal `messages` shape into the provider's native format while authorizing keylessly via `cf-aig-authorization`. OpenAI chat and Workers AI ride the `env.AI.run` binding directly. **Sole deployer BYOK carve-out (v0.174.0):** optional `OPENAI_API_KEY` lets `openai/gpt-image-*` call `api.openai.com` for transparent PNG (the CF proxy 7003-rejects `background`/`output_format`). When unset, those models stay opaque on Unified Billing. Do not set this key on public multi-tenant deploys.
33
+ - **SSE streaming** (v0.13.0+) for chat models across providers: Anthropic native SSE, Workers AI / OpenAI-compatible SSE (incl. Moonshot K3), xAI, OpenAI Chat Completions and Responses API (v0.173.0), and Gemini.
34
34
  - **AI Gateway** wraps every call for observability, caching, and rate-limiting.
35
35
  - **D1** holds chat metadata, multi-turn conversation history, and RAG chunk text. **R2** holds all binary artifacts. **Vectorize** holds RAG embeddings (768-dim BGE-base). The chat row references R2 keys; nothing binary touches D1.
36
36
  - **Cloudflare Workflows** owns long-running Unified Billing video and music generation (30s to 3min jobs). The `LongRunWorkflow` class holds the blocking `env.AI.run` call alive across step boundaries that `ctx.waitUntil` cannot.
37
37
  - **Two auth modes, one identity seam.** An `AUTH_MODE` setting picks how the worker learns who you are: **public** mode (the hosted product) runs first-party username/password accounts behind an opaque server-side session cookie, while **access** mode (the default, for private self-host) trusts Cloudflare Access's `Cf-Access-Authenticated-User-Email`. Either way a single stable, opaque account id scopes history and R2 ownership (`customMetadata.user_email`), so cross-user access is impossible even if a UUID is guessed.
38
38
  - **Client-side video keyframe extraction** sends 8 evenly-spaced frames to vision-capable chat models instead of uploading the full video file.
39
- - **Searchable model picker** (v0.111.0) groups the ~80 catalog entries across 7 modalities with capability badges (vision, stream) inline; type to filter by name.
39
+ - **Searchable model picker** (v0.111.0) groups the live catalog (~94 entries across 7 modalities as of v0.174.3) with capability badges (vision, stream) inline; type to filter by name.
40
40
 
41
41
  ## Features
42
42
 
43
- **Chat (36 models across 5 providers; 35 of 36 stream-capable):**
43
+ **Chat (see `GET /api/models` / `src/models.ts` for the live list):**
44
44
  - Workers AI: Llama 4 Scout, Llama 3.x family, Qwen3 30B / QwQ 32B / Qwen2.5 Coder 32B, DeepSeek R1, Mistral Small 3.1, Gemma 4 26B, Granite 4 Micro, Nemotron 3 120B, GLM-4.7 Flash / GLM-5.2, GPT-OSS 120B / 20B, Kimi K2.6 / K2.7 Code, SEA-LION v4 27B, LLaVA 1.5 7B (single-shot vision; the one non-streaming model)
45
- - Anthropic (Unified Billing): Sonnet 5, Opus 4.8, Opus 4.7, Opus 4.6, Sonnet 4.6, Haiku 4.5 (all streaming)
46
- - xAI (Unified Billing): Grok 4.3, Grok 4.20 (Multi-Agent and Reasoning) (all streaming as of v0.16.0)
47
- - OpenAI (Unified Billing): GPT-5.5, GPT-5.4, GPT-5.4 mini, o4-mini (streaming as of v0.21.1; needs CF credits)
48
- - Google Gemini (Unified Billing): Gemini 3.1 Pro and Gemini 3.5 Flash (streaming as of v0.21.4; needs CF credits)
45
+ - Anthropic (Unified Billing): Sonnet 5, Opus 5, Opus 4.8 / 4.7 / 4.6, Sonnet 4.6, Haiku 4.5 (all streaming; Fable needs `binding: true`)
46
+ - xAI (Unified Billing): Grok 4.5, Grok 4.3, Grok 4.20 (Multi-Agent and Reasoning)
47
+ - OpenAI (Unified Billing): GPT-5.5 / 5.5-pro, GPT-5.6 Sol / Terra / Luna (Responses API), GPT-5.4 / mini, o4-mini
48
+ - Google Gemini (Unified Billing): Gemini 3.1 Pro, 3.5 Flash, 3.6 Flash
49
+ - Moonshot (Unified Billing): Kimi K3
49
50
 
50
- **Image generation:** Google Nano Banana Pro / Nano Banana 2 / Imagen 4 (Unified Billing), GPT Image 1.5 and GPT Image 2 (OpenAI, opaque; v0.22.1/v0.165.0), Recraft V4 / V4.1 Pro (opaque, art-directed; v0.22.0/v0.165.0), FLUX 2 Klein 9B/4B, FLUX 2 Dev, FLUX-1 schnell, Lucid Origin, Phoenix 1.0, Dreamshaper 8 LCM, Stable Diffusion XL. FLUX.2 models accept up to 4 reference images (v0.16.0) for image-to-image generation, downscaled client-side to 512px.
51
+ **Image generation:** Google Nano Banana Pro / Nano Banana 2 / Lite / Imagen 4 (Unified Billing), GPT Image 1.5 and GPT Image 2 (opaque on the proxy; transparent PNG only when `OPENAI_API_KEY` is set, v0.174.0), Recraft V4 / V4.1 / V4.1 Pro (opaque, art-directed), xAI Grok Imagine Image (+ Quality), ByteDance Seedream 5 Pro / Lite, FLUX 2 Klein 9B/4B, FLUX 2 Dev, FLUX-1 schnell, Lucid Origin, Phoenix 1.0, Dreamshaper 8 LCM, Stable Diffusion XL. FLUX.2 models accept up to 4 reference images (v0.16.0) for image-to-image generation, downscaled client-side to 512px.
51
52
 
52
- **Video generation:** Google Veo 3.1 / 3.1 Fast / 3 / 3 Fast, ByteDance Seedance 2.0 / 2.0 Fast, MiniMax Hailuo 2.3 / 2.3 Fast, RunwayML Gen-4.5, Alibaba HappyHorse 1.0 and 1.1 T2V / I2V plus Wan 2.7 I2V (image-to-video, v0.21.5/v0.165.0), PixVerse v6 / v5.6, Vidu Q3 Pro / Q3 Turbo, xAI Grok Imagine Video and Video 1.5. All 20 models route through Unified Billing and durable Cloudflare Workflows.
53
+ **Video generation:** Google Veo 3.1 / 3.1 Fast, ByteDance Seedance 2.0 / 2.0 Fast / Mini, MiniMax Hailuo 2.3 / 2.3 Fast, RunwayML Gen-4.5, Alibaba HappyHorse 1.0 and 1.1 T2V / I2V plus Wan 2.7 I2V, PixVerse v6 / v5.6, Vidu Q3 Pro / Q3 Turbo, xAI Grok Imagine Video and Video 1.5. All route through Unified Billing and durable Cloudflare Workflows.
53
54
 
54
55
  **Music generation:** MiniMax Music 2.6 (Unified Billing, durable via Workflows).
55
56
 
@@ -57,7 +58,7 @@ One Worker, no framework, no build step beyond TypeScript. The interesting parts
57
58
 
58
59
  **Speech-to-text:** Whisper Large v3 Turbo / Whisper / Whisper Tiny EN and Deepgram Nova-3 (one-shot transcription), plus **Deepgram Flux** conversational/streaming STT with live turn detection over a WebSocket (v0.108.0).
59
60
 
60
- **Voice chat: talk to any model, hear it reply (v0.118.0):** a mic button on any chat model starts a hands-free loop, your speech is transcribed by Flux, each finished turn is sent to the selected model through the normal chat path, and the reply is spoken back via Aura-2 TTS. Works with all 36 chat models, the conversation saves to history like any other, and the whole loop runs on Cloudflare (no third-party STT/TTS). See [Voice chat](#voice-chat).
61
+ **Voice chat: talk to any model, hear it reply (v0.118.0):** a mic button on any chat model starts a hands-free loop, your speech is transcribed by Flux, each finished turn is sent to the selected model through the normal chat path, and the reply is spoken back via Aura-2 TTS. Works with every chat model in the catalog; the conversation saves to history like any other, and the whole loop runs on Cloudflare (no third-party STT/TTS). See [Voice chat](#voice-chat).
61
62
 
62
63
  **RAG (Vectorize):** upload files of any type via the sidebar (v0.23.0), or a `.zip` to import many files at once (v0.25.0, each inner file becomes its own document). PDFs get per-page extraction and spreadsheets (`.xlsx`/`.xls`) per-sheet; every other file is read as UTF-8 text (CSV, JSON, HTML, source code, logs, etc.). Binary formats that don't decode to text (e.g. `.docx`, images) are rejected. The worker chunks, embeds via BGE-base, and stores vectors in Vectorize plus text in D1. Toggle "use my docs" per turn to fold the top-5 nearest chunks into the system prompt before the LLM call.
63
64
 
@@ -150,7 +151,7 @@ echo "CF_AIG_TOKEN=your-cloudflare-api-token" >> .dev.vars
150
151
 
151
152
  Then enable Unified Billing for each provider you plan to use: Dashboard > AI > AI Gateway > your gateway > Settings. Without credits, proxied models fail with `2021: Invalid User Credentials`.
152
153
 
153
- There is **no** deployer BYOK secret: the last one, `OPENAI_API_KEY` for `openai/gpt-image-1.5` transparent PNG output, was retired in v0.166.0 (prism#93). OpenAI chat has never used it.
154
+ OpenAI chat never uses a deployer key. The **only** optional deployer secret is `OPENAI_API_KEY` (v0.174.0): when set, `openai/gpt-image-*` call `api.openai.com` for transparent PNG; when unset they stay opaque on Unified Billing. Leave it unset on public multi-tenant deploys so visitors cannot burn host credits.
154
155
 
155
156
  > **Public service:** to run the open, first-party-signup instance instead (no worker gateway secrets; every user brings their own AI Gateway), see [Running the public service](#running-the-public-service), and skip steps 1, 1b, and 6.
156
157
 
@@ -385,7 +386,7 @@ The worker is the only public surface. R2 is private; the worker streams objects
385
386
  ### Model types
386
387
 
387
388
  - `chat`: text generation. Accepts vision attachments on vision-capable models. Audio attachments are transcribed via Whisper. Video attachments are 8 client-extracted keyframes. Text-file attachments (v0.24.0) are inlined into the prompt as a fenced block (any chat model).
388
- - `image`: text-to-image generation. The system prompt field becomes the negative prompt. FLUX.2 models additionally accept up to 4 reference images (v0.16.0). Output is a JPEG/PNG in R2; proxied image models including `openai/gpt-image-*` are opaque (v0.166.0 retired the transparent-PNG BYOK path).
389
+ - `image`: text-to-image generation. The system prompt field becomes the negative prompt. FLUX.2 models additionally accept up to 4 reference images (v0.16.0). Output is a JPEG/PNG in R2. Proxied models are usually opaque on Unified Billing; `openai/gpt-image-*` can be transparent PNG when `OPENAI_API_KEY` is set (v0.174.0).
389
390
  - `tts`: text-to-speech. Output is audio (MP3 or model-default container) in R2.
390
391
  - `stt`: speech-to-text transcription. Input audio, output text.
391
392
  - `voice`: conversational/streaming STT (Deepgram Flux). A live WebSocket session, not a request/response turn; powers the standalone `/stt.html` panel and the [voice chat](#voice-chat) loop. Special-cased on both routing and UI (the chat path rejects it with a pointer to `/api/stt/stream`).
@@ -464,7 +465,9 @@ GPT-5.5, GPT-5.4, GPT-5.4 mini, and o4-mini (a reasoning model) are routed throu
464
465
 
465
466
  This is a deliberate re-introduction. OpenAI chat shipped as BYOK in v0.11.0 and was removed in the v0.14.0 consolidation in favor of Unified Billing. These entries come back on the Unified Billing side of that same decision, so they are not a revert of v0.14.0; the BYOK chat path stays gone.
466
467
 
467
- As of v0.166.0 there is no OpenAI BYOK path at all. A narrow image-only BYOK exception existed through v0.165.x: `openai/gpt-image-1.5` could produce transparent PNGs via a direct `api.openai.com` call, because the Unified Billing proxy's image schema is strictly `{ prompt, images, quality, size, style }` and rejects `background`/`output_format` (a request with them returns `7003: User Input Error`). prism#93 retired that path, so `gpt-image-*` now render opaque through the proxy like every other proxied image model. See the Image generation section below.
468
+ OpenAI **chat** stays Unified Billing only (no deployer key). OpenAI **image** has one optional carve-out (restored v0.174.0 after prism#93 retired it in v0.166.0): set `OPENAI_API_KEY` and `gpt-image-*` call `api.openai.com` with `background: "transparent"` + `output_format: "png"`, because the CF proxy schema is strictly `{ prompt, images, quality, size, style }` and 7003-rejects those fields. Unset key → opaque proxy. See the Image generation section below.
469
+
470
+ Responses-API catalog entries (`openai/gpt-5.5-pro`, `gpt-5.6-sol` / `terra` / `luna`, v0.173.0) use `api: "responses"` and `buildOpenAIResponsesBody` / the Responses SSE frames; Chat Completions models omit the flag.
468
471
 
469
472
  Two current limitations:
470
473
 
@@ -495,7 +498,7 @@ Per CF docs, BYOK is not supported for third-party models called through the AI
495
498
  | Model | Works today | Notes |
496
499
  |---|---|---|
497
500
  | `xai/grok-imagine-video` | needs CF credits | 8s default |
498
- | `google/veo-3.1`, `veo-3.1-fast`, `veo-3`, `veo-3-fast` | needs CF credits | route through `env.AI.run` |
501
+ | `google/veo-3.1`, `veo-3.1-fast` | needs CF credits | route through `env.AI.run` |
499
502
  | `bytedance/seedance-2.0`, `seedance-2.0-fast` | needs CF credits | CF partner, no public API |
500
503
  | `minimax/hailuo-2.3`, `hailuo-2.3-fast` | needs CF credits | CF partner, no public API |
501
504
  | `runwayml/gen-4.5` | needs CF credits | CF partner |
@@ -566,8 +569,8 @@ All four are hosted on Workers AI (no Unified Billing needed).
566
569
 
567
570
  ## Voice chat
568
571
 
569
- Talk to any of the 36 chat models and hear it talk back, hands-free. This is one
570
- of the headline features: a full **speech in, speech out** loop over any text
572
+ Talk to any chat model in the catalog and hear it talk back, hands-free. This is
573
+ one of the headline features: a full **speech in, speech out** loop over any text
571
574
  model on the list, running entirely on Cloudflare with no third-party STT/TTS.
572
575
 
573
576
  **Use it:** select a chat model, click the mic button in the composer (it only
@@ -613,7 +616,7 @@ This is a Cloudflare-proxied (third-party) model, so it requires Unified Billing
613
616
 
614
617
  ## Image generation
615
618
 
616
- Eleven models in the catalog: Google Nano Banana Pro and OpenAI GPT Image 1.5, plus Recraft V4, FLUX 2 Klein 9B/4B, FLUX 2 Dev, FLUX-1 schnell, Lucid Origin, Phoenix 1.0, Dreamshaper 8 LCM, Stable Diffusion XL. The eight FLUX/Leonardo/Lykon/Stability models run through Workers AI (no Unified Billing required); Nano Banana Pro and Recraft V4 are proxied partner models on Unified Billing (need CF credits); GPT Image 1.5 and GPT Image 2 are proxied partner models on Unified Billing (opaque output; v0.166.0 retired the OpenAI BYOK transparent path). No deployer BYOK path remains.
619
+ **21** image models in `src/models.ts` (or `GET /api/models?type=image`): Google Nano Banana Pro / 2 / Lite, Imagen 4, GPT Image 1.5 / 2, Recraft V4 / V4.1 / V4.1 Pro, xAI Grok Imagine Image (+ Quality), ByteDance Seedream 5 Pro / Lite, FLUX 2 Klein 9B/4B, FLUX 2 Dev, FLUX-1 schnell, Lucid Origin, Phoenix 1.0, Dreamshaper 8 LCM, Stable Diffusion XL. The eight FLUX/Leonardo/Lykon/Stability models run through Workers AI (no Unified Billing required); the rest are proxied partner models on Unified Billing (need CF credits). GPT Image 1.5 / 2 are opaque on the proxy by default; **optional deployer BYOK (v0.174.0):** set `OPENAI_API_KEY` for transparent PNG via `api.openai.com` (leave unset on public multi-tenant play).
617
620
 
618
621
  ### Google Nano Banana Pro (Unified Billing, v0.21.2)
619
622
 
@@ -630,9 +633,11 @@ Eleven models in the catalog: Google Nano Banana Pro and OpenAI GPT Image 1.5, p
630
633
 
631
634
  - **Recraft V4** (`recraft/recraftv4`, Unified Billing) is opaque and art-directed (strong composition and text rendering). The CF proxy exposes no alpha control, only an opaque `background_color`. It returns WebP; the worker stores it with the response content-type, so no format is hardcoded.
632
635
 
633
- - **GPT Image 1.5 / 2** (`openai/gpt-image-1.5`, `openai/gpt-image-2`) are opaque through the Unified Billing proxy, whose image schema is strictly `{ prompt, images, quality, size, style }` and 7003-rejects `background`/`output_format`. v0.166.0 retired the `OPENAI_API_KEY` BYOK direct call to `api.openai.com` that was the only way to get a transparent PNG (prism#93), so these now render opaque like every other proxied image model.
636
+ - **GPT Image 1.5 / 2** (`openai/gpt-image-1.5`, `openai/gpt-image-2`) are opaque through the Unified Billing proxy by default (`{ prompt, quality, size }`; proxy 7003-rejects `background`/`output_format`). **Optional BYOK (v0.174.0):** when `OPENAI_API_KEY` is set, `runImage` calls `api.openai.com` via `src/providers/openai-image.ts` for transparent PNG. Leave the secret unset on public play.
637
+ - **xAI Grok Imagine** (`xai/grok-imagine-image`, `-quality`): request `response_format: "b64_json"` on Unified Billing (CF-managed ZDR credentials reject URL format). `extractProxiedImageAsset` accepts URL or inline base64.
638
+ - **Recraft** (`recraft/recraftv4*`): bare `{ prompt }` only (v0.174.1/v0.174.2); legacy `style` enums and Pro `1024x1024` size are rejected upstream.
634
639
 
635
- All proxied image models return a URL (not base64) in the `{ state, result }` envelope (`{ state: "Completed", result: { image: "<url>" } }`), which the worker fetches and stores in R2 with the response content-type, so no format is hardcoded.
640
+ Proxied image models return a URL and/or inline base64 in the `{ state, result }` envelope. The worker stores bytes in R2 (fetching when `kind === "url"`, decoding when base64).
636
641
 
637
642
  ### FLUX.2 reference images (v0.16.0)
638
643
 
@@ -787,7 +792,7 @@ If your use case is the legal-research pattern (citation accuracy matters, sourc
787
792
 
788
793
  ## Streaming
789
794
 
790
- `POST /api/chat/stream` accepts the same request body as `POST /api/chat` and returns `text/event-stream`. Available for any chat model flagged `streaming: true` in the catalog (35 of the 36 chat models, all but the single-shot LLaVA 1.5, covering all five providers: Anthropic, xAI, Workers AI, OpenAI proxied, and Gemini).
795
+ `POST /api/chat/stream` accepts the same request body as `POST /api/chat` and returns `text/event-stream`. Available for any chat model flagged `streaming: true` in the catalog (almost all chat models; LLaVA 1.5 is the usual single-shot exception). Providers include Workers AI, Anthropic, xAI, OpenAI (Chat Completions and Responses), Google Gemini, and Moonshot.
791
796
 
792
797
  Wire format:
793
798
 
@@ -820,8 +825,9 @@ Note: AI Gateway does not surface `cf-aig-log-id` on proxied SSE responses, so s
820
825
  - `group` for the picker section heading
821
826
  - `type`: `"chat"` | `"image"` | `"tts"` | `"video"` | `"stt"` | `"music"`
822
827
  - `capabilities`: array. Currently only `"vision"` is recognized; applies to chat models only.
823
- - `provider` (optional): `"workers-ai"` (default) | `"anthropic"` | `"xai"` | `"openai"` / `"google"` / `"bytedance"` / `"minimax"` / `"runwayml"` / `"alibaba"` / `"pixverse"` / `"vidu"` (Unified Billing). Drives the call dispatch.
824
- - `streaming` (optional, chat only): when `true`, the model is eligible for `POST /api/chat/stream`. 35 of the 36 chat models across the five providers (Anthropic, Workers AI, xAI, OpenAI, Gemini) are wired; only the single-shot LLaVA 1.5 is not.
828
+ - `provider` (optional): `"workers-ai"` (default) | `"anthropic"` | `"xai"` | `"openai"` | `"google"` | `"moonshotai"` | `"bytedance"` | `"minimax"` | `"runwayml"` | `"alibaba"` | `"pixverse"` | `"vidu"` | `"recraft"` (Unified Billing). Drives the call dispatch.
829
+ - `api` (optional, OpenAI chat only): `"responses"` for Responses API models (v0.173.0); omit for Chat Completions.
830
+ - `streaming` (optional, chat only): when `true`, the model is eligible for `POST /api/chat/stream`. Nearly all chat models; LLaVA 1.5 is the usual non-stream exception.
825
831
 
826
832
  Full Workers AI catalog: https://developers.cloudflare.com/workers-ai/models/. Skip anything tagged "Planned deprecation."
827
833
 
@@ -839,6 +845,12 @@ npm run typecheck
839
845
 
840
846
  Runs `tsc --noEmit`. The Workers build uses esbuild and skips type checking, so this script is the source of truth for type errors during development.
841
847
 
848
+ ## See also
849
+
850
+ - **Write-up:** [Prism is open: sign up, bring your own Cloudflare AI Gateway](https://skyphusion.net/blog/prism-public/)
851
+ - **Labs hub:** [skyphusion.org](https://skyphusion.org) · **Blog:** [skyphusion.net](https://skyphusion.net)
852
+ - **Related:** [postern](https://github.com/skyphusion-labs/postern) (mailbox for humans and agents), [search-mcp](https://github.com/skyphusion-labs/search-mcp) (AI Search + ask widget), [vivijure](https://github.com/skyphusion-labs/vivijure) (AI film studio)
853
+
842
854
  ## Contributing
843
855
 
844
856
  See [CONTRIBUTING.md](CONTRIBUTING.md). PRs welcome. Current backlog items that would be especially welcome:
@@ -7,5 +7,6 @@ operator and these notices do not bind you.
7
7
 
8
8
  - [Privacy notice](INSTANCE-PRIVACY.md) -- what the hosted instance retains, and how to have it cleared.
9
9
  - [Acceptable use](INSTANCE-ACCEPTABLE-USE.md) -- good-faith use, no wallet abuse, and the CSAM / NCII bright line.
10
+ - [The privacy commitment](PRIVACY-COMMITMENT.md) -- **a pointer, not the text.** The product-wide commitment behind these notices, canonical at the constellation hub. Prism is one of the places where "we hold nothing" is not literally true, and the commitment says so in bold.
10
11
 
11
12
  Not legal advice.
@@ -0,0 +1,32 @@
1
+ -- Migration v0.167.0 (issue #80): first-party auth plane.
2
+ --
3
+ -- Adds the three tables the public-deployment auth core needs. Ownership
4
+ -- columns on existing tables (chats.user_email, documents.user_email, etc.) are
5
+ -- NOT renamed: in public mode they simply hold the opaque users.id string
6
+ -- instead of an Access email, so no data migration touches existing rows.
7
+ --
8
+ -- Idempotent: CREATE TABLE / INDEX IF NOT EXISTS.
9
+
10
+ CREATE TABLE IF NOT EXISTS users (
11
+ id TEXT PRIMARY KEY,
12
+ username TEXT NOT NULL,
13
+ username_lc TEXT NOT NULL UNIQUE,
14
+ password_hash TEXT NOT NULL,
15
+ email TEXT,
16
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
17
+ );
18
+
19
+ CREATE TABLE IF NOT EXISTS sessions (
20
+ token_hash TEXT PRIMARY KEY,
21
+ user_id TEXT NOT NULL,
22
+ created_at TEXT NOT NULL DEFAULT (datetime('now')),
23
+ expires_at TEXT NOT NULL
24
+ );
25
+
26
+ CREATE INDEX IF NOT EXISTS idx_sessions_user ON sessions(user_id);
27
+
28
+ CREATE TABLE IF NOT EXISTS auth_attempts (
29
+ bucket_key TEXT PRIMARY KEY,
30
+ count INTEGER NOT NULL DEFAULT 0,
31
+ window_start TEXT NOT NULL DEFAULT (datetime('now'))
32
+ );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prism-app",
3
3
  "version": "0.1.0",
4
- "description": "Multimodal AI playground on Cloudflare Workers: 36 chat models, voice chat, image/video/music generation, RAG, and web search.",
4
+ "description": "Multimodal AI playground on Cloudflare Workers: chat, voice, image/video/music generation, RAG, and web search.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "private": true,
7
7
  "type": "module",
@@ -17,16 +17,16 @@
17
17
  "db:migrate:remote": "wrangler d1 execute skyphusion-llm --remote --file=schema.sql"
18
18
  },
19
19
  "dependencies": {
20
- "unpdf": "^1.6.0",
20
+ "unpdf": "^1.8.0",
21
21
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
22
22
  },
23
23
  "devDependencies": {
24
- "@cloudflare/vitest-pool-workers": "^0.18.6",
25
- "@cloudflare/workers-types": "^5.20260715.1",
26
- "@types/node": "^26.1.1",
24
+ "@cloudflare/vitest-pool-workers": "^0.19.1",
25
+ "@cloudflare/workers-types": "^5.20260804.1",
26
+ "@types/node": "^26.1.2",
27
27
  "@vitest/coverage-v8": "^4.1.10",
28
28
  "typescript": "^7.0.2",
29
29
  "vitest": "^4.1.8",
30
- "wrangler": "^4.111.0"
30
+ "wrangler": "^4.118.0"
31
31
  }
32
32
  }
@@ -360,14 +360,17 @@ async function loadModels(prefetched) {
360
360
  function renderGatewayBanner() {
361
361
  if (!gatewayBanner) return;
362
362
  const g = state.gateway;
363
- if (!g || g.configured) {
363
+ // Boot (GET /api/models) and prefs both set configured when BYOK gateway id
364
+ // OR a control-plane pcp_ key is present. control_plane_configured is belt
365
+ // for older responses that only flipped the nested flag.
366
+ if (!g || g.configured || g.control_plane_configured) {
364
367
  gatewayBanner.hidden = true;
365
368
  return;
366
369
  }
367
370
  gatewayBanner.hidden = false;
368
371
  if (gatewayBannerText) {
369
372
  gatewayBannerText.textContent =
370
- "AI Gateway not configured. Set your gateway slug and a Cloudflare API token with AI Gateway Run permission to run models on your account.";
373
+ "Inference not configured. Set AI Gateway (BYOK) or a control-plane pcp_ client key under Account settings.";
371
374
  }
372
375
  }
373
376
 
@@ -1299,6 +1302,11 @@ async function run() {
1299
1302
  runBtn.disabled = true;
1300
1303
  attachBtn.disabled = true;
1301
1304
 
1305
+ // Clear the composer immediately on send (success and failure). Keeping the
1306
+ // text on error forced users to manually delete it and looked like a hang.
1307
+ userInput.value = "";
1308
+ autoGrowUserInput();
1309
+
1302
1310
  // Optimistic: append a user turn + a placeholder assistant turn to the
1303
1311
  // transcript immediately so the UI feels responsive. After the response
1304
1312
  // comes back we refetch the full conversation to get the canonical state.
@@ -1393,11 +1401,6 @@ async function run() {
1393
1401
  state.currentConversationId = result.conversation_id;
1394
1402
  state.pendingAttachments = [];
1395
1403
  renderAttachments();
1396
-
1397
- // Clear the input so the next prompt can be typed immediately.
1398
- // The system prompt stays.
1399
- userInput.value = "";
1400
- autoGrowUserInput();
1401
1404
  userInput.focus();
1402
1405
 
1403
1406
  // Refetch the full conversation from the server for canonical state
@@ -1414,18 +1417,17 @@ async function run() {
1414
1417
  // Roll back optimistic turns; surface the error in a fresh assistant turn.
1415
1418
  state.currentTurns.pop();
1416
1419
  state.currentTurns.pop();
1420
+ const msg = err.message || String(err);
1417
1421
  state.currentTurns.push(optimisticUserTurn, {
1418
1422
  model, model_type: m.type, output: "",
1419
1423
  status: "failed",
1420
- job_error: err.message,
1424
+ job_error: msg,
1421
1425
  });
1422
1426
  renderTranscript(state.currentTurns);
1423
- // #80 fail-closed BYOK gate: a 412 means no AI Gateway is configured (or the
1424
- // Unified Billing token is missing). Route the user straight into the
1425
- // gateway modal so the fix is one screen away, not a dead-end error. The
1426
- // failed turn still shows the server message (which names Account > AI
1427
- // Gateway). Match on the status; the worker also sends a code field.
1428
- if (err.status === 412) {
1427
+ userInput.focus();
1428
+ // #80 fail-closed: 412 = no AI Gateway BYOK and no control-plane pcp_ key.
1429
+ // Open the account modal so either path can be configured.
1430
+ if (err.status === 412 || err.code === "gateway_not_configured" || err.code === "cf_aig_token_required") {
1429
1431
  openGatewayModal();
1430
1432
  }
1431
1433
  } finally {
@@ -2109,6 +2111,10 @@ const gatewayModalId = $("#gateway-modal-id");
2109
2111
  const gatewayModalToken = $("#gateway-modal-token");
2110
2112
  const gatewayModalTokenHint= $("#gateway-modal-token-hint");
2111
2113
  const gatewayModalClear = $("#gateway-modal-clear-token");
2114
+ const gatewayModalCpKey = $("#gateway-modal-cp-key");
2115
+ const gatewayModalCpKeyHint= $("#gateway-modal-cp-key-hint");
2116
+ const gatewayModalCpUrlLabel = $("#gateway-modal-cp-url-label");
2117
+ const gatewayModalClearCp = $("#gateway-modal-clear-cp-key");
2112
2118
  const gatewayModalError = $("#gateway-modal-error");
2113
2119
  const gatewayModalSave = $("#gateway-modal-save");
2114
2120
  const gatewayModalCancel = $("#gateway-modal-cancel");
@@ -2263,6 +2269,8 @@ async function openGatewayModal() {
2263
2269
  gatewayModalError.textContent = "";
2264
2270
  gatewayModalToken.value = "";
2265
2271
  gatewayModalClear.checked = false;
2272
+ if (gatewayModalCpKey) gatewayModalCpKey.value = "";
2273
+ if (gatewayModalClearCp) gatewayModalClearCp.checked = false;
2266
2274
  try {
2267
2275
  const prefs = await api("/api/prefs");
2268
2276
  gatewayModalId.value = prefs.gateway_id || "";
@@ -2271,11 +2279,24 @@ async function openGatewayModal() {
2271
2279
  ? `saved token: ${prefs.cf_aig_token_preview || "••••"}`
2272
2280
  : "no token saved yet";
2273
2281
  }
2282
+ if (gatewayModalCpUrlLabel && prefs.control_plane_url) {
2283
+ try {
2284
+ gatewayModalCpUrlLabel.textContent = new URL(prefs.control_plane_url).host;
2285
+ } catch {
2286
+ gatewayModalCpUrlLabel.textContent = "play-proxy.skyphusion.org";
2287
+ }
2288
+ }
2289
+ if (gatewayModalCpKeyHint) {
2290
+ gatewayModalCpKeyHint.textContent = prefs.control_plane_key_set
2291
+ ? `saved key: ${prefs.control_plane_key_preview || "••••"} (control-plane mode on)`
2292
+ : "no control-plane key (chat uses AI Gateway)";
2293
+ }
2274
2294
  state.gateway = {
2275
2295
  configured: !!prefs.configured,
2276
2296
  source: prefs.source,
2277
2297
  gateway_id: prefs.gateway_id,
2278
2298
  cf_aig_token_set: prefs.cf_aig_token_set,
2299
+ control_plane_configured: !!prefs.control_plane_configured,
2279
2300
  };
2280
2301
  renderGatewayBanner();
2281
2302
  } catch (err) {
@@ -2307,8 +2328,14 @@ async function saveGatewayModal() {
2307
2328
  } else if (gatewayModalToken.value.trim()) {
2308
2329
  body.cf_aig_token = gatewayModalToken.value.trim();
2309
2330
  }
2310
- if (!gateway_id && !body.cf_aig_token && !body.clear_cf_aig_token) {
2311
- showGatewayModalError("enter a gateway slug and/or API token");
2331
+ if (gatewayModalClearCp && gatewayModalClearCp.checked) {
2332
+ body.clear_control_plane_key = true;
2333
+ } else if (gatewayModalCpKey && gatewayModalCpKey.value.trim()) {
2334
+ body.control_plane_key = gatewayModalCpKey.value.trim();
2335
+ }
2336
+ const hasCp = body.control_plane_key || body.clear_control_plane_key;
2337
+ if (!gateway_id && !body.cf_aig_token && !body.clear_cf_aig_token && !hasCp) {
2338
+ showGatewayModalError("enter a gateway slug, API token, and/or control-plane key");
2312
2339
  return;
2313
2340
  }
2314
2341
  try {
@@ -2318,6 +2345,7 @@ async function saveGatewayModal() {
2318
2345
  source: prefs.source,
2319
2346
  gateway_id: prefs.gateway_id,
2320
2347
  cf_aig_token_set: prefs.cf_aig_token_set,
2348
+ control_plane_configured: !!prefs.control_plane_configured,
2321
2349
  };
2322
2350
  renderGatewayBanner();
2323
2351
  closeGatewayModal();
@@ -3,7 +3,19 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
6
- <title>skyphusion</title>
6
+ <title>Prism | Multimodal AI playground on Cloudflare (public signup, BYOK)</title>
7
+ <meta name="description" content="Prism is a free AGPL multimodal AI playground on Cloudflare Workers: public signup, bring your own AI Gateway for Unified Billing. Chat, voice, image, video, music, RAG, and web search. By Skyphusion Labs.">
8
+ <link rel="canonical" href="https://play.skyphusion.org/">
9
+ <meta property="og:type" content="website">
10
+ <meta property="og:site_name" content="Prism">
11
+ <meta property="og:title" content="Prism | Multimodal AI playground on Cloudflare">
12
+ <meta property="og:description" content="Public signup multimodal AI playground. Bring your own Cloudflare AI Gateway. Chat, voice, image, video, music, RAG. Free AGPL software from Skyphusion Labs.">
13
+ <meta property="og:url" content="https://play.skyphusion.org/">
14
+ <meta property="og:locale" content="en_US">
15
+ <meta name="twitter:card" content="summary_large_image">
16
+ <meta name="twitter:title" content="Prism | Multimodal AI playground on Cloudflare">
17
+ <meta name="twitter:description" content="Public signup multimodal AI playground. Bring your own Cloudflare AI Gateway. Free AGPL from Skyphusion Labs.">
18
+ <meta name="robots" content="index, follow">
7
19
  <link rel="icon" href="/favicon.svg" type="image/svg+xml">
8
20
  <link rel="icon" href="/favicon-32.png" type="image/png" sizes="32x32">
9
21
  <link rel="icon" href="/favicon-16.png" type="image/png" sizes="16x16">
@@ -11,8 +23,28 @@
11
23
  <link rel="manifest" href="/manifest.webmanifest">
12
24
  <meta name="theme-color" content="#0a0e1a">
13
25
  <link rel="stylesheet" href="/styles.css">
26
+ <script type="application/ld+json">
27
+ {
28
+ "@context": "https://schema.org",
29
+ "@type": "WebApplication",
30
+ "name": "Prism",
31
+ "url": "https://play.skyphusion.org/",
32
+ "applicationCategory": "MultimediaApplication",
33
+ "operatingSystem": "Web",
34
+ "description": "Multimodal AI playground on Cloudflare Workers with public signup and per-user AI Gateway BYOK.",
35
+ "offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" },
36
+ "author": {
37
+ "@type": "Organization",
38
+ "name": "Skyphusion Labs",
39
+ "url": "https://skyphusion.org"
40
+ },
41
+ "codeRepository": "https://github.com/skyphusion-labs/prism",
42
+ "license": "https://www.gnu.org/licenses/agpl-3.0.html"
43
+ }
44
+ </script>
14
45
  </head>
15
46
  <body>
47
+ <a class="seo-skip" href="#auth-screen" style="position:absolute;left:-9999px">Prism multimodal AI playground: sign up or log in</a>
16
48
  <!-- #80 public-mode first-party auth. Hidden by default; the boot probe
17
49
  (GET /api/session) reveals it only when mode=public and no session.
18
50
  Access / self-host deploys report mode=access and never show it. -->
@@ -20,9 +52,9 @@
20
52
  <form id="auth-form" class="auth-card" novalidate>
21
53
  <div class="auth-brand">
22
54
  <span class="brand-mark" aria-hidden="true"></span>
23
- <span class="brand-name">skyphusion</span>
55
+ <h1 class="brand-name">Prism</h1>
24
56
  </div>
25
- <p class="auth-sub">multimodal AI playground</p>
57
+ <p class="auth-sub">multimodal AI playground on Cloudflare</p>
26
58
 
27
59
  <div class="auth-tabs" role="tablist" aria-label="log in or sign up">
28
60
  <button type="button" id="auth-tab-login" class="auth-tab" role="tab" aria-selected="false">log in</button>
@@ -67,7 +99,7 @@
67
99
  <!-- slide-in sidebar -->
68
100
  <aside class="sidebar">
69
101
  <header class="sidebar-header">
70
- <h1>history</h1>
102
+ <h2>history</h2>
71
103
  <button id="new-chat" type="button">+ new</button>
72
104
  </header>
73
105
  <input id="history-search" class="history-search" type="search" placeholder="search history&#8230;" aria-label="search history">
@@ -256,6 +288,17 @@
256
288
  <input id="gateway-modal-clear-token" type="checkbox">
257
289
  <span>clear saved token</span>
258
290
  </label>
291
+ <hr class="modal-sep" />
292
+ <p class="modal-hint"><strong>Control plane (optional).</strong> When a <code>pcp_</code> client key is set, chat bills through the metered proxy at <code id="gateway-modal-cp-url-label">play-proxy.skyphusion.org</code> (fixed host; not user-configurable). History/RAG stay on this worker.</p>
293
+ <label class="modal-field">
294
+ <span>control plane client key</span>
295
+ <input id="gateway-modal-cp-key" type="password" autocomplete="new-password" placeholder="pcp_… leave blank to keep">
296
+ <span id="gateway-modal-cp-key-hint" class="modal-hint"></span>
297
+ </label>
298
+ <label class="modal-field modal-check">
299
+ <input id="gateway-modal-clear-cp-key" type="checkbox">
300
+ <span>clear control plane key (use AI Gateway only)</span>
301
+ </label>
259
302
  <div id="gateway-modal-error" class="modal-error" hidden></div>
260
303
  </div>
261
304
  <footer class="modal-actions">
@@ -9,13 +9,16 @@
9
9
  //
10
10
  // pbkdf2$sha256$<iterations>$<salt_b64>$<hash_b64>
11
11
  //
12
- // 600000 iterations is the OWASP 2023 floor for PBKDF2-HMAC-SHA256; it lands
13
- // around 50-100ms on the paid Workers CPU budget, well inside the request CPU
14
- // limit. Salt is 16 random bytes; the derived key is 32 bytes.
12
+ // Iteration count: Cloudflare Workers caps PBKDF2 at 100_000 (measured 2026-08-05:
13
+ // "iteration counts above 100000 are not supported"). That is the platform max;
14
+ // OWASP's 600k floor is unreachable on this runtime. Salt is 16 random bytes;
15
+ // the derived key is 32 bytes. The PHC string stores the count so a future
16
+ // runtime raise can rehash on login without a schema migration.
15
17
 
16
18
  const KDF_ALGO = "pbkdf2";
17
19
  const KDF_HASH = "sha256";
18
- export const PBKDF2_ITERATIONS = 600000;
20
+ /** Workers-hard ceiling; do not raise past 100000 without verifying CF support. */
21
+ export const PBKDF2_ITERATIONS = 100_000;
19
22
  const SALT_BYTES = 16;
20
23
  const KEY_BYTES = 32;
21
24