Manual
User setup manual
From a built binary to a first successful gateway call. Every chapter ends at a state you can verify in the dashboard.
Synced with rivelo@683c35e
Before you install
Rivelo builds from source today. A release tag and a public container image do not exist yet.
- Install the toolchainGo 1.27 or newer, plus Node.js 22.22.1 or newer with npm. Node is only needed to build the embedded dashboard.
- Choose a data directorySQLite, WAL files, and request-log slices live together under one writable path. Leave room for the 1 GiB default storage budget.
- Plan your HTTPS edgeManaged mode issues Secure cookies, so terminate TLS at a reverse proxy that preserves the Host header. Nginx and Caddy examples ship in deploy/.
- Decide how secrets are injectedRivelo never reads a .env file. The master key, admin token, and public URL must arrive through your process environment or a launcher.
A published binary, GHCR image, and signed release do not exist yet. Build from source or build the container image locally.
Authoritative sourcedocs/operations/self-host.md
Build and start managed mode
Managed mode starts only when the master key, admin token, and public URL are present and valid.
- Build the binaryFrom the repository root, install dependencies and run the build. The dashboard is embedded, so Node is not needed at runtime.
- Start with real secretsExport the values below and start the process. The default listen address is loopback.
- Check the processGET /healthz only proves the process can answer. Log health lives under Settings or the admin telemetry API.
- Use HTTP only for loopback development-insecure-dev drops the Secure cookie attribute and is accepted only when both the listen host and the public URL host are loopback.
npm ci
npm run build
./dist/rivelo -version
export RIVELO_MASTER_KEY="$(openssl rand -base64 32)"
export RIVELO_ADMIN_TOKEN="$(openssl rand -hex 32)"
export RIVELO_PUBLIC_URL="https://rivelo.example"
export RIVELO_DATABASE_PATH="/srv/rivelo/data/rivelo.db"
export RIVELO_LOGS_PATH="/srv/rivelo/data/logs"
./dist/rivelo -addr 127.0.0.1:8080| Startup error | What to change |
|---|---|
| RIVELO_MASTER_KEY must be Base64-encoded 32 random bytes | Regenerate with openssl rand -base64 32; do not reuse a password. |
| RIVELO_ADMIN_TOKEN must be a distinct 32 to 256 character random token | Generate a separate token; it must not equal the master key, derive from it, or start with rv_proj_. |
| RIVELO_PUBLIC_URL must use HTTPS | Use HTTPS, or add -insecure-dev with a loopback public URL for local testing. |
| insecure development mode requires loopback listen and public hosts | Listen on 127.0.0.1 and set RIVELO_PUBLIC_URL=http://127.0.0.1:<port>. |
Store RIVELO_MASTER_KEY separately from the database. Losing it makes existing credentials and Project Keys undecryptable, and startup fails instead of falling back to plaintext.
Authoritative sourcedocs/operations/deployment.md
Sign in to the dashboard
The dashboard is served at /admin/. The administrator token is exchanged for a session cookie.
- Open the dashboardBrowse to /admin/. In loopback development that is http://127.0.0.1:8080/admin/.
- Enter the admin tokenPaste RIVELO_ADMIN_TOKEN and choose Sign in to the management interface.
- Verify the sessionThe shell shows Single administrator. Sessions are fixed at 12 hours and are not extended by activity.
- Sign out when doneSign out invalidates the cookie. Restarting Rivelo also clears every session.
- Cookie: HttpOnly, SameSite=Strict, host-only, Path=/api/admin/, Secure unless -insecure-dev
- Ten login attempts per minute per transport peer; forwarded IP headers are ignored
- Unsafe admin requests require same-origin; a proxy that rewrites Host causes 403
Authoritative sourcedocs/architecture/storage-and-admin-auth.md
Add a provider credential
Providers hold upstream accounts. Ten API-key presets ship in the binary, plus an alpha OpenRouter Decisions entry and an experimental ChatGPT-plan access method.

- Open Providers and choose Add ProviderSelect a preset, then Next step. The OpenAI preset uses https://api.openai.com/v1; each preset pins its own base URL.
- Choose an access methodAPI Key is the stable path. ChatGPT plan is the experimental Codex OAuth path and shows a risk notice before it starts.
- Enter the credentialName the provider (blank uses the preset name plus a suffix) and paste at least one key. Up to 32 keys per provider.
- Create and verifyCreation runs a non-billable model-list probe. It never issues a chat completion. Verify Provider re-runs the probe; model lists refresh on request.
- Optionally set a capacity poolEach key starts in its own independent pool. Bind keys of the same account to a shared pool, or set a USD cost cap on a monthly or cumulative window.

