DEV Community

Davi
Davi

Posted on Originally published at blog.mago.team

Pricing and Portability: What Survives When the Numbers Change

Pricing and Portability: What Survives When the Numbers Change

This post closes the Agentic Engineering series with two appendices that any production system will need: a pricing snapshot by provider as of May 2026, and a portability table mapping the series' patterns across harnesses.

LLM pricing has dropped 30-60% per year since 2023. What costs $3/Mtok input today will likely cost $1.50 or less in 12 months. The numbers below will go stale. What won't: the four optimization mechanisms (token accounting, caching, batch, dispatching) and the logic behind each one. Whoever internalizes the structure recalibrates the numbers on their own.

Pricing snapshot: May 2026

Anthropic

Model Input (per Mtok) Output (per Mtok)
Claude Haiku 4.5 $0.80 $4.00
Claude Sonnet 4.6 $3.00 $15.00
Claude Opus 4.7 $15.00 $75.00

Output costs 5x more than input across the entire line. Prompt caching: write at 1.25x input (5 min TTL), read at 0.1x. Batch API: 50% discount, up to 24h timeout. Context window: 200k tokens standard, 1M in beta.

OpenAI

Model Input (per Mtok) Output (per Mtok)
GPT-5-mini $0.50 $2.00
GPT-5 $5.00 $20.00
GPT-5-pro $20.00 $80.00

Automatic caching without cache_control, applies to repeated prefixes in ~5min. Hit costs 50% of input. No cache write premium. Batch API: 50% discount, 24h timeout.

Google Gemini

Model Input (per Mtok) Output (per Mtok)
Gemini 2.5 Flash $0.30 $1.20
Gemini 2.5 Pro $4.00 $16.00
Gemini 2.5 Ultra $20.00 $80.00

Explicit context caching with controllable TTL from 5min to 24h. Composable with batch.

Self-hosted

Model cost is zero; real cost is GPU, electricity, and maintenance. Competitive models as of May 2026: Qwen3 30B-instruct (rivals Haiku, runs on one RTX 4090), Llama 4 Maverick 70B (rivals Sonnet on some dimensions, requires two A100s or one H100), DeepSeek-R3 (reasoning-tier, rivals Opus on math).

Self-hosting only makes sense when: high and stable volume (>500M tok/month), team with GPU ops expertise, or compliance requires data to stay within your perimeter.

Portability table

The 12 chapters of this series were written from the Claude Code perspective. The patterns are universal. The concrete implementations vary.

Pattern Claude Code LangGraph OpenAI Agents SDK AutoGen
System prompt .md file with frontmatter SystemMessage in StateGraph Agent(instructions=...) AssistantAgent(system_message=...)
Tool restriction allow/deny in permissions JSON tools=[Tool(...)] Agent(tools=[...]) register_function(name, callable=fn)
Skill file in ~/.claude/skills/ Tool with rich description Custom via tool description register_for_llm with docstring
Sub-agent dispatch Agent({model, addDir, tools}) Subgraph Agent.run(other_agent) GroupChat or nested_agent
Model selection `model: "haiku sonnet opus"` ChatAnthropic(model="...")
PreToolUse hook ~/.claude/hooks/PreToolUse.sh interrupt_before=["tool"] Custom middleware register_hook("on_tool_call", fn)
MCP server ~/.mcp.json MultiServerMCPClient mcp_servers=[...] Manual plugin
Cron loop PM2 cron_restart LangServe + APScheduler External coordinator script Scheduler plugin
Auto-memory memory/*.md LangGraph Memory (postgres) Session.state MemoryClient plugin
Audit chain PostToolUse hook + NDJSON LangSmith traces OTEL spans + custom hook Tracer plugin
Auto-pilot /eai skill + permissions interrupt_before=[] Agent.run(stream=False) human_input_mode="NEVER"
Kill switch file flag + pm2 stop Cancellation token External process kill chat_manager.stop()

What survives migration

Portable architecture, vendor-specific optimization.

The first layer, the patterns from this series, survives any migration: filesystem hand-off, deterministic coordinator, deny-by-default scope, NDJSON audit chain, evals with three families, spend caps. These patterns work in LangGraph, AutoGen, custom Python with the OpenAI API, any harness that exposes a filesystem to the worker.

The second layer, vendor-specific optimizations, you re-apply in the new stack. Prompt caching with cache_control is Anthropic-specific. OpenAI has different automatic caching. Gemini has different controllable TTLs. The multipliers change. The logic of "stable before volatile" is universal.

MCP as a protocol is open, but adoption in non-Anthropic harnesses was partial as of May 2026. LangChain had a beta adapter. OpenAI Agents SDK gained native support in Q4 2025. By 2027 it will likely be commodity.

The temptation when reading the series: "filesystem-based pipelines only work in Claude Code." False. They work in any harness with filesystem access. The complexity is in orchestration, not in the specific harness. The pattern is what persists; the tool is interchangeable.

Top comments (0)