LobeChat is an open-source AI chat and workspace project that now continues under the LobeHub brand. Many people treat it as a free option, but free software does not mean zero total cost: as soon as models start running, three bills appear at once — the application layer, the infrastructure layer, and the model layer. This article separates those three layers and offers a reusable estimation method and a cost-control checklist.

Note: LobeChat and LobeHub are products and trademarks of their respective owners; OpenAI, Claude, Gemini and other names are trademarks of their respective owners. This article discusses technology and cost only and implies no affiliation with the relevant vendors. Plans, licenses and prices are governed by the official pages, and model prices by the site's model pricing page.

1. Separate three layers of cost first

When calculating the cost of LobeChat, do not fixate on the subscription price. Splitting spending into three layers is the best way to avoid missing items.

Cost layer What it includes How it is billed Easy to miss
Application Open-source self-hosting, cloud subscription, enterprise edition Software is usually not billed per token; cloud plans bill by subscription or credits Enterprise features, commercial license, seats
Infrastructure Server, PostgreSQL, Redis, object storage, domain, backups Monthly or per resource Bandwidth, backups, operations time
Model Chat, embeddings, rerank, multimodal Per token or per call Retries, long context, repeated indexing
Labor Deployment, upgrades, troubleshooting, security Hours worked Hidden but real

For personal trials, the model layer is often the largest item; for long-running teams, infrastructure and labor take a bigger share. Looking at all three layers in one table prevents the shock of "free software, expensive bill".

2. Where LobeChat self-hosting is actually free

LobeChat's code can be deployed by yourself, and the software itself is generally not billed per conversation. The license deserves a clear explanation: since version 1.0 the project uses the LobeHub Community License, based on Apache 2.0 with additional conditions. It permits using unmodified versions in commercial scenarios, but redistribution after modification usually requires a commercial license. The repository LICENSE is authoritative.

The real costs of self-hosting include: a server that can run continuously, PostgreSQL 14 or later, optional Redis, S3-compatible storage for files and knowledge bases, a domain and HTTPS, and backup space. A knowledge base also needs pgvector and an embedding model; the default example in LobeHub's documentation uses an OpenAI embedding model, and other compatible providers can be substituted.

So a more accurate description of "free" is: the application subscription is replaced by infrastructure bills and operations time. Teams that already have servers and operations capacity face low marginal cost; teams that do not should include these items before comparing.

3. Cloud subscription vs bring-your-own-key

LobeHub Cloud measures model usage in credits, which map to tokens for different models. Plans generally fall into free, personal subscription, and enterprise tiers, with some models requiring a higher plan. The enterprise edition also covers private deployment, branding customization, and user management. Specific quotas and prices follow the official pricing page.

With self-hosting plus your own key, the application does not mark up models; you pay the model provider or gateway directly. The trade-off is managing keys, billing, quotas, and failures yourself. A cloud subscription buys an out-of-the-box experience, hosted model allowance, and less operations work — not simply cheaper models.

The two paths can be combined: run daily team work on a self-hosted instance and use the cloud version for mobile access or temporary collaboration. Self-hosting can also connect to a unified gateway, consolidating multi-vendor billing in one place.

4. Where pay-as-you-go money actually goes

Pay-as-you-go is not just about the price per million tokens. Breaking down a month looks roughly like this:

Monthly model cost ≈
  chat input tokens × input price
+ chat output tokens × output price
+ knowledge-base embedding tokens × embedding price
+ rerank calls × price
+ multimodal input and long-context surcharges
+ failed retries and wasted calls

Several points are commonly underestimated: output tokens usually cost more than input tokens; longer context raises the input cost of every request; a knowledge base is not built once and forgotten, because updated files must be re-chunked and re-embedded; RAG inserts several passages into context with every question, and more passages cost more; retries and looped calls multiply the bill.

If a provider supports prompt caching, a stable prefix may qualify for cached pricing, but support scope, hit conditions, and discount methods differ. Do not treat caching as a switch that necessarily saves money.

5. Three scenarios, three ways to calculate

Light personal use: dozens of conversations a day, with output tokens as the main cost. If you already have a server, self-hosting with your own key is usually more controllable; if not, the cloud free allowance or an entry subscription is less effort.

Small team sharing: beyond model fees, count accounts, permissions, auditing, and key management. Self-hosting lets you issue an independent key per person and set budgets by project; a cloud plan bills per seat, saving operations work but requiring attention to the total seat count over time.

Knowledge-base or customer-service applications: embeddings, rerank, and long context noticeably raise the cost per question. The priority is not switching to a cheaper model but reducing irrelevant passages, controlling top-k, and handling repeated questions with caching or fixed answers.

No specific amounts are given here because model unit prices, exchange rates, plans, and usage all change. Multiplying your real token usage from the last 30 days by model pricing is more reliable than reading a marketing page.

6. Eight actions that bring costs down

  1. Record input and output tokens continuously for 30 days, split by feature and by member, and find the biggest item first.
  2. Tier by task: use small models for classification, rewriting, and summarization, and reserve large models for complex reasoning.
  3. Trim system prompts and history, limit the number of carried turns, and stop resubmitting an entire conversation.
  4. Control chunk size and top-k in the knowledge base; retrieve first and rerank, rather than inserting whole documents into context.
  5. Use the caching capability your provider supports for stable prefixes, and verify hit rates and billing rules.
  6. Set budgets and rate limits for projects, members, and keys to prevent script loops and abnormal retries.
  7. Regularly remove duplicate files, expired knowledge bases, and unused model permissions.
  8. Review failure rates, retry rates, cache hits, and cost per task once a week, and apply rate limits immediately when anomalies appear.

Among these, items 1 and 6 deliver the most direct benefit: without data you cannot optimize, and without caps, abnormal traffic can multiply the bill.

7. When to choose cloud and when to self-host

Choose the cloud version when you do not want to manage servers, need an out-of-the-box mobile or desktop experience, have a small team, and want credits to consolidate model billing. Choose self-hosting when data residency is required, you already have servers and operations staff, you need SSO and member management, and you want freedom to switch models and gateways.

Whichever path you take, consolidating model calls behind one compatible endpoint, issuing separate keys per project, and reconciling monthly are good practice. If you need a unified entry point and usage management, you can sign up for the ZSQH AI Gateway; models and prices are listed on the model pricing page.

FAQ

Is LobeChat free?

The software can be self-deployed, but model calls, servers, storage, and operations all cost money; the cloud version and enterprise capabilities are billed under official plans.

Is self-hosting always cheaper than a cloud subscription?

Not necessarily. With low usage and no existing server, the cloud version is often less effort; with steady usage and existing infrastructure, self-hosting spreads costs more easily.

Can pay-as-you-go billing "leak" money?

Common causes are script loops, retries, long context, and repeated knowledge-base indexing. Setting budgets and rate limits per key, and logging tokens for each call, makes problems easy to locate.

Why does a knowledge base raise costs noticeably?

Files must be chunked and embedded, and retrieved passages are inserted into context at question time. More passages and more frequent file updates mean higher embedding and input token costs.

How do I estimate a month's cost?

Export input and output tokens from the last 30 days, classify them by feature, multiply by each model's current price, then add embeddings, rerank, and retries. Leave roughly 20% headroom for fluctuation. Prices follow model pricing.

Related reading: