"""Inputs for the payback calculator. Each scenario is a dict; edit the numbers in place or copy one to add your own.

Token prices are in USD per 1M tokens. Electricity is in USD per kWh. Power is full-load system draw in kW.
The first six scenarios take their numbers from "If I Buy GPUs to Self-Host GLM and DeepSeek, How Many Years Until They Pay Back?" (2026-07),
so you can verify that the calculator reproduces the same figures. Edit MY_SETUP at the bottom for your own workload.
"""

SCENARIOS = [
    dict(
        name='GLM-5.2, 8×H200, vs. cloud API (uncached)',
        hardware_usd=400_000,
        power_kw=10.0, pue=1.2, usd_per_kwh=0.1354,          # Commercial electricity rate, including data-center PUE
        compare='api',
        output_tok_per_s=733,                                # Full-server throughput under 8K-input / 1K-output workload
        input_per_output=8,                                   # Input tokens read per 1 output token generated
        cache_hit_rate=0.0,
        price_input=1.40, price_input_cached=1.40, price_output=4.40,
    ),
    dict(
        name='DeepSeek-V4-Flash, 2×RTX PRO 6000, vs. cloud API (uncached)',
        hardware_usd=32_500,
        power_kw=0.85, pue=1.0, usd_per_kwh=0.1844,          # Residential electricity rate
        compare='api',
        output_tok_per_s=447.48,
        input_per_output=8,
        cache_hit_rate=0.0,
        price_input=0.14, price_input_cached=0.14, price_output=0.28,
    ),
    dict(
        name='GLM-5.2, 8×B300, vs. cloud API on agent workload (92% cached input)',
        hardware_usd=(400_000, 500_000),                      # Pass a (low, high) tuple to compute a payback range
        power_kw=14.5, pue=1.2, usd_per_kwh=0.1354,
        compare='api',
        output_tok_per_s=500,
        input_per_output=80_000 / 220,                        # 80,000 input and 220 output tokens per turn (~363.64:1)
        cache_hit_rate=0.92,
        price_input=1.40, price_input_cached=0.26, price_output=4.40,
    ),
    dict(
        name='DeepSeek-V4-Flash, 2×RTX PRO 6000, vs. cloud API on agent workload (92% cached input)',
        hardware_usd=32_500,
        power_kw=0.85, pue=1.0, usd_per_kwh=0.1844,
        compare='api',
        output_tok_per_s=230.21,
        input_per_output=80_000 / 220,
        cache_hit_rate=0.92,
        price_input=0.14, price_input_cached=0.0028, price_output=0.28,
    ),
    dict(
        name='GLM-5.2, 8×B300, vs. 1 Coding Plan Max subscription seat',
        hardware_usd=(400_000, 500_000),
        power_kw=14.5, pue=1.2, usd_per_kwh=0.1354,
        compare='subscription',
        seats=1, usd_per_seat_year=1_344,
    ),
    dict(
        name='GLM-5.2, 8×B300, vs. capacity-matched subscription seats (29 Max seats)',
        hardware_usd=(400_000, 500_000),
        power_kw=14.5, pue=1.2, usd_per_kwh=0.1354,
        compare='subscription',
        seats=29, usd_per_seat_year=1_344,                    # Full-load server capacity converted via weekly seat quota equals at least 29 seats
    ),
]

# Fill in your own numbers. compare='my_bill' benchmarks against your actual monthly API invoice, which is usually the most realistic row.
MY_SETUP = dict(
    name='My setup: single RTX 5090 running a small local model to replace a monthly API bill',
    hardware_usd=3_000,                    # GPU or full system purchase quote
    power_kw=0.6, pue=1.0, usd_per_kwh=0.18,
    hours_per_day=8,                       # Hours the machine runs per day (used to estimate electricity)
    compare='my_bill',
    monthly_api_bill_usd=150,              # Your current monthly API spend for the workload moving local
)
