--- title: m.ai API emoji: ⚫ colorFrom: gray colorTo: gray sdk: gradio sdk_version: 6.30.0 python_version: "3.12" app_file: app.py pinned: false short_description: Backend for mai-alus.web.app (payments + Spark preview) --- # m.ai API The server behind https://mai-alus.web.app: Razorpay subscriptions and one-time payments, Firebase sign-in checks, usage limits, and chat with **Spark**, m.ai's own small model (**research preview**: it makes mistakes). Every payment, plan and limit is decided here on the server, never in the browser. How it runs (free ZeroGPU Space, but nothing uses a GPU): `app.py` is the front door on port 7860 and forwards `/api/*` to the Node API in `api/` (127.0.0.1:7861). Spark (`spark_server.py`) answers on 127.0.0.1:8800, on the CPU. Spark's weights come from the private model repo `mohith2309/spark`, mounted read-only at `/model`. This Space contains no keys. They live in the Space's **Settings → Variables and secrets**: | Secret | What it is | |---|---| | `RAZORPAY_KEY_SECRET` | Razorpay key secret | | `RAZORPAY_WEBHOOK_SECRET` | the secret set on the Razorpay webhook | | `FIREBASE_SERVICE_ACCOUNT` | the Firebase service-account JSON (whole file contents) | | Variable | Value | |---|---| | `RAZORPAY_KEY_ID` | the Razorpay key id (`rzp_live_…`) | | `ALLOW_LIVE_PAYMENTS` | `yes` | | `SITE_ORIGIN` | `https://mai-alus.web.app` | | `SPARK_CHECKPOINT` | `/model/spark.pt` | | `GRADIO_SSR_MODE` | `false` |