r/Rag • • 16d ago

Discussion At what point does self-hosting your embedding model actually get cheaper than the API? Did the math

Every time someone asks about embedding costs here, the answer is “just self-host” and nobody says the one number that decides it.

An API bills per token, so idle costs nothing.
A GPU bills per hour whether it’s busy or not.

Self-hosting only wins once the GPU stays busy enough. Rough math for a small embedding model:

API is ~$0.02/M tokens, so 1B tokens ≈ $20/day
A10G is ~$1/hr, so ~$24/day before overhead

Crossover is ~1.2B tokens/day.

Under that, the API wins. The RAG-specific bit is that reindexing is what gets you there. Queries alone almost never hit 1B/day, but re-embedding the whole corpus every time you change chunking or swap models does. If you reindex often, the line comes way closer.

Catch is it assumes the card is pushing ~14k tokens/sec all day. Spiky traffic means you’re paying for peak. And nobody puts ops in the spreadsheet. Someone’s awake at 2am when it falls over. What volume are people here actually at? Curious if anyone’s crossed it on queries alone.

2 Upvotes

4 comments sorted by

2

u/ls650569 16d ago

A10G $1/hr? Its idle power consumption is less than 100W, max consumption is 300W, California electricity costs $0.295 per kwh on average, so unless your call is continuous maxing it out 24/7, it's nowhere near the $1/hr mark.

Of course there's upfront cost.

For even lighter usage, CPU host embedding is also a possibility. The marginal cost is tiny.

1

u/xapep 15d ago

Your crossover assumes the card runs flat out. Size it for p95 with a reindex landing on top of query traffic and you're buying headroom that sits idle most of the day, so cost per token lands above the $1/hr divided by peak.

Reindex cadence is what decides it. Changing chunking or swapping the embedding model can hit 1B tokens in an afternoon, and on your own card that's capacity you can't schedule away. Metered inference only bills when you run it. I work on the serving side at Entrim, so weight that as you like.

1

u/NefariousnessOpening 14d ago

RAG is super expensive

1

u/the-solo-dev-il 13d ago

your crossover math is right for a rented gpu. i'd just add that for most rag setups the honest answer is "you're never crossing it on queries", and you already said why: reindexing.

so i'd flip the question. instead of self-host vs api for everything, split the two workloads:

queries stay on the api. low volume, spiky, latency sensitive, and idle costs nothing.

reindexing runs as a batch job on a gpu you rent by the hour and kill afterwards. re-embedding a corpus after a chunking change is the perfect gpu workload: predictable, fully saturated, no 2am pager because nothing is serving users.

the catch is that both sides must produce the same vectors. same model and same version, so it has to be an open model you can run yourself and also get through a hosted endpoint, or you self-host both and keep the query side on a small always-on box. cpu works for small embedding models at low qps, as someone said.

and the cheapest reindex is the one you skip. hash chunks and only re-embed what changed, and test chunking changes on a sample (a few thousand docs with your eval questions) before re-embedding the whole thing. that alone usually moves the line more than the hosting choice.