Skip to content
peakxdevPublic

About

Compare a hosted AI API bill with renting your own GPU for the same job. Runs in your browser.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gpu-cost

ci licence: MIT

Compare a hosted AI API bill with renting your own GPU for the same job.

gpu-cost demo page

Use it: https://peakxdev.github.io/gpu-cost/ (free, runs in your browser, and the link stores your numbers so you can share them)

Why

"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.

Presets

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.

What it leaves out

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.

Use the maths in code

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, … }

Development

node tests/test_calc.mjs
python3 -m http.server -d docs 8000   # then open http://localhost:8000

MIT licence. Made by Peak Software.

About

Compare a hosted AI API bill with renting your own GPU for the same job. Runs in your browser.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages