Compare a hosted AI API bill with renting your own GPU for the same job.
Use it: https://peakxdev.github.io/gpu-cost/ (free, runs in your browser, and the link stores your numbers so you can share them)
"Should we use an API or run our own model?" usually gets answered by feel. The maths is simple, but nobody does it:
API cost = units × API price per unit
GPU cost = (units ÷ units per GPU-hour + start-up/idle hours) × GPU price per hour + fixed costs
The start-up/idle term is the one people forget. Every time you start a GPU you pay while the model loads. gpu-cost includes it, and shows the break-even volume where your own GPU starts to win.
Chat/LLM tokens, image generation, video clips and transcription. Every preset number is an example assumption, not a quote. Swap in your provider's current prices and your own measured throughput (units per GPU-hour). That one number matters most.
Setup and engineering time, model quality differences, privacy and compliance value (often the real reason to self-host), committed-use discounts, and price changes. It's a first look, not a procurement decision.
docs/gpu-cost.js is a dependency-free ES module:
import { compare } from './gpu-cost.js'
compare({ units: 3000, apiPricePerUnit: 0.04, gpuPerHour: 0.7, unitsPerGpuHour: 400, sessions: 8, overheadMin: 15, fixedPerMonth: 7 })
// → { api: 120, gpu: 13.65, cheaper: 'gpu', breakEvenUnits: 220, … }node tests/test_calc.mjs
python3 -m http.server -d docs 8000 # then open http://localhost:8000MIT licence. Made by Peak Software.
