Self-hosted LLM vs cloud API: when it pays off and what drives the cost

A self-hosted LLM - a language model running in your company's own infrastructure or private cloud - pays off when you process confidential data, have a large and predictable volume of queries, or need a model adapted to specialist language. A provider's model accessed through an API wins at the start: it needs no hardware, gives you access to the largest models and is billed for actual use. “Self-hosted” does not mean trained from scratch - in a business setting it usually means a ready-made open-weight model connected to the company's documents.

The first business uses of language models usually start with a public cloud service: a few chat accounts, then an API integration. Sooner or later the question arises: would it be better to run your own, self-hosted LLM - with data that never leaves the company and a cost that does not grow with every query? The answer depends on three things: what data will go into the model, how many queries there will be each month, and what quality of answers you need.

Below we compare a self-hosted LLM with API access, explain what drives the cost, what API providers promise about your data, which licences open-weight models come with and what the law says. At the end you will find the questions worth answering before you decide.

What a self-hosted LLM actually means

In a business setting, a “self-hosted language model” almost never means a model trained from scratch. It is a ready-made open-weight model - for example the Polish model Bielik, or one from the Mistral, Llama or Qwen families - running on servers that the company controls:

  • in the company's own infrastructure (on-premises),
  • in a provider's private cloud in the EU - on dedicated GPUs,
  • in the company's own cloud account in a European Union region.

The model most often gets its knowledge of the company through RAG, i.e. document retrieval: before answering, the system finds the relevant passages and passes them to the model. Fine-tuning is used when the model needs to master specialist language or a fixed response format. We compare the two approaches on our private LLM page.

Self-hosted LLM vs API: a comparison

A self-hosted language model vs a provider's model via API - comparison
Criterion Self-hosted model (on-premises or private cloud) Provider's model via API
Where the data goes Stays in the company's infrastructure or with its provider in the EU Goes to the service provider; the region and retention period depend on the contract and settings
Cost model Mainly fixed costs: hardware or GPU rental, maintenance, the team Variable cost: a fee for input and output tokens
Upfront cost Higher - infrastructure, deployment, testing Low - an account and an integration are enough
Access to models Open-weight models, usually smaller than the largest commercial models The provider's largest and newest models
Version stability The company decides when to change the model The provider changes, retires and reprices models on its own schedule
Fit with the company Complete freedom: fine-tuning, custom filters, integration with access rights Within the limits of what the provider offers
Skills You need a team to maintain the infrastructure, monitoring and updates Model maintenance is on the provider's side
Control and audit Full logs, control over access and data location Based on the provider's documentation, contracts and reports

In short: an API is the fastest way to find out whether AI solves the problem at all - provided the data you send is allowed to leave the company. A self-hosted model starts to pay off when the data is sensitive, the query volume is high and the use case is stable enough for the fixed cost to be spread over many months.

What happens to your data in a provider's API

Model providers describe how they process data in their documentation and contracts. As of 8 October 2026, the key rules for API services are as follows:

Data processing rules in selected providers' APIs (according to their documentation)
Service Data used for training Retention Processing in the EU
OpenAI API Not by default (since 1 March 2023), unless the customer opts in Abuse monitoring logs for up to 30 days; Zero Data Retention for eligible customers once approved by the provider A Europe region (EEA and Switzerland) under additional contractual terms
Anthropic API Not by default in commercial products Deleted within 30 days (longer in the event of a usage policy violation); Zero Data Retention by arrangement with the provider The direct API offers no choice of an EU region; the region is chosen through partners' cloud platforms
Google Gemini API (paid) Not in paid services Abuse monitoring for up to 55 days; according to Google, guaranteed zero retention is offered in Vertex AI Data may be stored transiently in any country
Google Vertex AI Not without the customer's prior permission Cache for up to 24 hours; abuse logs in certain cases An EU endpoint and regions in the EU

These rules change more often than the law, so before you send company data, check the current contract, your account settings and the processing region. From a data protection point of view, an API provider is usually a processor, which means you need a data processing agreement. Processing by a processor is governed by a contract that sets out the subject matter and duration of the processing, its nature and purpose, the type of personal data, the categories of data subjects and the obligations and rights of the controller (Art. 28(3) GDPR). When personal data leaves the European Economic Area, the rules on international transfers also come into play: personal data may be transferred to a third country only if the conditions laid down in Chapter V of the GDPR are met (Art. 44 GDPR).

