Two changes:
1) /model — admin-only Telegram command that fetches GET
https://openrouter.ai/api/v1/models, filters to models whose
supported_parameters includes "tools", pins openrouter/free and
openrouter/auto to the top, then sorts the rest free-first /
alpha-by-name. Renders a vertically-stacked InlineKeyboard
(one model per row, capped at 20) with badges:
✅ <current> 🟢 free / 💰 paid 🛠 tools 🧠 thinking
Tap-to-select callback writes the model id into the new
settings(key,value) table. callOpenRouterOnce resolves the
model at every call (currentOpenRouterModel() → kvGet ??
OPENROUTER_MODEL env ?? "openrouter/free"), so the new pick
takes effect on the very next message — no restart, no
container rebuild.
2) /clear — was leaving its own confirmation message ("🧹 cleared
N messages from this chat.") in the DB, so the next /clear
would count it. Now wipes once, replies, wipes again — the
chat's messages row count truly stays at 0 across repeats.
Schema migration: CREATE TABLE IF NOT EXISTS settings(key, value,
updated_at) — idempotent, no Bun migration needed.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>