Sub topic 10
Build, buy, or use a hosted model
This chapter assumes you have read the earlier chapters on error cost, data availability, and cost and latency. It also assumes you can read short Python snippets. You have already decided that a feature fits AI. This chapter covers the next question: where the AI capability should come from. The answer feeds the decision scorecard in a later chapter.
The three options, defined
"Build, buy, or use a hosted model" is really a choice among three sourcing routes. They differ in who owns the model, who owns the data pipeline, and who carries the operational burden.
- Build means you train or fine-tune a model and run it yourself. You own the model weights, the training data pipeline, the serving infrastructure, and the retraining schedule.
- Buy means you adopt a finished product or vendor feature that solves the whole problem, such as a transcription service, a fraud-scoring platform, or a support-ticket classifier sold as software. You configure it, but the vendor owns the model.
- Use a hosted model means you call a general model through an API, such as a large language model from a cloud provider. You write the prompts, glue code, and evaluation. The provider runs the model.
A fourth route sits between build and hosted: running an open-weight model on your own infrastructure. It gives you control over the model without training from scratch, but you take on serving and capacity planning. This chapter treats it as a variant of build.
| Route | You own | Vendor owns | Typical time to first prototype |
|---|---|---|---|
| Build | Model, data pipeline, serving, retraining | Hardware, if rented | Weeks to months |
| Buy | Configuration, integration | Model, data pipeline, serving | Days to weeks |
| Hosted model | Prompts, glue code, evaluation | Model, serving | Hours to days |
Why the choice depends on earlier concepts
Two earlier chapters drive this decision.
Data availability decides whether building is possible at all. Training a custom model needs labeled examples and a feedback loop that keeps producing more. If you have a few hundred examples, you cannot train a reliable custom model. You can still use them to evaluate a hosted model, and that is often their best use. If you have millions of labeled examples tied to real outcomes, a custom model becomes realistic and may beat a general one on your narrow task.
Cost and latency decide whether a hosted model stays affordable and fast enough. Hosted pricing scales with usage. Self-hosting has a large fixed cost and a low marginal cost. Where the two lines cross depends on your volume.
Comparing the routes on the dimensions that matter
Speed to learn
A hosted model lets you test the idea before committing. For most features this is the strongest argument for starting there. You can build a prototype, run your evaluation set against it, and learn whether the feature works at all. A build decision made before this step often spends months on a feature that fails on error cost or user value.
Control and quality ceiling
Building gives you the most control. You can tune the model to your domain, fix its behavior, and keep it unchanged for as long as you like. A hosted model gives less control. The provider can update or retire a model version, and your prompts may behave differently afterward. Buying gives the least control, since you get whatever the vendor's configuration options allow.
Control does not always mean higher quality. A general hosted model trained on huge amounts of data often beats a small custom model on open-ended language tasks. A custom model tends to win on narrow, structured tasks where you hold proprietary labeled data, such as predicting churn from your own usage logs.
Cost structure
Costs have different shapes.
- Hosted: low fixed cost, with a per-request cost that grows with volume and with prompt length.
- Build or self-host: high fixed cost for compute, engineering time, and maintenance, with a lower cost per extra request.
- Buy: a license or per-seat price, often with usage tiers.
The most common mistake is counting only compute. Engineering time for monitoring, retraining, and on-call work often exceeds the hardware bill.
Operational burden
Whoever runs the model carries the burden of uptime, scaling, security patching, and drift (the gradual drop in quality as real inputs change). A hosted model moves most of that to the provider but adds a dependency you cannot fix yourself during an outage. Plan a fallback for that case, as described in the chapter on oversight and fallbacks.
Privacy and compliance
Sending user data to a third party creates obligations. Check what the provider stores, whether it trains on your inputs, where the data is processed, and what contract terms apply. If the data cannot leave your environment for legal or contractual reasons, hosted APIs may be ruled out, and the choice narrows to buying a vendor product deployed in your environment or running a model yourself.
A worked break-even estimate
You can estimate where self-hosting starts to pay off. The sketch below compares a hosted API, priced per token, against a self-hosted setup with fixed monthly costs. All prices are example numbers. Replace them with real quotes.
def hosted_cost(requests, in_tokens, out_tokens, price_in, price_out):
"""Monthly hosted cost. Prices are dollars per million tokens."""
per_request = (in_tokens * price_in + out_tokens * price_out) / 1_000_000
return requests * per_request
def self_hosted_fixed(gpus, gpu_hourly, engineer_share, engineer_monthly, hours=730):
"""Monthly fixed cost of self-hosting: compute plus engineering time."""
return gpus * gpu_hourly * hours + engineer_share * engineer_monthly
IN_TOKENS, OUT_TOKENS = 1500, 300
PRICE_IN, PRICE_OUT = 3.0, 15.0
per_request = hosted_cost(1, IN_TOKENS, OUT_TOKENS, PRICE_IN, PRICE_OUT)
fixed = self_hosted_fixed(
gpus=2, gpu_hourly=2.5, engineer_share=0.5, engineer_monthly=15000
)
break_even = fixed / per_request
print(f"hosted at 200,000 requests: ${hosted_cost(200_000, IN_TOKENS, OUT_TOKENS, PRICE_IN, PRICE_OUT):,.0f}")
print(f"self-hosted fixed cost: ${fixed:,.0f}")
print(f"break-even: {break_even:,.0f} requests per month")With these inputs, a request costs $0.009 on the hosted API. At 200,000 requests a month the hosted bill is $1,800. The self-hosted setup costs $11,150 a month before it serves a single request. The break-even point is about 1.24 million requests a month.
This model is deliberately simple. It leaves out several things:
- It assumes the self-hosted model matches the hosted model's quality. It may not.
- It assumes two GPUs can handle your peak load. Capacity limits can force you to add hardware.
- It ignores the cost of the evaluation and migration work.
- It ignores volume discounts and caching, which can lower the hosted price.
Use the number to see the order of magnitude. If break-even is ten times your current volume, you will not reach it soon, and a hosted model is the sensible default.
Lock-in and exit cost
Every route creates some dependency. Ask what it would cost to leave.
- Prompts and glue code tied to one provider's quirks take effort to move. Keep prompts in version control and put the model call behind one interface in your code.
- Evaluation sets are portable and are your main protection. If you can run the same test set against another model, switching is a measured decision and not a guess.
- Vendor products may hold your data and configuration in formats you cannot export. Ask about export before signing.
- Fine-tuned models on a provider's platform may not be downloadable.
Common errors
- Building first. Teams train a custom model before testing whether a hosted model is good enough. Start with the cheapest route that can pass your evaluation, and move up only when it fails.
- Comparing price per call and ignoring total cost. Staff time, monitoring, and retraining belong in the comparison.
- Ignoring data terms. A prototype built on real user data can become a compliance problem if the provider's terms were never checked.
- Assuming the model stays fixed. Hosted models are updated or retired. Pin versions where the provider allows it, and rerun your evaluation set on every change.
- Treating the choice as permanent. Volume, prices, and model quality shift. Record why you chose a route, so you can see when those reasons stop being true.
What to carry into the scorecard
In the decision scorecard, this chapter contributes one row: the sourcing route and the evidence behind it. A well-supported entry names the route, the measured quality on your test set, the estimated monthly cost at expected volume, the data-handling terms you checked, and the exit plan. A default that holds for most features is to prototype on a hosted model, measure, and move to a build or buy route only when cost, control, or compliance gives a concrete reason.
Exercise
A team expects 300,000 requests a month. A hosted API costs $0.009 per request. Self-hosting would cost about $11,150 a month in fixed compute and engineering time. The team has 400 labeled examples, and user data may leave their environment under their contracts. Which route should they start with, and what would make them reconsider?
Show answer
Start with the hosted model. The hosted bill is about $2,700 a month (300,000 x $0.009), far below the $11,150 fixed cost of self-hosting, and break-even is about 1.24 million requests. Four hundred labeled examples are too few to train a reliable custom model, but they are enough to evaluate a hosted model. Contracts allow the data to leave, so privacy does not block the hosted route. They should reconsider if volume grows toward the break-even point, if the hosted model fails the quality bar on their test set while a fine-tuned model passes, if the provider changes terms or retires the model, or if a compliance rule starts requiring that data stay in their environment.