--- title: CharacterAI Middleware emoji: 💬 colorFrom: indigo colorTo: pink sdk: docker app_port: 7860 pinned: false --- Private Roblox-to-OpenRouter middleware. Set Space secrets `OPENROUTER_API_KEY` and `ROBLOX_SHARED_SECRET` (at least 32 random characters). Set variable `ROBLOX_UNIVERSE_ID=10770690936`. No credentials belong in these files. Edit `prompts.json` in this Space to manage personalities and system instructions. Optional variables: `OPENROUTER_MODEL` (default deepseek/deepseek-v4.1-flash), `OPENROUTER_PROVIDER` (default baidu/fp8), `MAX_REQUESTS_PER_MINUTE` (default 60), `MAX_REQUESTS_PER_DAY` (default 3000). The latter limits reset on restart; configure a hard credit limit on the OpenRouter key too. The Space is stateless. Roblox DataStores own private character definitions, recent conversation turns, and compact long-term memory. PRO is suitable for hosting this CPU-only proxy; it does not provide OpenRouter inference credits. `GET /health` reports readiness; `POST /chat` requires the shared bearer secret. Run exactly one worker so the in-memory throttles and idempotency cache agree.