- Credential values are AES-GCM encrypted at rest and never returned by list APIs
- Full values appear only through an explicit reveal; rename and replace are separate operations
- Verification states: unverified, pending, valid, invalid, unknown, unsupported
- Removing the last key of a provider rejects the whole change
Plan-usage cards (OpenCode Go, Command Code, Codex, Ollama Cloud) are read-only upstream reports. They do not feed routing, capacity, or billing.
Authoritative sourcedocs/domains/providers/implementation-plan.md
Create a group alias
A group alias is the model name your client sends. Its candidates must share the same model, version, and protocol.
- Open Routing and create a groupGive it an alias such as deepseek-v4.1-flash. Aliases are case-insensitive and limited to 80 characters.
- Assert the model contractmodelContract records the model and version you verified. Rivelo never infers equivalence from similar names.
- Pick protocol and operationsChoose one wire protocol per group, such as OpenAI Chat Completions, and the operations it serves.
- Add candidates in orderOne to sixteen candidates. Each points at a provider and model, and the order is your primary, backup, and tie-break order.
- Choose a strategySmart, Cost first, In order, Free first, Speed first, or Least used. New groups default to Smart.
- Set optional routing detailsPrompt-cache affinity (auto or off, 60–86400 seconds), allowed effort values and a default, and whether every candidate accepts images.

| Strategy | Ordering rule |
|---|---|
| In order | Exactly your candidate order; pure failover. |
| Smart | Avoid pools near their limit, then earliest reset, then most remaining quota. |
| Cost first | Cheapest frozen price quote first; ties fall back to Smart. |
| Free first | Zero-price candidates first; needs price coverage to qualify. |
| Speed first | Ranked by TTFT plus TPS, with a 1-in-5 exploration of unproven paths. |
| Least used | Lowest known utilization fraction; unknown utilization last. |
A group cannot be deleted while a Project Key still grants it. Adjust the key's grants first.
Authoritative sourcedocs/domains/routing/implementation-plan.md
Issue a Project Key
Project Keys authenticate gateway calls. They never unlock the admin UI and they are not upstream credentials.
- Create a projectProjects group keys and request logs. Names are unique among visible projects; you can hold 100.
- Issue a keyOpen Project Keys and choose Issue Project Key, then pick the project.
- Choose the scopeAll groups/models covers current and future matching groups. Explicit grants allow one to one hundred groups.
- Copy the value onceThe server generates a 32-byte secret with the rv_proj_ prefix. The full value is shown only on create or reveal.
- Rotate without downtimeCreate replacement produces a new key with identical grants and keeps the old one active. Revoke the old key after you switch.

- Revocation is irreversible and clears the stored ciphertext
- A disabled project rejects authentication without revoking its keys
- Deleting a project soft-deletes it and atomically revokes every unrevoked key
- Reveal returns 409 key_revoked for a revoked key
Authoritative sourcedocs/domains/gateway/dashboard-pages.md
Call the gateway
Send the group alias as the model and the Project Key in the header that protocol expects.
curl "$RIVELO_PUBLIC_URL/v1/chat/completions" \
-H "Authorization: Bearer $RIVELO_PROJECT_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"hi"}]}'curl -N "$RIVELO_PUBLIC_URL/v1/chat/completions" \
-H "Authorization: Bearer $RIVELO_PROJECT_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4.1-flash","stream":true,"messages":[{"role":"user","content":"hi"}]}'curl "$RIVELO_PUBLIC_URL/v1/models" \
-H "Authorization: Bearer $RIVELO_PROJECT_KEY"curl "$RIVELO_PUBLIC_URL/anthropic/v1/messages" \
-H "Authorization: Bearer $RIVELO_PROJECT_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"<alias>","max_tokens":1024,"messages":[{"role":"user","content":"hi"}]}'curl "$RIVELO_PUBLIC_URL/gemini/v1beta/models/<alias>:generateContent" \
-H "x-goog-api-key: $RIVELO_PROJECT_KEY" \
-H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"hi"}]}]}'curl "$RIVELO_PUBLIC_URL/v1/videos" \
-H "Authorization: Bearer $RIVELO_PROJECT_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"video-alias","prompt":"waves at dusk"}'
curl "$RIVELO_PUBLIC_URL/v1/videos/<id>" \
-H "Authorization: Bearer $RIVELO_PROJECT_KEY"| Protocol | Auth header | Notes |
|---|---|---|
| OpenAI Chat, Responses, Images, Videos, Files | Authorization: Bearer rv_proj_… | Other key headers are rejected. |
| Anthropic Messages | Authorization: Bearer rv_proj_… or x-api-key | anthropic-version is required; anthropic-beta is optional. |
| Gemini | x-goog-api-key: rv_proj_… | Authorization is rejected; streaming needs ?alt=sse. |
| Vision MCP | Authorization: Bearer rv_proj_… | POST /mcp/vision with JSON-RPC tools/call analyze_image. |

