Why Open-Source Models Still Cost Money: The Cost Logic Behind Self-Hosting and API Pricing

    Open-source does not mean free to run. This article explains why open-source model APIs still charge per token, breaks down the cost components of inference services and self-hosting, shows how to calculate unit cost per million tokens with throughput and utilization, and provides a decision framework for choosing between managed APIs and self-deployment.

    Open Source and Paid Services Are Not a Contradiction

    Many people assume “open source means free.” This conflates two separate things: the licensing of model weights and the operating cost of inference services. Once weights are published, anyone can download, modify, and run them in their own environment. But running a large model continuously consumes VRAM, compute, electricity, and bandwidth—costs that do not disappear just because the weights are free.

    Training cost is a one-time investment; inference cost recurs with every single request. For a service provider, per-token pricing must cover inference hardware depreciation, datacenter space and power, redundant capacity, scheduling systems, content safety review, and technical support. As a result, the API price of an open-source model is driven mainly by operating costs, not directly by whether the model is open source.

    The value of open source lies in technical transparency, verifiability, customizability, and reduced vendor lock-in. These benefits matter to researchers and enterprises alike, but they are largely independent of how services are priced.

    What Goes Into API Pricing

    Per-token billing is the most common pricing model. The cost structure behind that unit price roughly includes the following components.

    1. Inference compute. Processing input tokens (the prefill stage) differs computationally from generating output tokens one by one (the decode stage). Long contexts significantly increase compute and memory usage, so requests of different lengths are often priced differently.
    2. VRAM and caching. During inference, attention key-value pairs must be cached (the KV Cache). The longer the context, the more memory it occupies, the fewer concurrent requests a single accelerator can serve, and the higher the per-request cost.
    3. Service availability. A stable API requires redundant nodes, failover, and load balancing. These resources must be reserved even during off-peak hours, and their cost is amortized across all requests.
    4. Operations and compliance. Content safety, billing systems, log auditing, and customer support all require staffing and infrastructure investment.

    In short, API pricing is not just the electricity consumed by inference—it also includes the cost of reserved capacity and service commitments.

    The True Cost of Self-Hosting

    The cost of self-hosting is often underestimated because people tend to see only the hardware purchase price. The full cost includes at least the following four categories.

    Hardware and VRAM Requirements

    Whether a model can be loaded at all depends first on VRAM capacity. Weight memory can be roughly estimated as “number of parameters × bytes per parameter.” In 16-bit floating-point format, each parameter takes about 2 bytes; with 4-bit quantization, about 0.5 bytes. A 100-billion-parameter model needs roughly 200 GB of VRAM for weights alone in 16-bit format—and that excludes KV Cache, activations, and runtime overhead. Real deployments typically require multi-GPU parallelism, which introduces additional inter-GPU communication latency and cost.

    Quantization reduces memory requirements but may affect output quality, so it should be validated against your own evaluation set before going to production.

    Utilization Determines Unit Cost

    Hardware is a fixed cost: as long as the machines are running, the expense accrues. If your traffic only reaches 20% of peak capacity, most hardware time sits idle, and the effective cost per call ends up far above the sticker price of a managed API.

    Operations and Staffing

    Self-hosting means owning model version management, inference service monitoring, failure recovery, security patching, scaling, and cost accounting. These tasks demand dedicated or part-time engineering effort, and labor costs can sometimes exceed a substantial fraction of hardware costs.

    Licensing and Compliance

    Open-source licenses vary widely. Some restrict commercial use, redistribution, or derivative development based on the model. Have your legal or compliance team review the terms before use to avoid costly rework later.

    Calculating Unit Cost from Throughput

    The core metric for judging whether self-hosting pays off is the total cost per million tokens. It can be estimated with the following relationship:

    Unit cost = total hourly cost ÷ effective token throughput per hour

    Where effective throughput = peak throughput × average utilization.

    Here is an illustrative example—the numbers are only meant to demonstrate the calculation method and do not reflect any actual product’s data. Suppose an inference cluster costs 100 units of currency per hour, with peak throughput of 200 million tokens per hour and average utilization of 30%. Effective throughput is then 60 million tokens per hour, giving a unit cost of about 1.67 per million tokens. If utilization rises to 70%, the unit cost drops to roughly 0.71. Utilization typically has a larger impact on cost than differences in hardware unit prices.

    Example Cost-Estimation Code

    The following code compares self-hosting costs against a managed API. The logic can be ported to any programming language.

    1. def unit_cost(hourly_cost, peak_tps_per_hour, utilization):
    2. effective = peak_tps_per_hour * utilization
    3. if effective <= 0:
    4. return float("inf")
    5. return hourly_cost / effective * 1_000_000
    6. def breakeven_utilization(hourly_cost, peak_tps_per_hour, api_price_per_million):
    7. required_tokens = hourly_cost / api_price_per_million * 1_000_000
    8. return required_tokens / peak_tps_per_hour

    Continuing the example above, if the managed API charges 2 units per million tokens, the breakeven utilization for this cluster is about 25%. Above that level, self-hosting is cheaper on pure hardware cost. When running this calculation, operations labor should be folded into the hourly total cost—otherwise the conclusion will be overly optimistic.

    A Decision Framework for Choosing a Deployment Model

    Consideration Favors Managed API Favors Self-Hosting
    Load pattern Highly variable, sharp peaks and troughs Steady and near full capacity
    Data compliance Data may leave your environment Data must stay within your internal network
    Latency requirements Network round-trip latency acceptable Needs local or nearby inference
    Team capability No dedicated inference ops staff Has inference service operations capability
    Availability requirements Disaster recovery handled by provider Must build redundancy and failover in-house

    For most teams, the practical approach is to evaluate these factors against actual traffic patterns and organizational capabilities before committing to either path.