IM
January 28, 2026·7 min read

APIs vs Training: Lessons from Building AI Agents

AIAgentsArchitecture

Building AI agents taught me something counterintuitive: the less you try to train, the faster you ship. Here's how I think about the API vs training decision.

The Default Should Be APIs

Every time you consider training a model, ask: "Can I get 80% of the result with an API call?" The answer is usually yes. OpenAI, LLM, Claude - these models are incredibly capable out of the box.

My social media agent doesn't have a custom model for content generation. It uses LLM with a carefully crafted system prompt that includes brand voice guidelines, example posts, and formatting rules. Zero training required.

When APIs Fall Short

APIs become limiting when:

  • Latency matters. API calls take 1-5 seconds. If you're moderating a chat with dozens of messages per second, that doesn't scale.
  • Costs explode. At 100k+ requests/day, API costs can exceed hosting your own fine-tuned model.
  • Privacy is critical. Some data can't leave your infrastructure.
  • The task is niche. General-purpose LLMs struggle with highly specialized domains (medical, legal, etc.).

The Hybrid Approach

Most of my agents use a hybrid architecture:

1. Fast path: Local classifier for obvious cases
2. Slow path: API call for complex reasoning
3. Cache: Store API responses for similar inputs
4. Fallback: Default behavior when API fails

For moderation, I run a lightweight local model first. It catches 70% of violations instantly. Only ambiguous cases go to the API for nuanced judgment. This cuts costs by 60% while maintaining accuracy.

The Real Trade-off

APIs trade money for time. Training trades time for money. When you're building, time is more valuable. When you're scaling, money might be.

Start with APIs. Always. You can optimize later with training once you know what actually needs optimizing. Premature optimization in AI is just as dangerous as in regular software.