cd /news/developer-tools/switch-ai-models-at-runtime-on-telny… · home topics developer-tools article
[ARTICLE · art-105200] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

Switch AI Models at Runtime on Telnyx Edge Compute

Telnyx has released a new example application, multi-model-inference-switcher, that allows developers to switch AI models at runtime on its Edge Compute platform without redeploying code. The TypeScript app uses Telnyx KV Storage to store the active model, which is read on each chat request, enabling instant model changes via UI or API. The example supports models like moonshotai/Kimi-K2.6, zai-org/GLM-5.2, and meta-llama/Llama-3.3-70B-Instruct.

read2 min views2 publishedAug 20, 2026

Most AI examples hardcode the model name.

That is fine until you actually want to compare models.

If every model change requires a code edit and redeploy, experimenting gets annoying fast. The multi-model-inference-switcher

example turns model choice into runtime configuration instead.

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

This is a TypeScript app running on Telnyx Edge Compute with the Agent SDK.

It gives you:

active-model

flagThe active model is read from Telnyx KV Storage every time /chat

is called. When you switch the model from the UI or API, the next message uses the new model immediately.

No redeploy.

GET /
  -> admin UI

POST /model
  -> validate model
  -> write active-model to KV

POST /chat
  -> read active-model from KV
  -> SwitcherAgent.process(text, model)
  -> Telnyx AI Inference
  -> return reply + model

The sample includes these models:

moonshotai/Kimi-K2.6

zai-org/GLM-5.2

meta-llama/Llama-3.3-70B-Instruct

Model choice is product behavior.

Changing the model can affect:

So it helps to make the active model observable and switchable without mixing that decision into application deploys.

Switch the active model:

curl -X POST https://multi-model-inference-switcher-<id>.telnyxcompute.com/model \
  -H "Content-Type: application/json" \
  -d '{"model":"zai-org/GLM-5.2"}'

Send a chat message:

curl -X POST https://multi-model-inference-switcher-<id>.telnyxcompute.com/chat \
  -H "Content-Type: application/json" \
  -d '{"text":"Explain feature flags for AI models."}'

Example response:

{
  "reply": "Feature flags let you change behavior at runtime...",
  "model": "zai-org/GLM-5.2"
}

Inspect history and usage:

curl https://multi-model-inference-switcher-<id>.telnyxcompute.com/history

The SwitcherAgent

uses:

The inference call looks like:

this.env.TELNYX.ai.openai.chat.createCompletion({
  model,
  messages,
  max_tokens: 2000,
  temperature: 0.7,
});

The key part is that model

comes from KV, not a hardcoded constant.

git clone https://github.com/team-telnyx/telnyx-code-examples.git
cd telnyx-code-examples/multi-model-inference-switcher
npm install

Create and seed KV:

telnyx-edge storage kv create --name "switcher-flag"
telnyx-edge storage kv key put <kv-id> active-model moonshotai/Kimi-K2.6

Set your namespace ID in telnyx.toml

, add your secret, and deploy:

telnyx-edge secrets add TELNYX_API_KEY <YOUR_API_KEY>
telnyx-edge ship

Before exposing this publicly, add:

/model

The small idea here is powerful: keep your app deployed, but make model selection something you can operate.

Resources:

── more in #developer-tools 4 stories · sorted by recency
── more on @telnyx 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/switch-ai-models-at-…] indexed:0 read:2min 2026-08-20 ·