Claude API for support bots: a production-readiness list
A support bot that calls a model API fails in ordinary ways: slow replies, outages, leaked keys, bad inputs. A production-readiness list with a retry example to adapt.
Read articleA chat box on your site is the easy part. Keeping keys private, limiting scope and handing off to people is the real work. See the safe pattern and an example embed.
By the Askocto team · · 4 min read
To embed ChatGPT on your website, you place a chat interface on your pages and connect it to a language model through a server you control. The chat box is the easy part. Protecting your API key, limiting what the assistant can say and giving customers a way to reach a person are what separate a safe embed from an expensive mistake. This article covers the pattern and its main pitfalls.
In short: Never call a model directly from the browser with your key. Route messages through a server or a platform, ground the answers in your own content and make handoff part of the design.
People use the word for three different things, and the differences matter:
The rest of this article is mostly about the second and third, because they put the chat on your own page and let you shape what it does.
Anything in your page code can be read by any visitor. If a model API key sits in your JavaScript, someone can copy it and run up your bill or misuse your account. Your chat box should send messages to your own server, and that server adds the key and calls the model.
A model on its own answers from general knowledge. For customers, it must answer from your policies and product details, and say when the answer is not there. That means retrieval over your content, covered in RAG from scratch.
Decide what the assistant may discuss, and what it must refuse. Public chat boxes attract off-topic requests and attempts to override instructions. Add rules for scope, limit message length and request rates per visitor, and log what happens.
A chat box with no handoff traps customers who need a person. Offer a route to a human, with the conversation summary passed along.
With a platform, the key handling, content retrieval and handoff are part of the product. In Askocto the steps are:
The script is one line:
<script src="https://cdn.askocto.co/embed.js" data-agent-id="agt_123" defer></script>
After it loads, a global window.askocto is available for control from your own code. You can open the chat from a button, pass what you know about a logged-in customer, and listen for events:
document.querySelector("#help").addEventListener("click", () => {
window.askocto.open()
})
window.askocto.identify({
userId: "usr_1042",
userHash: "<signed on your server>",
name: "Dana",
email: "dana@example.com"
})
window.askocto.on("handoff", () => {
console.log("Conversation passed to the team")
})
The userHash is created on your server by signing the user id with the agent's identity secret, so visitors cannot pretend to be someone else. The identity verification docs show how.
| Consideration | Custom chat box on a model API | Platform widget |
|---|---|---|
| Control of look and behavior | Full | Configurable within the product |
| Key handling and rate limits | You build and maintain | Handled by the platform |
| Content retrieval | You build | Add sources and train |
| Handoff and inbox | You build | Helpdesk included |
| Time to launch | Weeks | Hours to days |
If a custom build tempts you, the ChatGPT API guide lists the full set of pieces. If you prefer the platform route, embedding an AI chat widget on any website covers site builders and frameworks, and the overview of adding custom GPTs compares the options. See the plans to find where to start with Askocto.
No. Anyone can read page code, so a key there can be copied and misused. Keep it on a server and let the browser talk only to your server.
For a custom build, yes. For a platform widget, you usually only paste a script, though a developer helps if you want to pass customer details or custom actions.
Write a clear scope in its instructions, add a list of topics to refuse, and test with off-topic and adversarial prompts before launch.
The script loads separately and can use the defer attribute so it does not block the page. Test your page speed with the widget installed and adjust where it loads if needed.
Askocto answers the repeat questions across chat, email and voice and hands the hard ones to your team.
A support bot that calls a model API fails in ordinary ways: slow replies, outages, leaked keys, bad inputs. A production-readiness list with a retry example to adapt.
Read articleFast models are tempting for chat and voice, but speed is only worth it if answers stay right. A protocol to measure latency and quality together on your own conversations.
Read articleUsing a model API in support means planning for slow calls, errors and changes. A pre-flight checklist and a thin wrapper keep Kimi K2 or any provider swappable.
Read article