# AI Cost Analysis: Junior vs Senior Developer

Analysis of token consumption, time, and cost when building this project with AI assistance (Claude).

## Project Scope

| Metric          | Value                                     |
| --------------- | ----------------------------------------- |
| Total LOC       | ~1,500                                    |
| Source files    | ~46                                       |
| Backend modules | 4 (REST, GraphQL, w/ and w/o DB)          |
| Infrastructure  | Docker, Nginx, SSL, Redis, PostgreSQL     |
| CI/CD           | GitHub Actions (3 stages) + deploy script |
| Frontend        | Next.js 16 + landing + 7 components       |

## Estimation Model

Each "interaction" with Claude = 1 prompt + 1 response. A **reprompt** occurs when the response wasn't useful and iteration is needed.

| Factor                             | Junior   | Senior     |
| ---------------------------------- | -------- | ---------- |
| Vague / poorly formulated prompts  | ~40%     | ~5%        |
| Reprompt rate                      | 60-70%   | 15-25%     |
| Need for explanation               | High     | Low        |
| AI-assisted debugging              | Constant | Occasional |
| Knows what architecture to request | No       | Yes        |

## Breakdown by Area

### 1. Monorepo Setup (Turborepo, pnpm, packages, configs)

|                        | Junior | Senior |
| ---------------------- | ------ | ------ |
| Initial prompts        | 15     | 5      |
| Reprompts              | 12     | 2      |
| **Total interactions** | **27** | **7**  |

### 2. NestJS Backend (4 modules, Prisma, GraphQL, Swagger)

|                        | Junior | Senior |
| ---------------------- | ------ | ------ |
| Initial prompts        | 40     | 12     |
| Reprompts              | 30     | 4      |
| **Total interactions** | **70** | **16** |

### 3. Next.js Frontend (landing, components, icons, MDX)

|                        | Junior | Senior |
| ---------------------- | ------ | ------ |
| Initial prompts        | 25     | 8      |
| Reprompts              | 18     | 3      |
| **Total interactions** | **43** | **11** |

### 4. Docker + Infrastructure (Compose, Nginx, Certbot, Redis)

|                        | Junior | Senior |
| ---------------------- | ------ | ------ |
| Initial prompts        | 20     | 6      |
| Reprompts              | 25     | 3      |
| **Total interactions** | **45** | **9**  |

### 5. CI/CD (GitHub Actions, deploy script, GHCR)

|                        | Junior | Senior |
| ---------------------- | ------ | ------ |
| Initial prompts        | 15     | 5      |
| Reprompts              | 20     | 3      |
| **Total interactions** | **35** | **8**  |

### 6. General Debugging / Troubleshooting

|              | Junior | Senior |
| ------------ | ------ | ------ |
| Interactions | 40     | 8      |

## Interaction Totals

|                        | Junior   | Senior  |
| ---------------------- | -------- | ------- |
| **Total interactions** | **~260** | **~59** |
| Reprompt ratio         | 48%      | 22%     |

## Token Estimation

Average per interaction (prompt + response + project context):

|                                                                  | Input tokens (avg) | Output tokens (avg) |
| ---------------------------------------------------------------- | ------------------ | ------------------- |
| Junior (long prompts, pastes full errors, asks for explanations) | ~4,000             | ~3,000              |
| Senior (concise prompts, precise context)                        | ~2,500             | ~2,000              |

| Metric                  | Junior             | Senior           |
| ----------------------- | ------------------ | ---------------- |
| **Total input tokens**  | ~1,040,000 (1.04M) | ~147,500 (0.15M) |
| **Total output tokens** | ~780,000 (0.78M)   | ~118,000 (0.12M) |
| **Total tokens**        | **~1.82M**         | **~0.27M**       |

## Cost in USD (by model)

### Claude Opus 4.6 ($15/1M input, $75/1M output)

|             | Junior      | Senior      |
| ----------- | ----------- | ----------- |
| Input cost  | $15.60      | $2.21       |
| Output cost | $58.50      | $8.85       |
| **Total**   | **~$74.10** | **~$11.06** |

### Claude Sonnet 4.6 ($3/1M input, $15/1M output)

|             | Junior      | Senior     |
| ----------- | ----------- | ---------- |
| Input cost  | $3.12       | $0.44      |
| Output cost | $11.70      | $1.77      |
| **Total**   | **~$14.82** | **~$2.21** |

### Claude Code Subscription (flat rate)

|                           | Junior         | Senior         |
| ------------------------- | -------------- | -------------- |
| Pro plan                  | 1 month ($20)  | 1 month ($20)  |
| Max plan (if Opus needed) | 1 month ($100) | 1 month ($100) |

## Time (weeks)

| Phase                      | Junior         | Senior          |
| -------------------------- | -------------- | --------------- |
| Monorepo + tooling setup   | 1 week         | 1 day           |
| Backend (NestJS + modules) | 2-3 weeks      | 3-4 days        |
| Frontend (Next.js)         | 1-2 weeks      | 2-3 days        |
| Docker + Infrastructure    | 1-2 weeks      | 1-2 days        |
| CI/CD                      | 1 week         | 1 day           |
| Debugging / polish         | 1-2 weeks      | 1-2 days        |
| **Total**                  | **7-11 weeks** | **1.5-2 weeks** |

## Executive Summary

|                       | Junior     | Senior      | Ratio    |
| --------------------- | ---------- | ----------- | -------- |
| **AI interactions**   | ~260       | ~59         | 4.4x     |
| **Tokens consumed**   | ~1.82M     | ~0.27M      | **6.7x** |
| **Cost (Opus API)**   | ~$74       | ~$11        | 6.7x     |
| **Cost (Sonnet API)** | ~$15       | ~$2.2       | 6.7x     |
| **Time**              | 7-11 weeks | 1.5-2 weeks | ~5x      |

## Key Insight

**67% of the junior's extra spending** comes from **reprompts** - iterating over responses they didn't understand, debugging errors they can't diagnose, and requesting explanations. A senior spends ~6.7x fewer tokens because they know **what to ask** and **validate quickly** whether the response is correct.

Infrastructure (Docker, Nginx, CI/CD) is where the junior struggles the most - these are areas where a single error can take 10+ reprompts to resolve vs 1-2 for a senior who can read logs and understands networking.