What drives the cost: API

With an API you pay for tokens - the chunks of text into which the model splits the query and the response. Providers' price lists give rates per million tokens, separately for input and output tokens, with discounts for batch processing and repeated context (caching). The monthly cost can therefore be estimated with a simple formula:

cost ≈ number of queries × (input tokens × input rate + output tokens × output rate)

Input tokens are the ones most often underestimated. In a RAG system, every question carries document passages, instructions and the conversation history with it - a question of a few dozen words turns into several thousand input tokens. The second factor is the choice of model: the largest models cost many times more per token than smaller ones, and for many tasks (classification, extracting data from documents) a smaller model is enough.

What drives the cost: a self-hosted model

With a self-hosted model, the cost depends mainly on the hardware, and the hardware depends on the size of the model:

  • GPU memory for the model weights - according to the Hugging Face documentation, about 2 bytes per parameter at 16-bit precision, i.e. about 14 GB for a model with 7 billion parameters; 8-bit quantisation cuts this roughly in half, and 4-bit roughly to a quarter, at the cost of some quality,
  • memory for the context (KV cache) - grows with the length of the text and the number of concurrent requests; according to NVIDIA, for a 7B model with a context of 4,096 tokens this comes to about 2 GB per request,
  • number of users and expected response time - these determine how many GPUs and servers you need,
  • buying or renting - buying is a capital expense and carries the risk of unused capacity; GPU rental in the cloud is billed by the hour according to providers' official price lists, including in regions in Poland and elsewhere in the EU,
  • maintenance - monitoring, updates, backups, security testing and the people who look after all of it.

Because much of the cost of a self-hosted model is fixed, the break-even point is set by the number of queries: the more there are, the lower the cost of each one. Hardware and service rates change quickly, so rather than copying figures from price lists, cost both options on your own data - after a prototype that shows the real load.

Licences of open-weight models

“Open weights” does not always mean “use it however you like”. Before choosing a model, check the licence of the specific version:

  • Bielik (SpeakLeash) - a Polish model; version 3.0 is released under the Apache 2.0 licence, which permits commercial use.
  • PLLuM - Polish models whose licences depend on the variant: some of the latest models under Apache 2.0, the variants based on Llama under the Llama 3.1 licence, while older variants marked “nc” rule out commercial use.
  • Llama (Meta) - a community licence with restrictions, including for very large services; for the multimodal Llama 3.2 models and for Llama 4, the licence does not grant the rights under section 1(a) to companies whose principal place of business is in the EU.
  • Mistral - many models under Apache 2.0, but some under other licences.

A licence also raises the question of the model's provenance: what it was trained on, and whether using it could shift legal risk onto your company.

The AI Act and your own assistant

Running your own model does not exempt you from the rules on artificial intelligence - sometimes it adds to them. Providers and deployers of AI systems take measures to support the development of AI literacy among their staff, without being required to ensure a specific level of literacy for each individual (Art. 4(1) AI Act). This obligation has applied since 2 February 2025.

A company that builds its own AI assistant and puts it into service under its own name may be a provider within the meaning of the AI Act. A provider is an entity that develops an AI system, or has one developed, and places it on the market or puts it into service under its own name or trademark (Art. 3(3) AI Act). It is then subject to the transparency obligations, which have applied since 2 August 2026: the provider of an AI system that interacts directly with people ensures that the person knows they are interacting with AI, unless this is obvious (Art. 50(1) AI Act).

If the assistant is meant to support decisions in high-risk areas - e.g. recruitment or credit scoring - the requirements are much broader. We write more about AI security and regulation on our AI security page.

A hybrid model: you do not have to choose once and for all

Many companies combine both approaches. Sensitive data and high-volume tasks are handled by a self-hosted model, while general tasks on public or anonymised data go to a provider's model via API. The condition: clear rules on which data may go to which service, enforced technically in the application rather than only in instructions for staff.

