@skyphusion/create-prism 0.1.0 → 1.0.0

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 (60) 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 +227 -48
  6. package/template/docs/legal/README.md +1 -0
  7. package/template/migrations/0002_auth_public_mode.sql +32 -0
  8. package/template/migrations/0003_conversation_compact.sql +24 -0
  9. package/template/package.json +6 -6
  10. package/template/public/app.js +128 -19
  11. package/template/public/index.html +50 -4
  12. package/template/public/styles.css +16 -2
  13. package/template/schema.sql +17 -0
  14. package/template/src/auth-kdf.ts +7 -4
  15. package/template/src/auth.ts +11 -2
  16. package/template/src/control-plane.ts +254 -0
  17. package/template/src/conversation-context.ts +126 -0
  18. package/template/src/env.ts +15 -0
  19. package/template/src/gateway-credentials.ts +23 -4
  20. package/template/src/health-schema.ts +4 -0
  21. package/template/src/index.ts +73 -3982
  22. package/template/src/longrun-params.ts +4 -2
  23. package/template/src/models.ts +65 -19
  24. package/template/src/output-extract.ts +58 -8
  25. package/template/src/parsers/openai-sse.ts +43 -14
  26. package/template/src/providers/anthropic.ts +105 -0
  27. package/template/src/providers/openai-image.ts +66 -0
  28. package/template/src/providers/openai.ts +79 -13
  29. package/template/src/providers/xai.ts +91 -0
  30. package/template/src/proxied-image-params.ts +29 -16
  31. package/template/src/routes/artifacts.ts +51 -0
  32. package/template/src/routes/chat.ts +1682 -0
  33. package/template/src/routes/conversations.ts +494 -0
  34. package/template/src/routes/documents.ts +262 -0
  35. package/template/src/routes/health.ts +105 -0
  36. package/template/src/routes/history.ts +92 -0
  37. package/template/src/routes/prefs.ts +95 -0
  38. package/template/src/routes/projects.ts +574 -0
  39. package/template/src/routes/rag.ts +657 -0
  40. package/template/src/routes/shared.ts +226 -0
  41. package/template/src/routes/workflow.ts +304 -0
  42. package/template/src/stt-session.ts +1 -1
  43. package/template/src/user-prefs.ts +10 -0
  44. package/template/src/zip.ts +7 -0
  45. package/template/tests/anthropic-binding.test.ts +181 -0
  46. package/template/tests/control-plane.test.ts +112 -0
  47. package/template/tests/conversation-compact.test.ts +103 -0
  48. package/template/tests/gateway-credentials.test.ts +37 -0
  49. package/template/tests/longrun-params.test.ts +19 -0
  50. package/template/tests/openai-image.test.ts +47 -0
  51. package/template/tests/openai-responses.test.ts +78 -0
  52. package/template/tests/openai-sse.test.ts +28 -0
  53. package/template/tests/output-extract.test.ts +75 -1
  54. package/template/tests/proxied-image-params.test.ts +16 -7
  55. package/template/tests/sprint1-catalog.test.ts +27 -0
  56. package/template/tests/sprint2-catalog.test.ts +51 -0
  57. package/template/tests/sprint3-catalog.test.ts +29 -0
  58. package/template/tests/xai-binding.test.ts +127 -0
  59. package/template/tests-integration/worker.test.ts +9 -2
  60. 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": "1.0.0",
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,65 @@
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)
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.
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
+
7
+ A multimodal AI playground deployed as a single Cloudflare Worker. **Live demo:** https://play.skyphusion.org (free signup, bring your own AI Gateway). Catalog breadth is live at `GET /api/models` (and `src/models.ts`): **93** models (44 chat + 21 image + 19 video + 3 TTS + 4 STT + 1 music + 1 live voice); the tables under [Features](#features) list every id. Native clients hit the commercial plane ([prism-control-plane](https://github.com/skyphusion-labs/prism-control-plane)); this Worker is the playground surface (RAG, projects, compact, web search). **Hands-free voice chat**, cross-model artifact reuse, RAG, projects, Discord ingestion, web search, SSE streaming, and multi-turn conversations (with optional **compact**). One web UI with first-party accounts, per-user history, R2 for all binary artifacts.
8
+
9
+ ```mermaid
10
+ flowchart TB
11
+ subgraph browser["Browser / play.skyphusion.org"]
12
+ UI["public/ app.js<br/>chat · image · video · voice"]
13
+ end
14
+
15
+ subgraph worker["Worker: skyphusion-llm"]
16
+ Auth["AUTH_MODE public or access"]
17
+ Chat["/api/chat · /api/chat/stream"]
18
+ Multi["image · TTS · STT · video · music"]
19
+ RAG["Vectorize + D1 RAG"]
20
+ WF["LongRunWorkflow<br/>video · music"]
21
+ end
22
+
23
+ subgraph store["Bindings"]
24
+ D1["D1 history + chunks"]
25
+ R2["R2 artifacts"]
26
+ VZ["Vectorize embeddings"]
27
+ end
28
+
29
+ subgraph ai["Cloudflare AI"]
30
+ GW["AI Gateway"]
31
+ Run["env.AI.run"]
32
+ end
33
+
34
+ subgraph native["Native apps optional"]
35
+ iOS["prism-ios → play-proxy<br/>control plane not this Worker"]
36
+ end
37
+
38
+ UI --> Auth --> Chat
39
+ Auth --> Multi
40
+ Chat --> Run
41
+ Multi --> Run
42
+ Multi --> WF
43
+ Chat --> RAG
44
+ RAG --> VZ
45
+ Chat --> D1
46
+ Multi --> R2
47
+ Run --> GW
48
+ iOS -.->|"separate host<br/>play-proxy.skyphusion.org"| native
49
+ ```
8
50
 
