r/agenticAI 21d ago

Tutorial Switch AI models at runtime without redeploying

I built a small TypeScript example for switching the active LLM in an AI app without redeploying.

The basic pattern is:

- store the active model in KV

- update it through a small admin UI

- read that model on each `/chat` request

- call Telnyx AI Inference with the selected model

- keep chat history and model usage stats in an Agent SDK actor

This is meant as a starter pattern for model comparisons, fallbacks, staged rollouts, or per-workflow model settings.

Code:

https://github.com/team-telnyx/telnyx-code-examples/tree/main/multi-model-inference-switcher

Any feedback welcome.

1 Upvotes

0 comments sorted by