What an API provider must answer
Before comparing model names, ask six operational questions:
| Question | Why it matters |
|---|---|
| Which model IDs are available? | Your router must not send traffic to a retired or missing model |
| Which request formats are supported? | Anthropic Messages and OpenAI-compatible requests use different bodies |
| How are limits and errors returned? | A bot needs a clear reaction to timeouts, rate limits and an empty balance |
| What usage data can you inspect? | Support teams must explain spikes and investigate failed replies |
| How is customer data handled? | Tickets can hold account, payment and personal details, so logs should avoid personal text |
| Can the bot switch routes? | A fallback keeps one provider incident from becoming a full outage |
Two habits follow from the table. Give the bot its own key with a limit, so a webhook bug cannot burn the whole balance, and prefer a compatible API, so a model change does not mean rewriting the client. codexkey exposes a live catalog through one service. Check the models documentation before you select a default, because IDs and terms can change.
For the first version, choose one working model, for example gpt-6-sol or claude-sonnet-5, and one fast model for simple classification. Treat Gemini, DeepSeek, Qwen and GLM as candidates to test on a real sample of dialogs. Never promise a user something the bot cannot do.
A support bot architecture
Keep the Telegram adapter thin. It receives an update, authenticates the chat, and sends a response or a progress event. Your application layer removes unneeded personal data, retrieves account data and knowledge, selects a model and checks the output. A queue controls retries and stops one slow model call from blocking every chat.
Telegram update
-> webhook and chat authentication
-> support service and knowledge retrieval
-> model router
-> API provider
-> policy check and human handoff
-> Telegram reply
The model should not decide whether an account is refunded, disabled or upgraded. Let a tool with an explicit permission perform the action, and ask a human for approval when the policy requires it. When the bot is unsure, or the user asks for something that touches money or an account, the backend opens a ticket and tells the user the question went to an operator.
Model routing for support
| Request | Starting model | Required check |
|---|---|---|
| FAQ and short instructions | claude-sonnet-5 or gpt-6-luna | Answer stays inside the knowledge base |
| Long policy explanation | claude-opus-5-5 or gpt-6.1-sol | All conditions and exceptions remain present |
| Ticket classification | gpt-6-luna or deepseek-v4-flash | Labels parse and match the rubric |
| Sensitive account case | Any tested route, then a human | No automatic state change without permission |
Treat the table as a starting route. Test it on anonymized tickets, including incomplete details and attempts to override the bot's rules.
A safe provider integration
Use environment variables for the key and the base URL, and keep the provider client on the server. Never put a key in a Telegram message, a browser bundle or a repository.
const client = new Anthropic({
apiKey: process.env.CODEXKEY_API_KEY,
baseURL: "https://api.codexkey.online",
});
const answer = await client.messages.create({
model: "claude-sonnet-5",
max_tokens: 700,
system: SUPPORT_POLICY,
messages: [{ role: "user", content: ticketText }],
});
Add a request ID to your logs and pass it to your support team. Log the model ID, elapsed time and outcome, but not full conversations by default.
After you sign up for codexkey, create a separate key for the webhook, set a limit and add three metrics: the share of escalations, the share of helpful answers and the average cost of a dialog.
Human handoff is part of the product
Show the user when a human has taken over the conversation. Give the agent the original question, the retrieved policy, the model's draft and the reason for escalation, and let the agent edit before sending.
Escalate on payment disputes, identity changes, legal threats, uncertain policy, repeated failed answers and an explicit request for a person. These conditions are easy to test and hard to undo after an automatic action.
Tests before launch
Create fixtures for a normal FAQ, an unknown question, a prompt injection, a rate limit, a provider timeout and a handoff. Check the text sent to Telegram and the state stored in your support system. A green API request does not prove the customer saw a correct reply.
Set a per-chat concurrency limit. Telegram users tap a button twice, resend a message, or trigger two webhook deliveries. Use an idempotency key for actions and a queue for generation.
FAQ
Is one provider enough for a Telegram support bot?
One provider simplifies operations, but keep a tested fallback or a human path for outages. The fallback must accept the request format and the prompt you send.
Can the model change a customer's account?
Only through a server-side tool with permissions, validation and an audit record. Refunds, identity changes and similar actions stay behind a human approval rule.
Which model should I take for the first Telegram bot?
Start with gpt-6-sol or claude-sonnet-5, then compare them on closed dialogs from your own support instead of choosing by brand. A faster model can handle bulk routing.
Can I send customer data straight to the model?
First decide which data the answer needs, remove the rest and check the handling against your own policy. For financial and account operations, leave confirmation to the backend and a person.
Where should I keep the API key?
In the server environment or a secret manager. Never send it to Telegram, the browser or a client-side app.
How do I check current model availability?
Use the models documentation and the live API catalog immediately before launch. A model list copied from an old tutorial is not a source of truth.