| Response | Meaning | Fix |
|---|---|---|
| 401 invalid or missing Project Key | Admin token used, wrong prefix, revoked key, or disabled project | Use a rv_proj_ key from an active project. |
| 403 not authorized for this model | The key does not grant the group | Edit the key grants or use All groups/models. |
| 404 model not found | No enabled group matches the alias for this protocol | Check the alias, protocol, and that the group is enabled. |
| 503 capped pool paused | Pricing is missing or costs are incomplete on a limited pool | Add price coverage, raise the cap, or remove the limit. |
| 429 rate_limit_error | 16 requests already in flight | Queue client-side; there is no server queue. |
Authoritative sourcedocs/operations/support-matrix.md
Prototype versus managed
Prototype mode is for looking at the dashboard, not for serving traffic.
- No admin API and no /v1 gateway in prototype mode
- State lives in memory and resets on reload
- /projects and /keys redirect back to /gateway
- Plugins and sign-in are read-only previews
- GET /api/runtime reports the mode and assembled features
The component preview route exists only in development builds. Production builds do not include it.
Authoritative sourcedocs/domains/dashboard/prototype.md
Operate it
Overview, Requests, and Settings read the same SQLite files you run in production.
- Set the retention policySettings → Logs and storage. Defaults are delete-on-expiry after 7 online days, 100,000 requests, and 1 GiB. Switch to archive mode to keep a per-project total window.
- Query the right tierRequests and Overview never mix tiers. Archive queries need a project and at most 31 days.
- Review cost coveragePricing overrides, billing schedules, and media prices live under Settings. Built-in media rates are intentionally empty, so media cost stays unknown until you add entries.
- Back up offlineStop the service, copy the whole data directory, and checksum every file. Keep the master key outside the backup.
- Restore and reconcile keysVerify checksums, restore into new paths, start with the same master key, then re-apply every revocation that happened after the backup.
- Upgrade with a paired backupMigrations are bundled and applied at startup. An older binary refuses a newer schema, so roll back with the backup taken from the matching version.
# 1. Stop Rivelo and confirm the process has exited.
backup=/secure/backups/rivelo-$(date -u +%Y%m%dT%H%M%SZ)
mkdir -p "$backup"
cp -a /srv/rivelo/data/. "$backup/data/"
(cd "$backup" && find data -type f -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS)
# 2. Keep the master key and admin token outside this directory.
# 3. Restart Rivelo, then verify /healthz, sign-in, Providers, and Requests.(cd "$backup" && sha256sum -c SHA256SUMS)
# Restore into a new RIVELO_DATABASE_PATH / RIVELO_LOGS_PATH,
# keeping directory ownership, then start with the SAME master key.
| Limit | Value |
|---|---|
| In-flight requests | 16, no queue |
| Attempts per request | 3 actual attempts inside one 5-minute budget |
| Per-attempt timeout | 2 minutes; at least 2 seconds must remain to start one |
| Request and response | 4 MiB request, 16 MiB JSON response |
| Streaming | 1 MiB per SSE event, 64 MiB and 100,000 events per stream |
| Images | 25 MiB request, 10 MiB per file, 32 parts, 16 images |
| Video content | 512 MiB proxy limit, 7-day job and download window |
| Collections | 100 providers, 32 keys each, 100 groups, 16 candidates, 100 projects, 100 keys each |
Capacity limits are estimated soft caps. Reaching a cap or losing cost data pauses new attempts on that limited pool; work already in flight finishes.
Authoritative sourcedocs/operations/backup-restore.md
Authoritative source
This manual is a task-oriented guide. Authoritative contracts and defaults live in the repository docs.
- Install, upgrade, and rollback
docs/operations/self-host.md - Deployment and HTTPS
docs/operations/deployment.md - Backup and restore
docs/operations/backup-restore.md - Provider and protocol matrix
docs/operations/support-matrix.md - Connect, Projects, and Project Keys
docs/domains/gateway/dashboard-pages.md