Llama is an open-weight model, and its price cannot be answered with a single official price list. On July 6, 2026, Meta retired the Llama API public preview, and the old endpoint returns a termination notice. Llama model weights are unaffected and remain available from Meta's download pages and Hugging Face. Meta's announcement suggested that developers migrate to third-party providers that support Llama.
So asking "Llama API pricing" today really means asking which integration route you use. Third-party hosting bills by token, cloud providers bill by contract and usage, self-hosting bills by GPU hour, and aggregation gateways deduct from a converted balance. The four routes have different bill structures, and comparing "price per million tokens" directly easily leads to the wrong conclusion. This article covers cost structure and method only. For specific prices, see each platform's page and the model pricing page.
Note: Llama is a trademark of Meta Platforms, Inc. This article is a technical introduction only and implies no affiliation, agency, or partnership with Meta. Model versions, licenses, and platform prices change, so verify the original pages before purchasing.
1. After Meta's Llama API shutdown, which routes remain
The first route is third-party hosted APIs. Cloud platforms such as AWS Bedrock, Azure AI Foundry, and Google Cloud Vertex AI offer Llama models. Specialized inference platforms such as Together AI, Fireworks, DeepInfra, Novita, and Parasail also sell token-billed service. The models, context lengths, quantization, and regions supported differ from platform to platform.
The second route is self-hosting. Download the weights to your own or rented GPUs and serve them with an inference framework such as vLLM, SGLang, or TGI. For small-scale validation, llama.cpp or Ollama can also work. This route buys compute and operations capability, not API quota.
The third route is an OpenAI-compatible aggregation gateway. Platforms such as ZSQH AI Gateway unify several model providers behind one interface and one balance account, which suits China-based teams that need RMB settlement and a single usage view.
No route is inherently better; only fit matters. Before choosing, confirm model lifecycle, usage stability, and the team's operations capability.
2. What makes up the bill on each of the four routes
| Route | Billing unit | Typical bill components | Fit | Easily overlooked costs |
|---|---|---|---|---|
| Third-party hosted API | Input and output tokens priced separately | Token usage, cache, batch processing | Fast launch, teams without GPUs | Context growth, retries, queuing |
| Cloud provider | Metered tokens or provisioned throughput | Usage fees, committed spend, support plans, network and storage | Existing cloud contract, formal procurement | Minimum spend, cross-region traffic, model retirement |
| Self-hosted | GPU hours or monthly rental | GPU rent, storage, network, operations staff | Stable high utilization, data-boundary requirements | Idle waste, scaling, incident handling |
| Aggregation gateway | Converted token consumption | Prepaid balance, exchange rate, service fee | RMB settlement, unified multi-model management | Balance management, provider dependency |
The key is not whether the price is high or low, but that the billing units differ. Token bills vary with usage. GPU-hour bills run with the clock. Provisioned throughput bills even when unused. Comparing unit prices across billing units usually produces an unreliable conclusion.
3. Token billing: the cost is in usage structure, not unit price
A token bill has two parts, input and output. System prompts, chat history, tool definitions, and retrieved documents all count as input; generated content counts as output. Output usually costs more per token than input, and long answers, long reasoning traces, and high max_tokens all push cost up.
Context is the most underestimated item. In multi-turn conversations, each turn resends the full history, so input tokens accumulate with the number of turns. Pasting an entire document into context can consume tens of thousands of tokens in a single request. Caching can reduce the cost of repeated prefixes, but only if the prefix is stable and the hit rate is observable. Do not assume that enabling caching saves money.
Retries also belong in the budget. After a 429, a timeout, or a 5xx, a resend may incur charges if the upstream already processed the request. Do not treat "failures are free" as a default rule. Agent-style applications also need to watch loop counts: a single task may generate dozens of model requests, and the bill accumulates per request.
Batch processing suits offline jobs and usually costs less than online calls, but latency is measured in hours. Streaming improves experience without changing total tokens. When budgeting, first split requests into online, offline, and cacheable groups, and estimate each separately.
4. Cloud providers and specialized platforms: contracts matter, not just unit price
A cloud bill includes more than token fees. It may also include provisioned throughput, committed spend, support plans, cross-region networking, and log storage. Provisioned throughput suits teams with stable load: capacity is locked in, and idle time is not refunded. When traffic fluctuates, pay-as-you-go is more flexible.
Specialized inference platforms bill more directly, but a model with the same name is not necessarily the same product. Quantization precision, context window, concurrency limit, version, and whether the instance is dedicated all affect price and results. Before signing, confirm at least four things: the model version number, the context limit, the rate-limit rules, and the failure and refund terms.
When comparing prices, run a small traffic test with your own requests, recording latency, error rate, output quality, and actual charges. Looking only at numbers on a pricing page tends to hide queuing and retry costs.
5. Self-hosting: calculate GPU utilization, not token price
The core of self-hosting is not the token unit price, but how many useful tokens one machine produces per hour:
total cost per hour = hourly price per GPU × GPU count + storage/network + allocated operations labor
actual tokens processed per hour = peak throughput × average utilization
cost per million tokens = total cost per hour ÷ actual tokens processed per hour × 1,000,000
Utilization is the key variable. The same GPU at 20 percent and 80 percent utilization can produce equivalent token costs that differ by four times. For low-traffic or sharply peaked workloads, GPUs sit idle much of the time, and a hosted API is often more economical. Self-hosting wins only when utilization is stable and high enough to keep batch work flowing.
Include operations in the calculation: model upgrades, quantization tuning, monitoring and alerting, failover, security patches, and on-call staff. A model the size of Llama 4 Scout can be deployed on a single GPU with INT4; a Maverick-class model usually needs multiple GPUs, depending on the quantization scheme, context length, and inference framework. On licensing, the Llama Community License generally permits commercial use, but it carries an acceptable-use policy, a monthly active user threshold, and attribution requirements. Read the original text before committing.
6. Six steps to a realistic budget
- Export the last four weeks of logs: request count, input/output tokens, p95 context, retry rate, and peak concurrency.
- Choose three candidate routes and calculate monthly cost at low, medium, and high scenarios, not a single point estimate.
- Run sensitivity analysis on cache hit rate, batch share, and retry rate to see which matters most.
- For self-hosting, calculate at 30, 60, and 85 percent utilization, and include staffing, backup, and scaling costs.
- Pick one route for a two-week canary, record the real bill, latency, error rate, and output quality, then decide whether to scale.
- Review model lifecycle, prices, and contracts every quarter so you are not locked in by a retired model.
7. The order of cost control
Eliminate wasted usage before discussing unit price: trim system prompts and history, summarize or retrieve long documents first, cap max_tokens, use structured output to reduce back-and-forth clarification, apply exponential backoff to 429s and timeouts, and split keys by project with budget alerts.
The second step is tiering models by task. Use smaller or faster models for classification, extraction, and rewriting, and reserve larger models for complex reasoning. Do not use the most expensive tier across the whole site. The third step is caching, batch processing, and contract negotiation. Reversing the order usually means negotiating a discount on wasteful requests.
When calling several model providers, an aggregation gateway can unify the balance and usage view and reduce reconciliation work. You can sign up for ZSQH AI Gateway, run one request with a small amount, and then split keys by project. Specific prices follow the model pricing page and change with upstream adjustments.
Frequently asked questions
Can I still pay Meta directly to call the Llama API?
Meta's Llama API public preview was retired on July 6, 2026, and the old endpoint no longer serves inference. Model weights can still be downloaded; calls must go through third-party hosting, cloud providers, self-hosting, or an aggregation gateway.
Why do prices for the same Llama model differ so much?
It may be a different version, quantization precision, context window, rate-limit policy, or a difference between dedicated instances and shared inference. Compare the same version, the same context length, and the same concurrency conditions.
Is self-hosting always cheaper than paying per token?
No. Only stable, high utilization spreads GPU and staffing costs. For low-traffic or sharply peaked workloads, idle GPUs drive the equivalent unit cost very high.
If context doubles, does the bill double?
Not necessarily. Input tokens grow roughly linearly with context, and latency and rate-limit risk also rise. The actual increase depends on the output share, caching, and retries.
Do failed retries get billed twice?
It depends on whether the upstream processed the request. Retries after rate limits, timeouts, and 5xx errors may incur charges. Use backoff, idempotency, a retry cap, and request IDs for reconciliation.
Next steps
Llama pricing depends on the integration route and usage structure. Start with your own logs to calculate input, output, context, and retries, then compare hosted, cloud, self-hosted, and gateway bills. If you need a unified balance, RMB settlement, and multi-model management, start with sign-up. Specific prices and billing rules are on the model pricing page.
Related reading:
