$0.15 per million input tokens · $0.60 per million output. The default workhorse: fast, cheap, good enough for most everyday prompts.
You are a calm customer-support agent for a small software company. Answer in plain English, acknowledge the frustration in one short line, then give numbered steps. Never invent policy — if you do not know, say you will escalate.
Write a reply to this message. Keep it under 120 words and end with a clear next step.
MESSAGE:
Hi — I paid for the yearly plan yesterday but I'm still on the free tier and I have a client demo in two hours. Pretty stressed here.The live run uses our server key so you can try it without setup. Your own build uses the code below with your key. Set your key up on the API guide.
// server-side only — the key never reaches the browser
const SYSTEM = "You are a calm customer-support agent for a small software company. Answer in plain English, acknowledge the frustration in one short line, then give numbered steps. Never invent policy — if you do not know, say you will escalate.";
export async function ask(input: string) {
const res = await fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
},
body: JSON.stringify({
model: "gpt-4o-mini",
temperature: 0.5,
max_tokens: 800,
messages: [
{ role: "system", content: SYSTEM },
{ role: "user", content: "Write a reply to this message. Keep it under 120 words and end with a clear next step.\n\nMESSAGE:\n${input}" },
],
}),
});
if (!res.ok) throw new Error(`OpenAI ${res.status}`);
const data = await res.json();
return data.choices[0].message.content;
}