Most of what people ship on top of an AI platform is a wrapper. A prompt goes in, a response comes out. Between them, one model, one call, one price.
Real apps do not look like that. They classify. They branch. They call tools. They summarise the classification output for a human. Different steps deserve different tiers.
Here is a real app you can build in about two hundred lines. Support ticket triage. Classify the incoming ticket. Route it to the right team. Draft a first response. Escalate when the ticket is hard.
The shape of the app
A support ticket arrives from a customer. We want to do four things with it.
- Classify. Which category does this belong in. Billing, technical, refund, general.
- Route. Which team should own it based on the category.
- Draft. What would a good first response look like.
- Escalate. Does this need a human right away.
These four steps have very different requirements. Classification is cheap and easy. Drafting needs coherent prose but not deep reasoning. Escalation deserves the smart tier because getting it wrong loses customers.
Setting up the wallet
Sign up at platform.taskclan.com, top up a wallet, and grab an sk_t1_ key from the API keys page. You will hit the SDK from your server. Keep the key out of any code that ships to a browser.
Install the SDK.
npm install @taskclan/sdkSet up the client.
import { Taskclan } from '@taskclan/sdk';
const taskclan = new Taskclan({
apiKey: process.env.TASKCLAN_API_KEY,
});Step 1: classify with T1 Core
Classification is a cheap, boring, high volume operation. This is Core territory.
async function classifyTicket(ticketText: string) {
const result = await taskclan.t1.chat({
tier: 'core',
messages: [
{
role: 'system',
content:
'You classify support tickets into one of four categories: billing, technical, refund, general. Respond with the single word category, nothing else.',
},
{ role: 'user', content: ticketText },
],
maxTokens: 10,
});
return result.text.trim().toLowerCase();
}Core answers in about a second. It costs a fraction of a cent. If you get ten thousand tickets a month, classification is a rounding error on your bill.
Step 2: route by category
This step needs no AI. Categories map to teams. Do it in plain code.
const TEAM_ROUTES = {
billing: 'billing@taskclan.com',
technical: 'engineering-oncall@taskclan.com',
refund: 'billing@taskclan.com',
general: 'support-general@taskclan.com',
};
function routeTicket(category: string) {
return TEAM_ROUTES[category] ?? TEAM_ROUTES.general;
}Not every step in an AI app needs an AI. This one is a switch statement. Move on.
Step 3: draft a first response with T1 Flow
Drafting a response needs coherent prose that matches the ticket in tone and content. Flow is the right tier here. Sonnet class.
async function draftResponse(ticketText: string, category: string) {
const result = await taskclan.t1.chat({
tier: 'flow',
messages: [
{
role: 'system',
content: `You draft a warm, professional first response to a support ticket. The category is ${category}. Address the customer by name if it appears in the ticket. Never promise a refund or a specific timeline. Sign off as 'The Taskclan team'.`,
},
{ role: 'user', content: ticketText },
],
maxTokens: 400,
});
return result.text;
}Flow writes a coherent two hundred word reply in a couple of seconds. It handles tone and constraints without you having to spell every step of the reasoning.
Step 4: escalate hard cases with T1 Max
Some tickets deserve a human immediately. Legal threats. Angry customers about to churn. Complex bugs affecting the account. Getting this call right is worth paying for the smart tier.
async function shouldEscalate(ticketText: string) {
const result = await taskclan.t1.chat({
tier: 'max',
messages: [
{
role: 'system',
content:
'You decide if a support ticket should be escalated to a human immediately. Reasons to escalate: legal language, threats to leave, urgent billing errors, security concerns, or explicit requests for a manager. Respond with a JSON object: { escalate: true|false, reason: string }.',
},
{ role: 'user', content: ticketText },
],
responseFormat: 'json_object',
maxTokens: 100,
});
return JSON.parse(result.text);
}Max costs more per call but you only call it on ambiguous tickets. And it catches the ones a Core classifier would have missed, which is the point of paying for the smart tier.
Wiring it together
The full triage function is a hundred lines of glue.
async function triageTicket(ticket: { text: string; from: string }) {
const category = await classifyTicket(ticket.text);
const team = routeTicket(category);
const [response, escalation] = await Promise.all([
draftResponse(ticket.text, category),
shouldEscalate(ticket.text),
]);
return {
category,
team,
draftResponse: response,
escalate: escalation.escalate,
escalateReason: escalation.reason,
};
}Two of the calls run in parallel because they are independent. The classifier is the fast prerequisite. Escalation and drafting happen concurrently.
Wrap it in an Express endpoint or a queue worker. Wire in your ticket ingestion (email, form, webhook). You have a triage service.
What you spent
For a typical ticket, you make three T1 calls.
- Core spends about 200 input tokens and 5 output tokens.
- Flow spends about 300 input tokens and 400 output tokens.
- Max spends about 300 input tokens and 50 output tokens.
Total cost is fractions of a cent per ticket. Ten thousand tickets a month costs low tens of dollars.
The equivalent app that always calls Max would cost ten times more for effectively the same outputs. That is the tier system paying off. You match each step to the tier that fits, and the bill drops without any of the work that matters getting downgraded.
Where to go from here
The pattern generalises.
- Content moderation: Core for the fast classify, Max only on borderline cases.
- Sales lead scoring: Core to extract fields, Flow to summarise, Max only for high value leads.
- Meeting transcripts: Core for filler removal, Flow for summarisation, Max for action item extraction.
Every real app has a mix of cheap and expensive tasks. Routing them is where the money is.
If you want to skip the plumbing entirely, Taskclan Studio ships an App Spec that captures apps like this as a document. You describe the four steps, Studio generates the endpoint, the UI, and the wallet integration.
Or use the SDK the way we just showed. Both routes end at the same T1 wallet.
