keepalive: bill the TTS warm ping to its own team (agent:audio-keepalive)
The ping ran on the master key, so every row logged team_id '' and ~$0.19/day of real Tinfoil spend resolved to no alias: invisible on the panel, unseen by the digest, and the unexplained half of the spend-guard delta. audio_keepalive.py now reads the team key from /app/data/.keepalive_key (model-scoped to tinfoil/voxtral-tts, team budget $10/30d) and falls back to the master key, warning once, if the file is gone. README documents the key and how to recreate it.
This commit is contained in:
1 parent
41b8560f46
commit
2e1e35d7fb
3 files changed
+69
-24
No files matched your search
@@ -233,15 +233,28 @@ LibreChat (chat) does **not** talk to this gateway directly — it routes throug
|
||||
- `co-op/docs` — documentation, including the member-facing model list
|
||||
- `co-op/design-assets` — logos, fonts, brand materials
|
||||
|
||||
## Scheduled tasks (scheduler addon)
|
||||
## Audio keep-alive
|
||||
|
||||
The gateway pings the Tinfoil audio models every 10 minutes (`audio_keepalive.py`,
|
||||
declared in `CloudronManifest.json` → `addons.scheduler`) to keep the TEE audio
|
||||
enclave warm — voice mode then skips the ~24s cold-start after idle. TTS-only:
|
||||
an STT ping would cost $0.01/request (~$52/mo at 6/hr) versus $0.002 for TTS.
|
||||
The gateway pings the Tinfoil TTS model every 15 minutes (`audio_keepalive.py`,
|
||||
started by the loop in `start.sh`) to keep the TEE audio enclave warm — voice
|
||||
mode then skips the ~24s cold-start after idle. TTS-only: an STT ping would cost
|
||||
$0.01/request (~$52/mo at 6/hr) versus $0.002 for TTS — about **$0.19/day**.
|
||||
|
||||
The script reads the master key from `/app/data/.master_key` (written by
|
||||
`start.sh`); the `LITELLM_MASTER_KEY` env var is only exported into the litellm
|
||||
process, not scheduler tasks. Verify after deploys: `cloudron exec --app <id>
|
||||
-- python3 /app/code/audio_keepalive.py` should exit 0 silently, and the deploy
|
||||
log must show `setupAddons: ... scheduler ... audio_keepalive`.
|
||||
**Billing is the point of the key split.** The ping authenticates with the
|
||||
keepalive team's own key, read from `/app/data/.keepalive_key`: team
|
||||
`agent:audio-keepalive`, model-scoped to `tinfoil/voxtral-tts`, budget $10/30d.
|
||||
That is what puts the cost on the panel's own-spend line. The master key
|
||||
(`/app/data/.master_key`, written by `start.sh`) remains only a fallback: its
|
||||
requests log `team_id = ''`, which no alias resolves, so ~$0.19/day of real
|
||||
spend was invisible to the panel, the digest and the spend guard until
|
||||
2026-11-28. If the key file is missing the script warns once and still warms.
|
||||
|
||||
Recreate on a fresh data volume (from inside the container, master key from
|
||||
`/app/data/.master_key`): `POST /team/new {"team_alias": "agent:audio-keepalive",
|
||||
"max_budget": 10, "budget_duration": "30d"}` then `POST /key/generate {"team_id":
|
||||
<id>, "models": ["tinfoil/voxtral-tts"], "key_alias": "audio-keepalive"}`, writing
|
||||
the returned key to `/app/data/.keepalive_key`.
|
||||
|
||||
Verify after deploys: `cloudron exec --app <id> -- python3 /app/code/audio_keepalive.py`
|
||||
exits 0 silently, and a fresh `$0.002` SpendLogs row appears under
|
||||
`agent:audio-keepalive` within 15 minutes.
|
||||
Reference in new issue
Block a user