Safeguard
Industry Analysis•

Self-hosted or hosted AI: what goes into the cost comparison?

Compare self-hosted and hosted AI by listing every cost line: hardware, utilization, people, security work and the hosted meters. A neutral worksheet.

Safeguard Security Team
8 min read

A fair comparison lists every cost line on both sides. Hosted AI bills by meters such as input and output tokens. Self-hosting replaces those with hardware, utilization, engineering time and security work. Compare cost per completed task at your real volume, not a rate per token against a GPU hourly figure.

Hosted: the meters

A hosted API charges by use. The pricing page of one provider shows how many meters can apply: input, output, cache reads and writes, batch, region, speed tier and tool use. Limits matter too, since your tier decides how much you can send per minute. See how to read an AI pricing page for the full list.

What you do not carry on the hosted side is the hardware, the serving stack and the on-call burden for the model itself. What you do carry is dependence on the provider's limits, terms and model lifecycle.

Self-hosted: the lines

Cost lineNotes
AcceleratorsBought or rented, whether busy or idle
UtilizationAn idle GPU still costs; low traffic raises cost per task
Memory fitWeights and the key value cache must fit, which is why quantization comes up
Serving softwareNeeds patching and upgrades
EngineersDeployment, monitoring, capacity planning, incident response
Security workImage scanning, network isolation, access control, model provenance
EvaluationYou own quality testing for every model change
RedundancyA second copy for failure, which doubles idle capacity

None of these needs a number to be on your worksheet. Fill in your own quotes.

The utilization question

The most common error is comparing a hosted rate to hardware cost at full use. Real traffic has peaks and troughs. If your demand is steady and high, owned capacity can be used well. If it is spiky or small, a meter that stops when you stop may fit better. This is general reasoning, so test it with your traffic shape.

Questions that decide it

  1. How many completed tasks per month, and how variable is that?
  2. Do you have data rules that prevent sending content to a provider? If so, the comparison may be moot.
  3. Do you need a specific model that is only offered one way?
  4. Who is on call when the serving stack fails at night?
  5. How quickly can you move if the provider changes terms or retires a model?
  6. What does a month of limits or an outage cost your business?

Security in either case

Self-hosting moves model security work onto you. Serving ports need locking down, images need scanning and weights need provenance checks. Our guides on locking down an inference port and scanning a GPU inference container cover the basics. Hosted use moves risk to key management, data handling terms and spend controls, covered in spend cap as a security control.

Build the worksheet

Put both options side by side with one row per line above, a column for owner and a column for source. Use measured tokens per task from a pilot. Date it. Include a row for what you would do to exit each option. For a broader frame, see build vs buy worksheet.

Safeguard's SBOM and dependency scanning can help inventory what your serving stack includes, which feeds the security lines of the self-hosted column.

Worked example: filling the worksheet with placeholders

Use letters, not figures. A team compares a hosted API with running one model on rented GPUs.

LineHostedSelf-hosted
Usage metersT tokens x rates, plus cache and batch effectsNone
HardwareNoneG GPUs x hours x rate, busy or idle
UtilizationNot your concernU percent, which scales cost per task
EngineeringIntegration onlyE hours per month for serving, upgrades, on-call
Security workKey management, data termsImage scanning, isolation, provenance, patching
RedundancyProvider'sSecond copy, R
EvaluationWhen you change modelEvery change
Exit effortSwitch providerMove hardware or contracts

Cost per task is then (all monthly lines) divided by (tasks completed per month). Run it for three volume cases. The crossover often moves with utilization, so show U explicitly and try a low, middle and high value.

Decision rules you can write down

  1. If data rules forbid sending content out, self-hosting or a private deployment is the only path, and the comparison is about which one.
  2. If traffic is small or spiky, favor the option whose cost follows usage.
  3. If you need a model that is offered only one way, that settles it.
  4. If you lack staff to run an on-call rotation for the serving stack, price that gap honestly.

A pilot before a decision

Run the hosted option for a month with real tasks and record tokens per task. Stand up a small self-hosted test with the same evaluation set and record throughput and memory. Compare on the same tasks, not on vendor claims. Write down what would change your mind, such as a volume threshold.

Presenting the result

Show leadership one chart with cost per task for each option at three volume cases, and a short list of non-cost factors: data rules, staffing, model availability and exit effort. Put your assumptions on the same page, with sources and a date. A comparison that hides assumptions invites a debate about the numbers, while one that shows them invites a debate about the assumptions, which is the useful one.

Exit and lock-in

Whichever route you choose, write down how you would leave it. For a hosted API, that means keeping prompts, evaluation sets and output formats portable, so another model can be tested quickly. For self-hosting, it means keeping the serving configuration in code and avoiding hardware specific tricks you cannot reproduce elsewhere. The cost of leaving is part of the cost of staying, and a team that has rehearsed an exit negotiates and plans from a stronger position.

Review the decision on a schedule, perhaps every six months, because models, prices, limits and your own volumes all move.

What this means for you

If you are weighing self-hosting against a hosted API, the honest answer is usually that it depends on your volume, your constraints and your staff, and that you will not know until you measure. Treat vendor claims and blog posts, including this one, as a list of questions rather than a verdict.

What helps most is to turn both options into the same unit, which is cost per completed task, and to be explicit about the assumptions behind each figure. A team that does this well can explain its choice to finance, security and engineering in one page.

Common mistakes

A frequent mistake is to compare a hosted rate per token with the price of a GPU at full load, which assumes the hardware is always busy. Another is to leave engineering time and on-call burden off the self-hosted side, because they do not appear on an invoice. A third is to forget the security work of running a serving stack: patching, isolating ports, scanning images and checking where weights came from. A fourth is to ignore how a model change affects either option, since a new model may need different hardware or a new evaluation. A fifth is to decide once and never revisit.

A step by step approach

  1. Define the workload: tasks per month, prompt and output sizes, and peak demand.
  2. Price the hosted route using the provider's current page, listing every meter that applies.
  3. Price the self-hosted route with real quotes, including idle time and a redundant copy.
  4. Add people costs for both routes, even if one is small.
  5. List the constraints that might decide the matter regardless of cost: data rules, model availability and latency needs.
  6. Run a small pilot of each and compare on the same evaluation set.
  7. Write the decision with its assumptions, and set a review date.

The result may be a mix, with sensitive or steady work in one place and spiky work in another.

Try it yourself

Click through it at your own pace, or open it full screen. Self-hosting means owning a stack of packages. The demo shows an inventory of dependencies, which is the first view you need to estimate the security upkeep on the self-hosted side.

Quick check

Is self-hosting always cheaper at scale?

Not necessarily. It depends on utilization, staffing and security work. Build the worksheet with your own numbers.

What is the most overlooked self-hosting cost?

Idle capacity and the engineering and security time to run the stack. Both are easy to leave off a comparison.

Can I compare per-token rates directly with GPU cost?

Not safely. Convert both to cost per completed task at your expected volume.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.