Framework Migration with AI Coding Agents: Cost Per 10K Lines for React 18→19, Vue 2→3, Python 2→3
By Eric Bush · July 3, 2026 · 9 min read
The Migration Question That Has No Public Answer
Framework upgrades are one of the least-loved but most-common uses of AI coding agents in 2026. Every engineering org has legacy React 17 or 18 apps, Vue 2 stragglers, and Python 2 pockets that need to migrate. The obvious question — "what will it cost to migrate this with Claude Code?" — has no public benchmark. This post fills the gap.
Numbers below come from three sources: published Claude Code case studies, our estimator's user-submitted data from 2025-2026, and calibrated projections for lines of code where we do not have direct measurement.
React 18 → 19 Migration
React 19 introduced Server Components as the default paradigm, new hooks (useOptimistic, useFormStatus), and reworked ref handling. For most apps the migration is mechanical — many changes are one-line replacements — but the Server/Client boundary requires component-level reasoning.
| Model | Cost per 10K lines | Manual cleanup % | Wall clock (10K lines) |
|---|---|---|---|
| Claude Opus 4.8 | $68 | 8% | ~2.5 hours |
| Claude Sonnet 5 | $28 | 14% | ~2 hours |
| GPT-5.5 | $32 | 12% | ~2.3 hours |
| DeepSeek V4 | $8 | 22% | ~1.8 hours |
Sonnet 5 hits the best cost-per-quality tradeoff. The Opus premium mostly pays off in Server/Client boundary reasoning — worth it for apps with complex data flows, wasted money for straightforward CRUD pages.
Vue 2 → 3 Migration
Vue 2 to 3 is a heavier lift — Composition API adoption, new reactivity system, Vuex to Pinia, and template syntax changes across every component. Higher token cost per line reflects the larger amount of code the model has to rewrite.
| Model | Cost per 10K lines | Manual cleanup % | Wall clock (10K lines) |
|---|---|---|---|
| Claude Opus 4.8 | $95 | 12% | ~4 hours |
| Claude Sonnet 5 | $42 | 19% | ~3.5 hours |
| GPT-5.5 | $48 | 18% | ~4 hours |
| DeepSeek V4 | $14 | 28% | ~3 hours |
Vue 3 migrations have more rewriting than translation, so the manual cleanup percentage grows on lower-tier models. The DeepSeek option can be attractive for large migrations but budget for higher review overhead.
Python 2 → 3 Migration
Python 2 to 3 is mostly deterministic — string handling, print statements, division, iterators — where tools like 2to3 do the mechanical work. The AI value shows up in the parts 2to3 cannot fix: type annotations, f-strings, dependency migration, and library API changes.
| Model | Cost per 10K lines | Manual cleanup % | Wall clock (10K lines) |
|---|---|---|---|
| Claude Opus 4.8 | $55 | 5% | ~2 hours |
| Claude Sonnet 5 | $22 | 9% | ~1.7 hours |
| GPT-5.5 | $25 | 8% | ~2 hours |
| DeepSeek V4 | $6 | 15% | ~1.5 hours |
Python migrations are the cheapest of the three because 2to3 does the deterministic heavy lifting for free — the model only needs to fix judgment calls.
Cost Scaling Beyond 10K Lines
Migration cost does not scale perfectly linearly. Three factors change the math for larger codebases:
- Prompt caching kicks in. A 200K-line codebase gets big cache hit rates on the shared context, reducing effective input cost by 40–60% beyond the first few thousand lines.
- Pattern extraction. After processing 20K lines of a codebase, the agent has learned local conventions. Later files migrate faster and more accurately.
- Cross-file coordination. Migrations that touch shared state (Vuex store, Redux slice, Django models) cost more per line than isolated component migrations because the agent must reason across files.
Rule of thumb: for a 100K-line codebase migration, multiply the 10K-line number by 8–9x rather than 10x, thanks to caching and pattern reuse.
Reducing Migration Costs
- Use deterministic tools first. 2to3, jscodeshift, and Vue's official migration build handle 40–60% of the mechanical work for free. Never pay Claude Opus for changes an AST codemod can do.
- Split large migrations by dependency layer. Migrate leaf files first (no imports), then move up the dependency graph. This lets the agent build local context iteratively.
- Two-pass model routing. Use DeepSeek or Sonnet for the first pass, Opus for the manual-cleanup portion. This can cut total cost by 40–60% versus running Opus on everything.
- Cache the pattern examples. Feed the model 3–5 already-migrated files as canonical examples. Prompt caching keeps these free for subsequent files.
Recommendation
- Budget between $25 and $95 per 10K lines for a framework major-version migration, model choice depending on the reasoning complexity of the specific framework changes.
- Do not skip codemods and deterministic tools. Every line handled by a free codemod is one you do not pay Claude for.
- Run a 500-line pilot before committing budget. The real cost varies by codebase style — a well-typed codebase migrates for 30–40% less than a loosely typed one.
- Measure manual cleanup percentage as the leading indicator, not per-token cost. If cleanup is above 20%, you are on a lower-tier model and losing engineer time to save API dollars.
Want to calculate exact costs for your project?
Frequently Asked Questions
How much does AI-assisted framework migration cost per 10K lines?
Depending on the framework and model: $6–$95. Python 2→3 with DeepSeek runs $6, React 18→19 with Claude Opus runs $68, Vue 2→3 with Opus tops out around $95. Sonnet 5 gives the best price-quality tradeoff for most migrations.
Should I use Claude Opus or Sonnet for framework migrations?
Sonnet 5 for the bulk work — it handles 80–90% of mechanical migration correctly at 2.5x lower cost. Reserve Opus for cases with complex cross-file reasoning like Vue 2→3 Vuex-to-Pinia store migrations.
Does DeepSeek V4 work for framework migrations?
Yes for cost-sensitive migrations, but expect 20–30% manual cleanup versus 8–15% on Claude. The cleanup engineer-hours often eat the savings unless the migration is very large.
How does prompt caching affect large migration costs?
Significantly. For codebases above 50K lines, prompt caching reduces effective input cost by 40–60% because shared context (imports, type definitions, patterns) is reused across files. Budget 8–9x the 10K-line cost for a 100K-line migration, not 10x.
Do codemods still matter with AI agents?
Yes — always run deterministic codemods (2to3, jscodeshift, Vue's migration build) first. They handle 40–60% of mechanical changes at zero API cost. AI agents should only pay for the judgment calls codemods cannot make.
Related Articles
Cross-Language AI Coding Pipelines: Cost of Mixing Python, Go, and Rust Agents
Practical 2026 guide to cross-language AI coding pipelines using Google ADK, A2A, and similar protocols. Per-language token economics, JSON-RPC overhead, and architectural patterns that save money.
AI Coding Cost Per Debugging Session: How Many Iterations Before You Should Rewrite From Scratch?
AI debugging sessions have compounding costs — each retry burns tokens. We give a decision framework for when to keep iterating vs abandon and rewrite, with the specific iteration threshold that flips the math.
Self-Hosted MCP Server Cost Math: EC2 vs Fly.io vs Cloudflare Workers for Coding Agents (2026)
Hosting your own MCP server for coding agents can be $5/month or $500/month depending on where you deploy. We compare EC2, Fly.io, and Cloudflare Workers with real numbers for a typical multi-developer setup.