Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 1.31 KB

File metadata and controls

68 lines (47 loc) · 1.31 KB

Dedicated Cloudflare Sarmad gateway

Magic Mirror uses a dedicated Worker gateway instead of the old documentation gateway. The Worker exposes:

POST /api/sarmad/ask

and calls Cloudflare Workers AI through the AI binding.

Current deployed gateway:

https://magicmirror-sarmad-gateway.2sa.workers.dev

Deploy

cd cloudflare\magicmirror-sarmad-gateway
wrangler deploy

or from the repository root:

.\scripts\deploy-gateway.ps1

The default model is:

@cf/openai/gpt-oss-20b

Requests that still ask for the deprecated @cf/openai/gpt-oss-120b are automatically migrated to @cf/openai/gpt-oss-20b by the gateway.

Native app binding

Set AI gateway base URL in Magic Mirror settings to the Worker URL, without the /api/sarmad/ask suffix. Example:

https://magicmirror-sarmad-gateway.2sa.workers.dev

The native app will post to:

{GatewayBaseUrl}/api/sarmad/ask

Security

No API keys are stored in this repository or in the native app. Cloudflare Workers AI is accessed only through the server-side AI binding configured by Wrangler.

If wrangler deploy returns Authentication error [code: 10000], refresh the local Cloudflare OAuth session:

wrangler logout
wrangler login
.\scripts\deploy-gateway.ps1