Model chooser / Run a customer-facing chat assistant / Recurring
Live chat is judged on answer quality, response time and cost per conversation, all at once. Sonnet 5 is Anthropic's speed-and-intelligence balance, handles tool calls for order lookups reliably, and caches your knowledge base between turns.
Why Claude Sonnet 5
How to use it
Claude API, TypeScript
Edit the parts in capitals, then run it.
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
const tools: Anthropic.Tool[] = [{
name: "lookup_order",
description: "Get status and tracking for an order by its number.",
strict: true,
input_schema: {
type: "object",
properties: { order_number: { type: "string" } },
required: ["order_number"],
additionalProperties: false,
},
}];
export async function reply(history: Anthropic.MessageParam[], instructions: string, articles: string) {
return client.messages.create({
model: "claude-sonnet-5",
max_tokens: 2000,
output_config: { effort: "low" },
system: [
{ type: "text", text: instructions, cache_control: { type: "ephemeral" } },
{ type: "text", text: `Relevant help articles:\n${articles}` },
],
tools,
messages: history,
}); // if stop_reason is "tool_use", run the tool and send the result back
}
Alternatives that also work
Pick it when volume is high and cost per conversation is the constraint, or customers send images and voice notes.
Pick it when your stack is on OpenAI. Terra is its balance of intelligence and cost.
Pick it when conversations cannot leave your infrastructure. Apache 2.0, runs on one GPU, and handles text and images.
Watch out for
Sources
Checked . Models change monthly; we re-check this page when they do.
Wiring it into a workflow that runs every week, with evals, fallbacks and a cost you can predict, is the work. Fifteen minutes, no deck.