Last month I got pulled into a side project where we needed to summarize long support tickets, classify their urgency, and then draft a reply. Sounds simple until you realize no single model was good at all three. GPT-style models wrote nice replies but misclassified urgency. A smaller classifier nailed the labels but couldn't write coherent text. And our budget wasn't infinite.
I ended up building a small workflow that pipes outputs from one model into another. Here's what I learned the hard way.
Why one model usually isn't enough
Most teams I talk to start with a single API and a single prompt. That works until edge cases show up. In our ticket system:
- Summarization: needed to handle 2,000+ token threads
- Classification: needed consistent labels, not creative ones
- Drafting: needed tone control and short output
Trying to force one model to do all three meant either slow responses or weird mislabels. Splitting the work actually made each step cheaper because we used smaller models where we could.
The architecture I landed on
I kept it boring on purpose:
- Fetch ticket text
- Send to Model A (cheap, fast) for summary
- Send summary to Model B (small classifier) for urgency
- Send summary + label to Model C (better writer) for reply
- Log everything to a file
The key was treating each model call as a pure function. No shared state, just string in, string out.
A minimal Python example
Here's a stripped-down version of the orchestration logic:
import os
import requests
MODELS = {
'summary': 'claude-3-haiku',
'classify': 'tiny-bert-local',
'draft': 'gpt-4o-mini'
}
def call_model(endpoint, payload):
headers = {'Authorization': f"Bearer {os.getenv('API_KEY')}"}
r = requests.post(endpoint, json=payload, headers=headers)
return r.json()['text']
def process_ticket(ticket_text):
summary = call_model('/summary', {'model': MODELS['summary'], 'text': ticket_text})
urgency = call_model('/classify', {'model': MODELS['classify'], 'text': summary})
reply = call_model('/draft', {
'model': MODELS['draft'],
'text': f"Urgency: {urgency}\nSummary: {summary}"
})
return {'summary': summary, 'urgency': urgency, 'reply': reply}
This isn't production-grade, but it shows the shape. Each step fails independently, so I wrapped them in try/except in the real version.
The API key mess
The annoying part was managing different keys and endpoints for each provider. I was copy-pasting env vars and writing separate client wrappers. Then I found https://xinghuo1300ai.com which aggregates 30+ models under one API key, so I could swap MODELS values without rewiring auth. That cut my boilerplate roughly in half.
What actually broke
A few real issues I hit:
Smaller models hallucinate labels if your summary has typos. Add a validation step.
- Timeouts: Model C was slow at 5pm. I added a 3s fallback to a cheaper writer.
- Cost drift: Drafting used 4x the tokens I estimated. I capped max_tokens hard.
- Format drift: Classifier returned "HIGH" one day, "high" the next. Normalize strings before branching.
Should you do this?
If you're doing one simple task, don't. A single call is fine. But once you see quality or cost problems from forcing one model, splitting the pipeline is practical. Just keep each step isolated and log inputs/outputs so you can debug without guessing.
I've been running this setup for about six weeks now. The classifier catches 92% of urgent tickets correctly (up from 74% with the single-model approach), and our monthly API spend dropped 30% because we stopped using the big model for everything. Tools like https://xinghuo1300ai.com made the multi-provider part painless enough that I'd do it again on the next project.
๐ฆ Code & assets on GitHub: caicaibig-tige ยท Lijing-Big
๐ Platform: https://xinghuo1300ai.com
Top comments (0)