Skip to content

Add configurable model: CLAUDE_MODEL env var + /model command - #19

Open
Rithvik-katakamm wants to merge 5 commits into
linuz90:mainfrom
Rithvik-katakamm:feat/configurable-model
Open

Add configurable model: CLAUDE_MODEL env var + /model command#19
Rithvik-katakamm wants to merge 5 commits into
linuz90:mainfrom
Rithvik-katakamm:feat/configurable-model

Conversation

@Rithvik-katakamm

Copy link
Copy Markdown

Motivation

The Claude model is currently hardcoded to claude-sonnet-4-5 in src/session.ts. Anyone wanting a newer/cheaper/stronger model has to patch source. Model choice is also something you naturally want to change from your phone mid-conversation ("this needs opus") without touching the server.

Changes

  • CLAUDE_MODEL env var — sets the default model at deploy time (falls back to claude-sonnet-4-5, so existing installs are unaffected).
  • /model command — from Telegram: /model shows the active model, /model <name> switches it for new messages, /model reset returns to the default. Auth-gated like every other command.
  • Resolution order: .model-override file (written by /model) → CLAUDE_MODEL env → hardcoded default. Override survives bot restarts; file is gitignored.
  • New src/model.ts module; one-line change in session.ts (model: currentModel()).

Testing

  • bun run typecheck passes.
  • Running in production on my own instance: default via env, switched models mid-chat with /model, reset returns to env default; unauthorized users get the standard rejection.

🤖 Generated with Claude Code

https://claude.ai/code/session_011DCk7sXBrPZqBLyN166gey

Rithvik-katakamm and others added 3 commits July 5, 2026 22:07
… 4h, MONDAY_SESSION_IDLE_HOURS)

Root cause fix for multi-minute replies: the eternal session grew to ~624k
tokens and every reply after a >5min texting gap paid a cache-cold re-ingest.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
DAIJIROMATSUOKA pushed a commit to DAIJIROMATSUOKA/claude-telegram-bot that referenced this pull request Jul 12, 2026
Rithvik-katakamm and others added 2 commits July 18, 2026 14:41
…nders dispatcher delivered out-of-band (last 15 on fresh session, only-new on resume, offset persisted across restarts) — closes the delivery-bypasses-her-brain gap
…te model in code

'fable-5' (not a real ID; claude-fable-5 is) sat in .model-override since
07-17; every bridge query spawned Claude with a nonexistent model and died
with 'process exited with code 1' (in=0 out=0), surfacing as Monday erroring
on every reply. currentModel() now normalizes aliases (opus/sonnet/haiku/
fable and dash variants) to real IDs and ignores anything unresolvable,
falling back to CLAUDE_MODEL — a bad override can no longer take the bridge
down. setModel() validates before writing and reports success.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant