Self-hosted LLM inference makes sense when an organization can name a specific limitation of an external service and is prepared to operate the model as a production system. API is usually better for proof of concept work, irregular traffic, and tasks where the quality of the available external model matters more than control over how it runs. Between these options are a dedicated managed endpoint, rented GPUs, and a hybrid architecture.
Prepared by Vladimir Lomtev’s AI Studio November 14, 2026, for product owners, CIOs, and technical leaders. This article breaks down how to choose an architecture. Vendor pricing, legal review, and the results of our own load test are not included. The company examples and calculations below are hypothetical; they show how to make a decision, not promise savings.
Contents
- What self-hosted inference means
- Quick decision matrix
- Who really needs a self-hosted setup
- When API is usually still the sensible choice
- Why headcount does not determine the choice
- How to compare cost without a universal break-even point
- Start with quality, then evaluate economics
- How to check team readiness
- When a hybrid approach helps
- How to migrate from API to your own inference stack
- Frequently asked questions
What self-hosted inference means
Inference is the execution of a model that has already been trained: the application sends input data and receives a result. Self-hosted inference means the organization manages the runtime model and the environment where it runs. Training a model from scratch is not required. You can use license-approved weights, choose an engine, and provide applications with an internal API.
The word “self-hosted” describes responsibility, not just ownership of hardware. A server can sit in an office, be hosted in a data center, or be rented from a cloud provider. If your team chooses versions, manages the queue, and is responsible for availability, a significant share of operational duties remains with you.
When you use an external API, the provider runs the model. You manage the application, data sending rules, error handling, and output quality. At the same time, you do not necessarily get access to the weights, the internal scheduler, or the exact hardware configuration. A more detailed comparison of deployment formats is shown in the overview of open LLM inference in a Russian cloud.
Quick decision matrix
| Situation | Where to start | What could change the decision |
|---|---|---|
| New product, demand still unknown | External API and a limited pilot | Confirmed recurring workload or data transfer restriction |
| Rare complex requests | API for a model that has passed quality review | Service unavailability, environment requirements |
| Repeated bulk text processing | Comparing API, batch processing, and your own inference | Actual load, cost per outcome, acceptable timelines |
| Fully isolated network | Local execution inside an approved environment | Ability to use an approved dedicated service |
| Own weights or adapter needed | Your own server or an endpoint that supports these artifacts | Platform compatibility and operational requirements |
| Small team without a service administrator | API or managed platform | A designated operations owner and a stable budget |
| Several data classes and task types | Hybrid setup with clear routing rules | No backup transfer allowed for certain data |
This matrix provides a starting point. The final decision depends on two sequential checks: whether the option is allowed at all and whether it delivers acceptable results at the required load.
Who really needs a self-hosted setup
Organizations prohibited from external processing of certain data
If an approved threat model, customer contract, or internal policy forbids sending a specific data set to an external provider, a local model becomes one of the architectural candidates. It is important to review the entire chain: document recognition, embeddings, generation, logs, backups, and agent tools. A local generator does not make cloud OCR local.
You should not automatically turn the presence of personal data into a universal ban on API use. Whether processing is allowed depends on the data set, participant roles, and applicable requirements. The architectural decision should be aligned with the people responsible for data and information security. This article does not determine the legal permissibility of any specific service.
Product teams with steady, repeatable workloads
Ticket classification, field extraction, and catalog processing can produce a fairly uniform stream. For these tasks, a small model that can stay loaded continuously and be served in batches is sometimes enough. That creates an opportunity to compare the total cost of self-hosted execution with an external API.
But the same number of requests can mean different amounts of work. A short category label and a multi-page analytical answer require different numbers of input and output tokens. Also account for peaks: a steady baseline and a morning spike in requests create different capacity requirements.
Teams that care about specific weights and release control
Self-hosted inference is useful when you need to lock in the model, tokenizer, conversation template, and adapter, and roll out updates on your own schedule. For example, a field-extraction system has passed acceptance testing with a specific artifact, and automatic behavior changes are undesirable.
This kind of control requires artifact storage, a change log, and a rollback procedure. Recording only the model name is not enough: the engine configuration and prompt construction method also affect responses. The fact that files are available for download does not replace reviewing the model license.
When API is usually still the sensible choice
An external API reduces the amount of infrastructure work needed to launch. The team can validate the user scenario before choosing GPUs, setting up containers, and organizing weight updates. This is especially useful if it is still unclear whether the product will be in demand.
The second case is irregular load. If processing is needed only a few times a week, a server that is paid for continuously may sit idle most of the time. However, compare other options as well: scheduled GPUs, batch jobs, and managed endpoints. “API or buy a server” is too narrow a framing.
The third case is about quality. Suppose a local model produces a cheap answer, but an employee often rewrites it manually. In that case, lower infrastructure cost may come with a higher total task cost. For complex analysis and long agent chains, what matters is response usefulness, the stability of tool calls, and the number of retries.
API does not eliminate application operations. You still need timeouts, rate-limit handling, error logging, cost controls, and a plan for model changes. A system that simply retries every failed request forever remains unreliable no matter where it runs.
Why headcount does not determine the choice
Ten employees can run continuous document processing, while several hundred can send one short question a day. The number of accounts helps estimate access rights and user support, but it does a poor job of describing compute load.
To make a choice, prepare a process profile:
- task type and the criterion for a correct result;
- number of requests on a normal day and during peak periods;
- distribution of input and output length;
- share of repeated context;
- acceptable wait time and number of concurrent requests;
- data sensitivity and allowed transmission directions;
- service owner and recovery time after an outage.
Track distributions, not just the average. An average document of a few pages can hide rare huge files that are what actually trigger memory failures. If the model is available through chat, take conversation history into account: the number of messages is not the same as the number of tokens processed.
How to compare cost without a universal break-even point
For an external API, you can start with this formula:
API cost = input tokens × input rate
+ output tokens × output rate
+ additional paid operations
Pricing units need to be converted into volume units. If the price is quoted per million tokens, divide the relevant volume by one million. Caching, batch mode, additional tools, and retries are accounted for under the actual terms of the chosen provider.
For self-hosted deployment, the structure is different:
Total self-hosted cost = hardware or rental
+ hosting and power
+ operations and support
+ capacity reserve
+ release and testing of updates
If you buy hardware, spread the costs over the chosen usage period; if you rent, use the actual payment structure. For both options, add integration costs and manual correction of responses. A detailed calculation model is available in the article on comparing the TCO of cloud and on-prem LLMs.
Illustrative calculation: a self-hosted setup costs 120,000 rubles per month, while external processing costs 1.20 rubles per task. Simple division gives 100,000 tasks per month. This is an arithmetic example with fictitious inputs. It only makes sense if the result quality is the same, throughput is achievable, and all costs are fully accounted for. Real pricing and load need to be plugged in separately.
First check quality, then economics
Collect a real task set that is anonymized or otherwise approved for processing. Include simple queries, long documents, missing data, ambiguous wording, and requests the model should refuse to answer. Do not cherry-pick examples only to make the demo succeed.
Define the evaluation rule in advance. For extracting data fields, this can mean matching every required field against the reference. For document Q&A, it can mean verifying claims against sources. For an agent, it means correctly completing the allowed action without exceeding its authority.
Compare versions on the same source data and record retries. If one option is allowed extra search and tools, note that in the results: you are comparing complete systems, not just models. The method for building a control set is explained in the article on building your own LLM benchmark.
How to assess team readiness
A self-hosted service needs an owner. Before buying hardware, answer who will update drivers, handle memory shortages, monitor the queue, restrict users, and roll back the previous version. If all answers come down to one person with no backup, that is a material architecture decision.
Check not for an abstract presence of DevOps, but for specific procedures. Can the server be restored from a description? Where are the weights and configuration stored? How do you tell whether the problem is in the model or in document retrieval? What happens to unfinished tasks after a restart?
A managed endpoint can reduce some of these responsibilities. In the Hugging Face Inference Endpoints documentation a separate format for managed model hosting is described. It should be evaluated by its specific terms, supported artifacts, and allowed environment, not treated as an automatic equivalent of a local server.
When hybrid is useful
A hybrid setup lets you distribute tasks by requirement. For example, a local model extracts fields from internal documents, an external API receives only approved anonymized text, and a difficult edge case is routed to a human. Another option is for the local model to handle the main homogeneous stream, while the external one is used for a separate class of tasks.
Routing should take data into account before choosing a cheaper or more available provider. If the local server fails, you cannot automatically send a confidential document to just any backup API. For some requests, the correct fallback is delayed processing or a manual route.
Separate observability channels as well. Even if generation is local, an external tracing service may receive the full prompt. The logging policy should specify which fields may be stored, who can see them, and when they are deleted. For gateway architecture, the article on a unified LLM API is useful.
How to move from API to your own inference
- Choose one process with a clear acceptance criterion instead of moving all requests at once.
- Record the current quality, latency, costs, and share of manual rework.
- Select approved models and verify compatibility with the hardware and engine.
- Run a comparison on the control set without changing the production route.
- Measure load using real request lengths, peaks, and retries.
- Prepare monitoring, access controls, redundancy, and rollback.
- Move the approved portion of the traffic after acceptance and keep the ability to roll back.
Documentation vLLM Benchmark CLI helps organize server performance measurement. However, synthetic generation speed does not replace business task acceptance. Retrieval time, file parsing, and external tools are part of the full user journey.
The mechanisms behind server settings are covered in the guide to engines and inference acceleration.
Frequently asked questions
Do I need to buy a GPU to test a local model?
No. For testing, you can use suitable hardware you already have or temporarily rent a GPU in an approved environment. It makes sense to discuss purchasing after quality and capacity requirements are confirmed.
Is an in-house LLM always cheaper than an API?
No. The result depends on utilization, model size, request length, redundancy, and team cost. Compare the cost per accepted task at the same quality, not just tokens.
Can I keep the app’s familiar interface?
Often yes: many servers provide compatible APIs. But compatibility needs to be checked for the features you use—streaming output, tools, structured responses, and error handling. The same endpoint address does not guarantee the same behavior.
What matters more: hosting in Russia or full control?
These are different requirements. Deployment location describes the geography of processing, while control covers access to weights, settings, and operations. In the project brief, they need to be checked separately.
When is it worth postponing in-house inference?
When there is no suitable model, no confirmed workload, no operations owner, or no budget for ongoing support. In that case, a suitable external service or managed hosting may fit the project’s current stage better.
How Vladimir Lomtev’s AI Studio helps choose the deployment setup
To choose between an API and your own implementation, Vladimir Lomtev’s AI Studio can connect process auditing with data preparation and LLM deployment: define the current task, test options on an agreed dataset, and integrate the selected model with the production system. These steps relate to auditing, testing, integration, and model hosting, and do not assume a predetermined cost-saving outcome.
The first step is to choose one process, its current cost, allowed data, and acceptance criteria. Discuss the project.
How to make the decision
In-house inference makes sense when there is a specific requirement: an acceptable deployment boundary, artifact control, or proven economics for a steady workload. An API is a better fit when speed to launch matters, you need access to a suitable model, and you want the vendor to handle execution and scaling. When data and task requirements differ, a hybrid approach can be useful.
Start with a process brief and a quality check. Then measure workload and total cost, assign an operations owner, and only after that choose hardware. That way, the decision will be based on how your system actually works, not on a universal token threshold or headcount.



