feat(providers): add Cloudflare AI Playground as a No Auth provider (closes #10389) - #10442
feat(providers): add Cloudflare AI Playground as a No Auth provider (closes #10389)#10442Abhishek4512009 wants to merge 3 commits into
Conversation
…oses diegosouzapw#10389) Reverse-engineered access to the free, anonymous Cloudflare AI Playground: chat runs over a PartySocket WebSocket speaking Cloudflare's cf_agent RPC protocol with zero credentials (no account, no API key, no cookies). The WS upgrade is gated on a browser-grade TLS fingerprint, so the executor drives a headless Chromium via Playwright and speaks the protocol from inside the page context. - registry entry: cloudflare-playground (alias cfp), authType none, curated 20-model catalog (GLM 5.2, Kimi K2.7 Code, DeepSeek V4 Pro, gpt-oss-120B, Llama 3.3 70B, Qwen2.5 Coder 32B, ...) captured from the live getModels RPC (2026-08-15) - executor: cf_agent frame stream -> OpenAI SSE translation, id-filtered parser (RPC done:true frames cannot kill the stream), in-band upstream errors mapped to HTTP 429/502, abort + timeout handling, clean errors - noauth UI entry with reverse-engineered-endpoint notice - tests: 12 unit tests using real captured frames (incl. the 3021 rate-limit error) + fake transport; ESLint clean; open-sse typecheck clean
Bundlers with keepNames (esbuild/tsx, webpack) inject a __name() call into serialized function bodies. page.evaluate(openPlaygroundSession) therefore threw ReferenceError: __name is not defined in real browser sessions. Define the helper on window before evaluating the session opener.
…content support for cloudflare-playground
|
Thanks for this — really solid piece of work. The protocol reverse-engineering write-up in the executor's docstring is excellent, and the test suite is genuinely strong: building fixtures from real captured traffic (including the setConfig One thing to fix before merge: Everything else — registry wiring, the NOAUTH_PROVIDERS entry, error sanitization via |
Summary
Adds Cloudflare AI Playground as a No Auth provider (per #10389), zero credentials — no account, no API key, no cookies.
The playground serves free chat over a PartySocket WebSocket speaking Cloudflare's internal
cf_agentRPC protocol. The WS upgrade is gated on a browser-grade TLS fingerprint (raw Node/curl handshakes get 403), so the executor drives a headless Chromium via Playwright and speaks the protocol from inside the page context, then translates thecf_agentframe stream into OpenAI-format SSE.Catalog (20 curated chat models, captured live from the playground's
getModelsRPC on 2026-08-15): GLM 5.2, Kimi K2.7 Code, Kimi K2.6, DeepSeek V4 Pro / V4 Flash, gpt-oss-120B/20B, Llama 3.3 70B, Nemotron 3 120B, Qwen2.5 Coder 32B, QwQ 32B, Gemma 4 26B, Mistral Small 3.1, Granite 4 H, and more. Reasoning flags on the verified thinking models.Related Issues
Validation
Change type: provider (new No Auth provider, registry + executor + UI entry).
tests/unit/cloudflare-playground-provider.test.ts— 12 tests, all passing (run with the repo's node --test + tsx harness)setConfigRPCdone:trueframe (must NOT terminate the chat stream — this is a real protocol trap), and the live 3021 rate-limit error frame mapped to HTTP 429npx eslinton all touched files — cleannpx tsc -p open-sse/tsconfig.json— 0 errors (whole open-sse project)noauth-provider-validation,providers-constants-split,auth-noauth-fallback-loop-3061,noauth-autocombo-allowlist— 23/23 passingrelease/v3.8.50); focused checks rerun afterwardTests Added Or Updated
tests/unit/cloudflare-playground-provider.test.ts(new) — registry/noauth wiring, id+alias executor resolution,CfStreamParsertranslation against real captured frames (incl. the decoy-RPC-done and rate-limit traps), streaming + non-streaming responses, clean 429/502 error surfaces with no stack-trace leaks,@cf/model prefixing.Coverage Notes
open-sse/executors/cloudflare-playground.ts(executor + pure frame parser, transport injectable for tests),open-sse/config/providers/registry/cloudflare-playground/index.ts,src/shared/constants/providers/noauth.ts(UI entry), executor/registry wiring.PlaywrightCfTransport) is covered indirectly: transport-level behavior is validated via the injected fake transport in unit tests; a live browser round-trip was verified manually against the real playground (page passes the fingerprint gate, WS round-trip returns a model answer).setConfig, rate-limit frame captured verbatim.Reviewer Notes
CLOUDFLARE_PLAYGROUND_CHROME_PATHcan point at a full Chrome binary if Playwright's bundled Chromium is fingerprint-blocked in some environments. First request pays a ~1–2 s browser spin-up.3021). Non-streaming requests surface these as HTTP 429; streaming requests emit an SSE error chunk before[DONE](status is already committed).felo-web/chipotle/zai-webproviders — behavior may change upstream. The protocol spec lives in the executor's header docstring.systemmessages are dropped (playground persona is server-side viasetConfig); tool calls/vision not implemented.