nanomuse-cloud
Self-hosted OpenAI-compatible relay for nanoMuse accounts
TLDR
SYNOPSIS
nanomuse-cloud [serve] [--host addr] [--port n] [--log-level level]nanomuse-cloud admin [--base url] [--token token] [--actor name] controls list|set|audit
DESCRIPTION
nanomuse-cloud is the nanoMuse Cloud relay: one Python process (FastAPI on uvicorn) over a SQLite database. A person signs up with a phone number or an e-mail address, receives a six-digit code, and gets an `nm_` API key with a starter allowance. The nanoMuse apps then call this process the way they would call any OpenAI-compatible provider (`/v1/models`, `/v1/chat/completions`). A bring-your-own key still works; the relay is the "start now" path.With no subcommand the process serves. Sign-up, the ledger, profile sync, and the multi-device hub are configured only through environment variables (or a `.env` file you source first). There are no config-file flags.admin talks to a relay that is already running. It does not start one. controls set posts to the admin API so in-memory switches change immediately.The package version in the nanoMuse tree is 0.31.0. It needs Python 3.11 or newer. From a checkout of the `cloud` directory, `pip install -e .` installs the nanomuse-cloud console script. The repository script `scripts/self-host.sh` asks the production questions, writes `.env`, and starts the compose stack.
PARAMETERS
serve
Run the relay. This is the default when no subcommand is given. --host (default `0.0.0.0`), --port (default `8787`), and --log-level (default `info`) may be set on serve or on the top-level commandadmin controls list
Print each operator switch, whether it is on, and who last changed it. Also prints the account count, rule count, and whether notify mail is configuredadmin controls set switch on|off
Flip one switch on the running relay. --note is stored in the audit log. The switch id is one of:
signups
cloud_service
sync
hub
apps_only
Print recent control changes. --limit defaults to 50--base url
Relay URL for admin. Default is the NANOMUSE CLOUD BASE environment variable, then PUBLIC BASE, then `http://127.0.0.1:8787`--token token
Admin token for admin. Default is the CLOUD ADMIN TOKEN environment variable. The command exits if neither is set--actor name
Name written to the audit log. Default is `cli:` plus the current user name, trimmed to 80 characters
CONFIGURATION
Every setting is an environment variable. The names below are the process environment (a single underscore between the words). Development defaults let the relay start on a laptop: codes are printed to the log, the database is `./data/cloud.db`, and chat answers 503 until an upstream key is set. Sign-up still works in that mode.
CLOUD_SECRET=[long-random-secret]
CLOUD_ADMIN_TOKEN=[admin-token]
PUBLIC_BASE=http://127.0.0.1:8787
UPSTREAM_BASE=https://dashscope.aliyuncs.com/compatible-mode/v1
UPSTREAM_KEY=[provider-key]
HMAC key for phone numbers and e-mail addresses. Required once the relay sends real codes. Without it, identifiers are hashed with a fixed development keyCLOUD ADMIN TOKEN
Bearer for the operator API and for nanomuse-cloud adminPUBLIC BASE
Base URL the apps should use for this relay, without a trailing `/v1`UPSTREAM BASE / UPSTREAM KEY
OpenAI-compatible provider the relay forwards chat to. The hosted menu is the Qwen model `Qwen/Qwen3.6-27B-FP8`. Image and video generation stay on keys the person configures on the deviceALLOWANCE CNY
Lifetime provider-bill allowance per non-member account, in yuan. Default 10. 0 means no limit. INVITE BONUS CNY (default 5) is added to both the inviter and the new account after the new account has actually spentRECORD TURNS
When 1 (the default), the relay stores each chat turn. 0 keeps none of that recordTRUSTED PROXIES
Comma-separated addresses or networks whose `X-Forwarded-For` is believed. Empty means loopback, private, link-local, and shared (`100.64/10`) addresses. A relay reached directly from the internet ignores the headerThe full list is `.env.example` in the `cloud` directory. Allowance, invite bonus, and whether sign-up is open can also be changed on the operator page while the relay runs; a value stored there overrides the environment until it is cleared.
CAVEATS
The CLI default bind is 0.0.0.0:8787, every interface, not loopback. Pass --host 127.0.0.1 for a local-only process. nanomuse serve is a different program and does bind to loopback by default.The apps only switch defaults to on. Clients whose User-Agent is not a nanoMuse app, the runtime, or a browser get 403. Member accounts are still answered. The error id is:
SEE ALSO
nanomuse(1), nanomuse-device(1), nanomuse-browser(1), nanomuse-open(1), uvicorn(1), fastapi(1), sqlite3(1), python(1), docker(1)
