Tips > Data, APIs & Webhooks

Use Smaller AI Models for Classification and Routing Tasks

Not every AI task needs the most powerful (and expensive) model.

TipIntermediate2 min read

Not every AI task needs the most powerful (and expensive) model. Use cheaper, faster models for classification, routing, extraction, and yes/no decisions. Reserve the full-sized models for tasks that genuinely need them -- long-form generation, complex reasoning, or nuanced analysis.

Real-world example: A support ticket workflow classifies incoming emails into categories (billing, technical, feature request, spam), then routes them to the right team. Classification is a simple task that a small model handles perfectly.

Task-to-model mapping:

Classification/routing:
  Model: gpt-4o-mini or claude-3-5-haiku
  Cost: ~$0.0001 per classification
  Example: "Is this email about billing, technical support, or a feature request?"

Data extraction:
  Model: gpt-4o-mini or claude-3-5-haiku
  Cost: ~$0.0003 per extraction
  Example: "Extract the customer name, order ID, and issue from this email."

Summarization (short):
  Model: gpt-4o-mini or claude-3-5-haiku
  Cost: ~$0.0005 per summary
  Example: "Summarize this support ticket in one sentence."

Long-form generation:
  Model: gpt-4o or claude-sonnet-4
  Cost: ~$0.01-0.05 per generation
  Example: "Write a detailed response to this customer's technical issue."

Complex reasoning:
  Model: gpt-4o or claude-sonnet-4
  Cost: ~$0.02-0.10 per query
  Example: "Analyze this contract clause and identify potential risks."
```text
In n8n, configure the OpenAI or Anthropic node to use the appropriate model per task:

```json
// Classification node (cheap model)
{
  "resource": "chat",
  "model": "gpt-4o-mini",
  "messages": [
    {
      "role": "system",
      "content": "Classify the following support email into exactly one category: billing, technical, feature_request, spam. Respond with only the category name."
    },
    {
      "role": "user",
      "content": "={{ $json.emailBody }}"
    }
  ],
  "temperature": 0,
  "maxTokens": 10
}
```text
```json
// Generation node (powerful model, only called when needed)
{
  "resource": "chat",
  "model": "gpt-4o",
  "messages": [
    {
      "role": "system",
      "content": "Write a helpful, empathetic response to this customer support ticket. Include specific steps to resolve their issue."
    },
    {
      "role": "user",
      "content": "={{ $json.emailBody }}"
    }
  ],
  "temperature": 0.7,
  "maxTokens": 500
}
```text
```yaml
Cost comparison for 1000 support tickets/day:
  All gpt-4o:      1000 x $0.03 = $30/day = $900/month
  Smart routing:    1000 x $0.0001 (classify) + 200 x $0.03 (generate) = $6.10/day = $183/month
  Savings: ~80%
```text
The key insight: most tickets only need classification and a template response. Only the complex ones need a powerful model to generate a custom reply.

**Related:** [Use Structured Output (JSON Mode) for Parseable Responses](../ai-and-llm-integration/01-use-structured-output-json-mode-for-parseable-responses.md) | [Configure Payload Size and Binary Data Mode for Large Files](../performance-and-large-files/01-configure-payload-size-and-binary-data-mode-for-large-files.md)

Want this running in your stack?

I build production n8n and Cloudflare automation for teams — the same engineering behind HarperFlow. Fixed-price, escrow-protected, US-based.