9
51
  <p align="center">
10
52
  <img src="docs/screenshot-desktop.jpg" alt="Desktop UI: image generation with Nano Banana Pro" width="800"><br><br>
11
53
  <img src="docs/screenshot-mobile.jpg" alt="Mobile UI: image generation with Nano Banana Pro" width="280">
12
54
  </p>
13
55
 
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).
56
+ > ### 🎙️ Speak to the chat catalog, and hear it talk back
57
+ > Not one voice assistant: **any chat model in the picker**, by voice. Pick a
58
+ > model, tap the mic, and have a real spoken conversation: your speech is
59
+ > transcribed by Deepgram Flux, sent through the normal chat path, and the reply
60
+ > is **spoken back** with Aura-2 TTS, hands-free. End to end on Cloudflare, no
61
+ > third-party STT/TTS services. Claude, Llama, Grok, Gemini, GPT, Kimi, and the
62
+ > rest answer out loud; conversations save to history like any other chat. See
63
+ > [Voice chat](#voice-chat).
22
64
 
23
65
  ## What this is
24
66
 
@@ -29,35 +71,159 @@ A working template for the Cloudflare AI stack and a self-hosted multimodal play
29
71
  One Worker, no framework, no build step beyond TypeScript. The interesting parts are the patterns, not the model count:
30
72
 
31
73
  - **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).
74
+ - **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.
75
+ - **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
76
  - **AI Gateway** wraps every call for observability, caching, and rate-limiting.
35
77
  - **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
78
  - **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
79
  - **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
80
  - **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.
81
+ - **Searchable model picker** (v0.111.0) groups the live catalog from `GET /api/models` (chat + image + video + speech + music) with capability badges (vision, stream) inline; type to filter by name.
40
82
 
41
83
  ## Features
42
84
 
