LLM API Credits: The Real Cost Math Behind Subsidies and When Self-Hosting Wins

    Free API credits that grow from tens to hundreds of dollars look like platforms losing money to acquire users, but credit amounts alone say nothing about actual costs. This article explains how to evaluate whether an LLM API subsidy is genuinely low-cost using three factors—model pricing, inference architecture, and workload characteristics—then covers common inference optimization techniques (operator fusion, KV cache reuse, low-bit quantization) and their limits, and finally analyzes when self-hosting becomes cheaper than paying per token.

    Credit amounts climbing from tens of dollars to several hundred dollars look like platforms burning cash to acquire users. But after the credits increased, call volumes did not grow proportionally. This shows that the subsidy amount itself reveals nothing about cost. Whether a subsidy is truly low-cost depends on three conditions: the model’s unit price, the inference architecture, and the business scenario. This article walks through each of these and provides a method you can use to calculate the numbers directly.

    1. How to Tell Whether an API Subsidy Is Genuinely Low-Cost

    LLM APIs are typically billed per token. The total cost of a single call can be estimated with this simplified formula:

    Total cost ≈ input tokens × input unit price + output tokens × output unit price + additional costs from caching, retries, and concurrency

    This is only a simplified model. Input and output prices usually differ, with output tokens costing more. In long-context scenarios, input tokens far outnumber output tokens, so the input price dominates the bill. When cache hits occur, part of the input is billed at a lower rate, so cache hit rate directly changes the invoice. Retried failed requests are billed again. And as concurrency rises, GPU queuing and idle time push up the unit cost.

    A set of illustrative numbers shows how much unit price matters. Suppose a model charges $1 per million input tokens and $4 per million output tokens. A call with 2,000 input tokens and 500 output tokens costs 2000 × 1 / 1,000,000 + 500 × 4 / 1,000,000 = $0.004. A $300 credit supports roughly 75,000 such calls. If another lightweight model costs one-tenth as much, the same $300 could theoretically support about 750,000 calls. The headline credit amount hides this order-of-magnitude difference.

    For a real calculation, you need at least four data sets: the model’s published pricing, the input-to-output token ratio in your workload, the cache hit rate, and GPU utilization. Only with these can you judge whether a subsidy is sustainable.

    If a subsidy persists long-term with no other revenue covering it, the platform’s cost may be approaching the compute cost floor of that model under its current architecture. This judgment requires actual measurement. Based on the credit figure alone, outsiders cannot confirm whether the platform is losing money or profiting, nor how long the subsidy will last.

    2. Inference Engine Optimizations: Techniques and Their Limits

    Extremely low prices are usually backed by engineering optimizations at the inference layer. There are three common techniques, each with its own preconditions.

    2.1 Operator Fusion

    Every time a GPU executes an operator, it must launch a kernel and read/write memory. Fusing multiple small operators into one large operator reduces kernel launches and memory traffic. The gains are significant with small batches or highly fragmented operators. With large batches, compute is already near saturation and the benefit shrinks. When validating, use profiling tools such as Nsight Systems or PyTorch Profiler to compare actual throughput before and after fusion, rather than relying on theoretical estimates.

    2.2 KV Cache Reuse

    A decoder model must read the key-value cache of all previous tokens each time it generates a new token. The prerequisite for cache reuse is an identical prefix. System prompts, fixed few-shot examples, and context from the same code repository can all share their KV entries as long as they remain exactly identical across requests. Implementation requires prefix caching combined with memory management mechanisms such as paged attention (e.g., vLLM’s PagedAttention).

    The limits are equally clear. If every request has a different prompt, the cache is almost impossible to reuse and memory savings are minimal. The benefit depends on the reuse rate and the scheduling policy. Before going to production, measure the actual prefix duplication ratio in real traffic—do not assume it is high.

    2.3 Low-Bit Quantization

    INT8 and INT4 quantization compress weight size to one-half and one-quarter of FP16 respectively, allowing larger models to fit on the same GPU. However, accuracy loss varies by task, and the following requirements must be met:

    • Calibration data: use samples close to your business distribution, not random text.
    • Evaluation metrics: use task-relevant benchmarks, such as code pass rates, math problem accuracy, or internal human ratings—do not rely on generic perplexity alone.
    • Control group: compare against the FP16 version item by item on the same test set.
    • Model support: different models support quantization schemes to different degrees. Code generation and long chain-of-thought reasoning tasks are typically more sensitive to INT4.

    Whether quantization can be used in production depends on test results for the specific task, not on the model’s name.

    3. When Does Self-Hosting Cost Less Than the API?

    Self-hosting frees you from official pricing, but the billing model shifts from per-token to per-hour. A GPU costs money every hour whether or not requests arrive. Unit cost can therefore be estimated as:

    Self-hosted unit cost ≈ GPU hourly cost ÷ effective output tokens per hour

    Effective output tokens per hour depend on utilization. When traffic is low, utilization drops and unit cost rises quickly. For example, if a GPU costs $10 per hour, the unit cost per effective token at 80% utilization is one-quarter of what it is at 20% utilization.

    Self-hosting becomes the cheaper option only when utilization stays consistently high enough that the per-hour cost divided by actual throughput undercuts the API’s per-token price—which requires measuring your real traffic patterns before making the switch.