Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 13.2 — Open-Weights vs Hosted Models
LLM Engineering · Example 1 of 1

Break-even: hosted tokens vs your own GPUs

Every price and capacity number is a made-up variable. Replace them with real quotes and your measured throughput.

A hosted model is rented by the token and run by someone else. An open-weights model can be downloaded and run on hardware you control, which buys control and privacy but adds fixed costs and operations work. The break-even point decides when it pays.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 6 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write hosted_cost(requests, in_tokens, out_tokens, price_in, price_out) with prices per million tokens, and print the cost of 2,000,000 requests of 500 input and 100 output tokens at prices 0.50 and 1.50.

02

Write utilisation_percent(requests_per_month, capacity_per_month) rounded to one decimal, and print it for 3,000,000 requests against 10,512,000 capacity.

Explain it without notes

01

When does self-hosting an open-weights model beat a hosted API?

02

What does "open weights" mean, and what does it not mean?

03

What hidden costs does a self-hosting calculation usually miss?

Break-even: hosted tokens vs your own GPUs
Sign in to run this example in your browser.

Expected output

self-hosted fixed cost: 4420.00 dollars per month
hosted cost per million requests: 700.00 dollars
1000000 requests: hosted 700.00, self-hosted 4420.00 -> hosted is cheaper
3000000 requests: hosted 2100.00, self-hosted 4420.00 -> hosted is cheaper
6000000 requests: hosted 4200.00, self-hosted 4420.00 -> hosted is cheaper
9000000 requests: hosted 6300.00, self-hosted 4420.00 -> self-hosted is cheaper
break-even: 6314286 requests per month
that is 60.1 percent of the 10512000 requests the GPUs could serve