43
- **Chat (36 models across 5 providers; 35 of 36 stream-capable):**
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)
49
-
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
-
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
-
54
- **Music generation:** MiniMax Music 2.6 (Unified Billing, durable via Workflows).
55
-
56
- **Text-to-speech:** Aura-2 EN / ES, MeloTTS.
57
-
58
- **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
- **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).
85
+ **Full model catalog (93 entries):** tables below are generated from `src/models.ts`. Live list always wins: `GET /api/models`. The commercial control plane ([prism-control-plane](https://github.com/skyphusion-labs/prism-control-plane)) mirrors the same ids in `src/catalog.ts`.
86
+
87
+ | Modality | Count |
88
+ | --- | ---: |
89
+ | Chat | 44 |
90
+ | Image | 21 |
91
+ | Video | 19 |
92
+ | Text-to-speech (TTS) | 3 |
93
+ | Speech-to-text (STT) | 4 |
94
+ | Music | 1 |
95
+ | Live voice (Flux) | 1 |
96
+ | **Total** | **93** |
97
+
98
+ #### Chat (44)
99
+
100
+ | Model id | Notes |
101
+ | --- | --- |
102
+ | `anthropic/claude-fable-5` | Anthropic; binding |
103
+ | `anthropic/claude-sonnet-5` | Anthropic |
104
+ | `anthropic/claude-opus-5` | Anthropic |
105
+ | `anthropic/claude-opus-4-8` | Anthropic |
106
+ | `anthropic/claude-opus-4-7` | Anthropic |
107
+ | `anthropic/claude-opus-4-6` | Anthropic |
108
+ | `anthropic/claude-sonnet-4-6` | Anthropic |
109
+ | `anthropic/claude-haiku-4-5` | Anthropic |
110
+ | `xai/grok-4.5` | xAI |
111
+ | `xai/grok-4.3` | xAI |
112
+ | `xai/grok-4.20-multi-agent-0309` | xAI multi-agent |
113
+ | `xai/grok-4.20-0309-reasoning` | xAI reasoning |
114
+ | `moonshotai/kimi-k3` | Moonshot UB |
115
+ | `@cf/moonshotai/kimi-k2.6` | Workers AI |
116
+ | `@cf/moonshotai/kimi-k2.7-code` | Workers AI, vision |
117
+ | `@cf/openai/gpt-oss-120b` | Workers AI, reasoning |
118
+ | `@cf/meta/llama-4-scout-17b-16e-instruct` | Workers AI, vision |
119
+ | `@cf/google/gemma-4-26b-a4b-it` | Workers AI, vision |
120
+ | `@cf/openai/gpt-oss-20b` | Workers AI |
121
+ | `openai/gpt-5.5` | OpenAI UB |
122
+ | `openai/gpt-5.5-pro` | OpenAI Responses |
123
+ | `openai/gpt-5.6-sol` | OpenAI Responses |
124
+ | `openai/gpt-5.6-terra` | OpenAI Responses |
125
+ | `openai/gpt-5.6-luna` | OpenAI Responses |
126
+ | `openai/gpt-5.4` | OpenAI UB |
127
+ | `openai/gpt-5.4-mini` | OpenAI UB |
128
+ | `openai/o4-mini` | OpenAI reasoning |
129
+ | `@cf/meta/llama-3.3-70b-instruct-fp8-fast` | Workers AI |
130
+ | `@cf/meta/llama-3.2-11b-vision-instruct` | Workers AI, vision |
131
+ | `@cf/meta/llama-3.2-3b-instruct` | Workers AI |
132
+ | `@cf/qwen/qwen3-30b-a3b-fp8` | Workers AI |
133
+ | `@cf/qwen/qwq-32b` | Workers AI, reasoning |
134
+ | `@cf/qwen/qwen2.5-coder-32b-instruct` | Workers AI |
135
+ | `@cf/deepseek-ai/deepseek-r1-distill-qwen-32b` | Workers AI |
136
+ | `@cf/mistralai/mistral-small-3.1-24b-instruct` | Workers AI, vision |
137
+ | `@cf/zai-org/glm-4.7-flash` | Workers AI |
138
+ | `@cf/zai-org/glm-5.2` | Workers AI |
139
+ | `@cf/nvidia/nemotron-3-120b-a12b` | Workers AI |
140
+ | `@cf/aisingapore/gemma-sea-lion-v4-27b-it` | Workers AI |
141
+ | `google/gemini-3.1-pro` | Google Gemini, binding |
142
+ | `google/gemini-3.5-flash` | Google Gemini, binding |
143
+ | `google/gemini-3.6-flash` | Google Gemini, binding |
144
+ | `@cf/ibm-granite/granite-4.0-h-micro` | Workers AI |
145
+ | `@cf/meta/llama-3.2-1b-instruct` | Workers AI |
146
+
147
+ #### Image (21)
148
+
149
+ | Model id | Notes |
150
+ | --- | --- |
151
+ | `google/nano-banana-pro` | Google UB |
152
+ | `google/nano-banana-2` | Google UB |
153
+ | `google/nano-banana-2-lite` | Google UB |
154
+ | `google/imagen-4` | Google UB |
155
+ | `openai/gpt-image-1.5` | OpenAI UB; transparent PNG needs `OPENAI_API_KEY` |
156
+ | `openai/gpt-image-2` | OpenAI UB; transparent PNG needs `OPENAI_API_KEY` |
157
+ | `recraft/recraftv4` | Recraft UB |
158
+ | `recraft/recraftv4-1` | Recraft UB |
159
+ | `recraft/recraftv4-1-pro` | Recraft UB |
160
+ | `xai/grok-imagine-image` | xAI UB |
161
+ | `xai/grok-imagine-image-quality` | xAI UB |
162
+ | `bytedance/seedream-5-pro` | ByteDance UB |
163
+ | `bytedance/seedream-5-lite` | ByteDance UB |
164
+ | `@cf/black-forest-labs/flux-2-klein-9b` | FLUX 2; up to 4 refs |
165
+ | `@cf/black-forest-labs/flux-2-klein-4b` | FLUX 2; up to 4 refs |
166
+ | `@cf/black-forest-labs/flux-2-dev` | FLUX 2 multi-reference |
167
+ | `@cf/black-forest-labs/flux-1-schnell` | FLUX-1 fast |
168
+ | `@cf/leonardo/lucid-origin` | Leonardo |
169
+ | `@cf/leonardo/phoenix-1.0` | Leonardo |
170
+ | `@cf/lykon/dreamshaper-8-lcm` | Fast SD |
171
+ | `@cf/stabilityai/stable-diffusion-xl-base-1.0` | SDXL |
172
+
173
+ #### Video (19)
174
+
175
+ | Model id | Notes |
176
+ | --- | --- |
177
+ | `google/veo-3.1` | Workflow long-run |
178
+ | `google/veo-3.1-fast` | Workflow long-run |
179
+ | `bytedance/seedance-2.0` | Workflow long-run |
180
+ | `bytedance/seedance-2.0-fast` | Workflow long-run |
181
+ | `bytedance/seedance-2.0-mini` | Workflow long-run |
182
+ | `minimax/hailuo-2.3` | i2v-required |
183
+ | `minimax/hailuo-2.3-fast` | i2v-required |
184
+ | `xai/grok-imagine-video` | ZDR upload_url |
185
+ | `xai/grok-imagine-video-1.5-preview` | ZDR upload_url |
186
+ | `runwayml/gen-4.5` | Workflow long-run |
187
+ | `alibaba/hh1-t2v` | HappyHorse 1.0 T2V |
188
+ | `alibaba/hh1-i2v` | HappyHorse 1.0 I2V |
189
+ | `alibaba/hh1.1-t2v` | HappyHorse 1.1 T2V |
190
+ | `alibaba/hh1.1-i2v` | HappyHorse 1.1 I2V |
191
+ | `alibaba/wan-2.7-i2v` | Wan 2.7 I2V |
192
+ | `pixverse/v6` | Workflow long-run |
193
+ | `pixverse/v5.6` | Workflow long-run |
194
+ | `vidu/q3-pro` | Workflow long-run |
195
+ | `vidu/q3-turbo` | Workflow long-run |
196
+
197
+ #### TTS (3)
198
+
199
+ | Model id | Notes |
200
+ | --- | --- |
201
+ | `@cf/deepgram/aura-2-en` | English |
202
+ | `@cf/deepgram/aura-2-es` | Spanish speakers |
203
+ | `@cf/myshell-ai/melotts` | Multilingual |
204
+
205
+ #### STT (4)
206
+
207
+ | Model id | Notes |
208
+ | --- | --- |
209
+ | `@cf/openai/whisper-large-v3-turbo` | Best quality |
210
+ | `@cf/openai/whisper` | General |
211
+ | `@cf/openai/whisper-tiny-en` | Fast English |
212
+ | `@cf/deepgram/nova-3` | Accurate batch |
213
+
214
+ #### Music (1)
215
+
216
+ | Model id | Notes |
217
+ | --- | --- |
218
+ | `minimax/music-2.6` | Workflow long-run |
219
+
220
+ #### Live voice (1)
221
+
222
+ | Model id | Notes |
223
+ | --- | --- |
224
+ | `@cf/deepgram/flux` | Streaming STT over WebSocket |
225
+
226
+ **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
227
 
62
228
  **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
229
 
@@ -69,9 +235,11 @@ One Worker, no framework, no build step beyond TypeScript. The interesting parts
69
235
 
70
236
  **Streaming (v0.13.0+):** `POST /api/chat/stream` returns SSE for any chat model flagged `streaming: true` in the catalog. Token deltas surface as `{ type: "delta", text: "..." }` events, terminal completion as `{ type: "done", ... }` with token counts and conversation IDs. Client disconnect aborts the upstream model call immediately.
71
237
 
72
- **Multi-turn conversations:** `conversation_id` plus `turn_index` on chat rows. Continuing a conversation pulls prior turns and assembles a full message history for the next call. Mixed-model conversations allowed (start with Llama, continue with Claude). Text-only on continuation; prior images, audio, and video are not re-sent.
238
+ **Multi-turn conversations:** `conversation_id` plus `turn_index` on chat rows. Continuing a conversation pulls prior completed chat turns and assembles them for the next call. Mixed-model conversations allowed (start with Llama, continue with Claude). Text-only on continuation; prior images, audio, and video are not re-sent.
239
+
240
+ **Conversation compact (v0.175.7):** long threads re-send every prior turn into the model context by default. The UI **compact** control (conversation header) asks a chat model to summarize older turns; the next call injects that summary into the system prompt and only re-sends the recent raw turns (default keep last 2). The full UI transcript is unchanged. **Expand** clears the summary so the next turn uses full history again. API: `POST` / `DELETE /api/conversations/:id/compact`; `GET /api/conversations/:id` returns `compact: null | { summary, through_turn_index, keep_recent, model, updated_at }`.
73
241
 
74
- **UI (focus-mode redesign, v0.110.0+):** a single centered conversation column with a floating composer; the sidebar (searchable history, projects, documents) is a slide-in overlay; a searchable model picker (type to filter, v0.111.0); a ⚙ popover for the system prompt + retrieval toggles and an account menu in the top bar; a paperclip attach button and a voice-chat mic. Capability-aware mode switching (vision-only attachment types; image-mode re-skins to "negative prompt"; TTS / STT / video / music / voice hide irrelevant inputs), FLUX.2 reference-image attach UI (v0.16.0), per-turn web-search toggle (v0.17.0), per-user replay-able history with attachments and generated artifacts, Enter to send / Shift+Enter for newline. Mobile-optimized (safe-area insets, touch targets, no iOS zoom).
242
+ **UI (focus-mode redesign, v0.110.0+):** a single centered conversation column with a floating composer; the sidebar (searchable history, projects, documents) is a slide-in overlay; a searchable model picker (type to filter, v0.111.0); a ⚙ popover for the system prompt + retrieval toggles and an account menu in the top bar; a paperclip attach button and a voice-chat mic; conversation header **compact** / **expand** when a thread has enough turns (v0.175.7). Capability-aware mode switching (vision-only attachment types; image-mode re-skins to "negative prompt"; TTS / STT / video / music / voice hide irrelevant inputs), FLUX.2 reference-image attach UI (v0.16.0), per-turn web-search toggle (v0.17.0), per-user replay-able history with attachments and generated artifacts, Enter to send / Shift+Enter for newline. Mobile-optimized (safe-area insets, touch targets, no iOS zoom).
75
243
 
76
244
  **Auth (two modes via `AUTH_MODE`):** **public** (the hosted product) is first-party username/password signup with an opaque session cookie and mandatory per-user BYOK: each user brings their own AI Gateway, the worker holds no gateway secrets, and inference bills the user, never the host. **access** (the default, for private self-host) puts Cloudflare Access on the worker URL and scopes per-user history and R2 ownership via `Cf-Access-Authenticated-User-Email` (free up to 50 seats on Zero Trust). See [Running the public service](#running-the-public-service).
77
245
 
@@ -150,7 +318,7 @@ echo "CF_AIG_TOKEN=your-cloudflare-api-token" >> .dev.vars
150
318
 
151
319
  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
320
 
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.
321
+ 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
322
 
155
323
  > **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
324
 
@@ -361,9 +529,11 @@ The worker is the only public surface. R2 is private; the worker streams objects
361
529
  | GET/WS | `/api/stt/stream` | WebSocket for conversational STT (Deepgram Flux via the `SttSession` DO); persists the transcript to history on close |
362
530
  | POST | `/api/tts` | Synthesize text to speech (Aura-2) and stream the audio back (no history row); used by the voice-chat loop |
363
531
  | GET | `/api/conversations` | List the caller's conversations (grouped by `conversation_id`, includes each conversation's `project_id`) |
364
- | GET | `/api/conversations/:id` | Full transcript for a conversation |
365
- | DELETE | `/api/conversations/:id` | Cascade delete of all turns plus R2 artifacts |
532
+ | GET | `/api/conversations/:id` | Full transcript for a conversation; includes `compact` state when set (v0.175.7) |
533
+ | DELETE | `/api/conversations/:id` | Cascade delete of all turns plus R2 artifacts (and compact state) |
366
534
  | PATCH | `/api/conversations/:id/project` | Move a conversation to a project, or clear it (`{project_id: number \| null}`) |
535
+ | POST | `/api/conversations/:id/compact` | Summarize older turns for model context (`{ keep_recent?, model? }`; v0.175.7) |
536
+ | DELETE | `/api/conversations/:id/compact` | Clear compact summary; next turn uses full raw history (v0.175.7) |
367
537
  | GET | `/api/history/:id` | One chat row with full attachment + output references |
368
538
  | DELETE | `/api/history/:id` | Delete a single chat row and clean up its R2 objects |
369
539
  | GET | `/api/job/:id` | Poll an async video / music generation job's status |
@@ -385,7 +555,7 @@ The worker is the only public surface. R2 is private; the worker streams objects
385
555
  ### Model types
386
556
 
387
557
  - `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).
558
+ - `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
559
  - `tts`: text-to-speech. Output is audio (MP3 or model-default container) in R2.
390
560
  - `stt`: speech-to-text transcription. Input audio, output text.
391
561
  - `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 +634,9 @@ GPT-5.5, GPT-5.4, GPT-5.4 mini, and o4-mini (a reasoning model) are routed throu
464
634
 
465
635
  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
636
 
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.
637
+ 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.
638
+
639
+ 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
640
 
469
641
  Two current limitations:
470
642
 
@@ -495,7 +667,7 @@ Per CF docs, BYOK is not supported for third-party models called through the AI
495
667
  | Model | Works today | Notes |
496
668
  |---|---|---|
497
669
  | `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` |
670
+ | `google/veo-3.1`, `veo-3.1-fast` | needs CF credits | route through `env.AI.run` |
499
671
  | `bytedance/seedance-2.0`, `seedance-2.0-fast` | needs CF credits | CF partner, no public API |
500
672
  | `minimax/hailuo-2.3`, `hailuo-2.3-fast` | needs CF credits | CF partner, no public API |
501
673
  | `runwayml/gen-4.5` | needs CF credits | CF partner |
@@ -566,8 +738,8 @@ All four are hosted on Workers AI (no Unified Billing needed).
566
738
 
567
739
  ## Voice chat
568
740
 
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
741
+ Talk to any chat model in the catalog and hear it talk back, hands-free. This is
742
+ one of the headline features: a full **speech in, speech out** loop over any text
571
743
  model on the list, running entirely on Cloudflare with no third-party STT/TTS.
572
744
 
573
745
  **Use it:** select a chat model, click the mic button in the composer (it only
@@ -613,7 +785,7 @@ This is a Cloudflare-proxied (third-party) model, so it requires Unified Billing
613
785
 
614
786
  ## Image generation
615
787
 
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.
788
+ **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
789
 
618
790
  ### Google Nano Banana Pro (Unified Billing, v0.21.2)
619
791
 
@@ -630,9 +802,11 @@ Eleven models in the catalog: Google Nano Banana Pro and OpenAI GPT Image 1.5, p
630
802
 
631
803
  - **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
804
 
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.
805
+ - **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.
806
+ - **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.
807
+ - **Recraft** (`recraft/recraftv4*`): bare `{ prompt }` only (v0.174.1/v0.174.2); legacy `style` enums and Pro `1024x1024` size are rejected upstream.
634
808
 
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.
809
+ 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
810
 
637
811
  ### FLUX.2 reference images (v0.16.0)
638
812
 
@@ -787,7 +961,6 @@ If your use case is the legal-research pattern (citation accuracy matters, sourc
787
961
 
788
962
  ## Streaming
789
963
 
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).
791
964
 
792
965
  Wire format:
793
966
 
@@ -820,8 +993,8 @@ Note: AI Gateway does not surface `cf-aig-log-id` on proxied SSE responses, so s
820
993
  - `group` for the picker section heading
821
994
  - `type`: `"chat"` | `"image"` | `"tts"` | `"video"` | `"stt"` | `"music"`
822
995
  - `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.
996
+ - `provider` (optional): `"workers-ai"` (default) | `"anthropic"` | `"xai"` | `"openai"` | `"google"` | `"moonshotai"` | `"bytedance"` | `"minimax"` | `"runwayml"` | `"alibaba"` | `"pixverse"` | `"vidu"` | `"recraft"` (Unified Billing). Drives the call dispatch.
997
+ - `api` (optional, OpenAI chat only): `"responses"` for Responses API models (v0.173.0); omit for Chat Completions.
825
998
 
826
999
  Full Workers AI catalog: https://developers.cloudflare.com/workers-ai/models/. Skip anything tagged "Planned deprecation."
827
1000
 
@@ -839,6 +1012,12 @@ npm run typecheck
839
1012
 
840
1013
  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
1014
 
1015
+ ## See also
1016
+
1017
+ - **Write-up:** [Prism is open: sign up, bring your own Cloudflare AI Gateway](https://skyphusion.net/blog/prism-public/)
1018
+ - **Labs hub:** [skyphusion.org](https://skyphusion.org) · **Blog:** [skyphusion.net](https://skyphusion.net)
1019
+ - **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)
1020
+
842
1021
  ## Contributing
843
1022
 
844
1023
  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
+ );
@@ -0,0 +1,24 @@
1
+ -- Conversation compact state (v0.175.7 / prism compact ability).
2
+ --
3
+ -- Multi-turn chat currently resends every prior turn text into the model
4
+ -- context. A long thread blows the window. Compact stores a model-written
5
+ -- summary of older turns; the next chat turn injects that summary and only
6
+ -- the recent raw turns. The full transcript in chats stays intact for the UI.
7
+ --
8
+ -- through_turn_index is inclusive: turns with turn_index <= through_turn_index
9
+ -- are covered by summary and are NOT re-sent as raw user/assistant pairs.
10
+ -- keep_recent is recorded for display; the authoritative cut is through_turn_index.
11
+
12
+ CREATE TABLE IF NOT EXISTS conversation_compact (
13
+ conversation_id TEXT NOT NULL,
14
+ user_email TEXT NOT NULL,
15
+ summary TEXT NOT NULL,
16
+ through_turn_index INTEGER NOT NULL,
17
+ keep_recent INTEGER NOT NULL DEFAULT 2,
18
+ model TEXT NOT NULL,
19
+ updated_at TEXT NOT NULL DEFAULT (datetime('now')),
20
+ PRIMARY KEY (conversation_id, user_email)
21
+ );
22
+
23
+ CREATE INDEX IF NOT EXISTS idx_conversation_compact_user
24
+ ON conversation_compact(user_email);
@@ -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.20.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
  }