Questions to answer before you decide

  1. What data will go into the model, and is it allowed to leave the company's infrastructure or the EU?
  2. How many queries a month do you expect at launch, and how many a year later?
  3. What quality of answers do you need, and how will you measure it - do you have a test set with expected results?
  4. Does the task need the largest model, or will a smaller model with good document retrieval do?
  5. Who will maintain a self-hosted model: the infrastructure, updates, monitoring and security?
  6. What are the terms of the contract with the API provider: training on your data, retention, region, sub-processors?
  7. Does the licence of the chosen model allow your use case?
  8. Will the application pass a security test - prompt injection, data leaking between users, permissions in document retrieval?

How we work with language models

We build AI solutions with models deployed in one of three ways:

  • Private cloud in the EU - dedicated GPUs in a private cloud in the European Union - with no external AI model providers.
  • On-premises at your site - the model runs on servers in your own server room, and the data does not leave your infrastructure.
  • Your cloud in an EU region - deployment in your own AWS, Azure or GCP account, in a European Union region.

We apply the Zero Data Retention principle: we process documents and queries without retaining them once processing is complete. We do not start by buying servers: first we build a prototype on your data, with a test set and expected results, and we decide on the next steps based on numbers, not on the impression a demo makes. We test the security of applications built on language models, including the risk of prompt injection, as part of an application and API penetration test.

Details are on our private LLM page, and the wider context of AI deployments on our AI implementation page.

Frequently asked questions

Does a self-hosted LLM have to be trained from scratch?

No. Training a large model from the ground up takes enormous datasets and computing power, so companies use ready-made open-weight models. The model gets the company's knowledge through document retrieval (RAG), and fine-tuning is used when the model needs to master specialist language or a fixed response format.

How much GPU memory does a language model need?

Roughly 2 GB for every billion parameters at 16-bit precision - according to the Hugging Face documentation, a 7B model takes up about 14 GB. 8-bit quantisation cuts this roughly in half, and 4-bit quantisation roughly to a quarter. On top of that comes memory for the context (the KV cache), which grows with the length of the text and the number of concurrent requests.

Is data sent to a model provider's API used for training?

According to the documentation of OpenAI, Anthropic and Google (for paid services), data sent through the API is not used to train models by default. Providers do, however, retain it for a set period, among other things to monitor abuse, and a mode with no data retention (Zero Data Retention) is available only under specific conditions. Check the contract, your account settings and the processing region before you send company data.

Can the Polish models Bielik and PLLuM be used commercially?

It depends on the version. Bielik 3.0 is released under the Apache 2.0 licence, which allows commercial use. PLLuM models come under different licences: some of the latest variants under Apache 2.0, the variants based on Llama under the Llama 3.1 licence, while older variants marked “nc” rule out commercial use. The licence has to be checked for each specific model version.

Sources

  1. Artificial Intelligence Act - consolidated text applicable from 27 July 2026 (02024R1689-20260727) ()
  2. Regulation (EU) 2026/1744 of the European Parliament and of the Council of 8 July 2026 amending Regulation (EU) 2024/1689 (Digital Omnibus on AI), OJ L, 2026/1744, 24.7.2026 ()
  3. Regulation (EU) 2016/679 of the European Parliament and of the Council (General Data Protection Regulation, GDPR), OJ L 119, 4.5.2016, as corrected by OJ L 127, 23.5.2018 - consolidated text ()
  4. OpenAI - Your data (API documentation: data usage, retention, Zero Data Retention, data residency) ()
  5. Anthropic - Is my data used for model training? (commercial products) ()
  6. Anthropic - How long do you store my data? (retention period) ()
  7. Anthropic - Data residency (API documentation) ()
  8. Google - Gemini API Additional Terms of Service ()
  9. Google - Gemini API: Zero Data Retention ()
  10. Google Cloud - Vertex AI: data residency ()
  11. Hugging Face - Optimizing LLMs for Speed and Memory (memory requirements) ()
  12. NVIDIA Technical Blog - Mastering LLM Techniques: Inference Optimization (KV cache) ()
  13. SpeakLeash - Bielik-11B-v3.0-Instruct (model card, Apache 2.0 licence) ()
  14. PLLuM-12B-chat-2512 (model card) ()
  15. Meta - Llama 4 Acceptable Use Policy and licence ()
  16. Mistral AI - Models (models and licences) ()

Legal status as of Updated

Related articles

Let's talk about your project or audit

Tell us briefly what you need - we will come back with proposed next steps. We work in English and Polish.

or call +48 575 621 877