Llama 3.1 8B Instruct vs Gemma 3 4B API pricing
Updated
Llama 3.1 8B Instruct: USD 0.02 input, USD 0.04 output per 1M tokens (DeepInfra). Gemma 3 4B: USD 0.04 input, USD 0.08 output per 1M tokens (Amazon Bedrock). At 3 input tokens per output token, Gemma 3 4B costs 2× as much as Llama 3.1 8B Instruct (USD 0.05 vs USD 0.025 per 1M).
How do Llama 3.1 8B Instruct and Gemma 3 4B differ on price?
- Cheapest input price: Llama 3.1 8B Instruct USD 0.02 against USD 0.04 per 1M tokens, so Gemma 3 4B costs 2× as much.
- Cheapest output price: Llama 3.1 8B Instruct USD 0.04 against USD 0.08 per 1M tokens, so Gemma 3 4B costs 2× as much.
- Among the 201 indexed models, Llama 3.1 8B Instruct ranks 1st cheapest and Gemma 3 4B 4th on the 3:1 blend.
- No input:output mix changes the answer: Llama 3.1 8B Instruct is cheaper at every mix before cache discounts.
- Only Llama 3.1 8B Instruct lists a cached-input discount: Llama 3.1 8B Instruct at 1 standard price of 6, from USD 0.028 (Featherless, 86% below that provider's input price). Gemma 3 4B's cached tokens bill at the input price.
- Both state a context window of up to 131,072 tokens.
- Llama 3.1 8B Instruct has 6 providers with a standard price, 3 more than Gemma 3 4B; 3 providers sell both (DeepInfra, Amazon Bedrock and Featherless).
- On one account, DeepInfra charges USD 0.025 for Llama 3.1 8B Instruct (its cheapest price) and USD 0.0625 for Gemma 3 4B (1.25× its cheapest price) at 3:1, the lowest combined price among the providers that sell both.
- Shopping around matters more for Llama 3.1 8B Instruct: its dearest standard price is 17× its cheapest, against 1.25× for Gemma 3 4B.
- Llama 3.1 8B Instruct has a batch price at 1 provider, from USD 0.11 at 3:1 (Amazon Bedrock); Gemma 3 4B has no batch price on file.
- For the one-developer coding agent preset, the gap is USD 475.20 a year in Llama 3.1 8B Instruct's favour (Llama 3.1 8B Instruct USD 39.60 a month, Gemma 3 4B USD 79.20).
- Per character of input, the gap depends on the language: Llama 3.1 8B Instruct costs 4% less than Gemma 3 4B on Hindi text but 56% less than Gemma 3 4B on Code, because the two tokenizers split those languages differently.
Llama 3.1 8B Instruct and Gemma 3 4B prices side by side
USD per 1M tokens, standard tier. "Cheapest" is the lowest price at 3 input tokens to 1 output token; each line can come from a different provider.
| Price | Llama 3.1 8B Instruct | Gemma 3 4B |
|---|---|---|
| Model page | Llama 3.1 8B Instruct Meta · 6 providers | Gemma 3 4B Google · 3 providers |
| Cheapest standard price, blended 3:1 | USD 0.025 lower USD 0.02 in / USD 0.04 out at DeepInfra DeepInfra page checked 2026-11-14 | USD 0.05 USD 0.04 in / USD 0.08 out at Amazon Bedrock Amazon Bedrock page checked 2026-11-14 |
| Cheapest input | USD 0.02 lower DeepInfra source | USD 0.04 Amazon Bedrock source |
| Cheapest cached input | USD 0.028 Featherless source | No standard price lists a cache price; cached tokens bill at the input price. |
| Cheapest output | USD 0.04 lower DeepInfra source | USD 0.08 Amazon Bedrock source |
| Maker's own API | Meta publishes no paid standard price on its own API that we found. | Google publishes no paid standard price on its own API that we found. |
| Median standard price | USD 0.21 / USD 0.22 input / output, 6 prices | USD 0.05 / USD 0.10 input / output, 3 prices |
| Context window | 131,072 tokens, largest stated; from 16,384 at some providers | 131,072 tokens, largest stated; from 32,768 at some providers |
| Providers with a standard price | 6 | 3 |
- Lower marks the lower price on a line; tie, equal prices. Other tiers and free rows are on the model pages.
Report a wrong price or number (email to info@broadnet.ai, with this page's link filled in).
What do Llama 3.1 8B Instruct and Gemma 3 4B cost for a real workload?
30 days at each model's cheapest standard price for the workload (presets of the cost calculator; cached input at the cached price where listed).
| Workload | Llama 3.1 8B Instruct | Gemma 3 4B | Difference |
|---|---|---|---|
| Support chatbot 2,000 requests a day, 1,500 input tokens (60% cached), 300 output | USD 2.52 DeepInfra | USD 5.04 Amazon Bedrock | USD 2.52 Llama 3.1 8B Instruct lower |
| RAG over documents 1,000 requests a day, 8,000 input tokens (30% cached), 500 output | USD 5.40 DeepInfra | USD 10.80 Amazon Bedrock | USD 5.40 Llama 3.1 8B Instruct lower |
| Coding agent (one developer) 1,500 requests a day, 40,000 input tokens (85% cached), 2,000 output incl. reasoning | USD 39.60 DeepInfra | USD 79.20 Amazon Bedrock | USD 39.60 Llama 3.1 8B Instruct lower |
Llama 3.1 8B Instruct is cheaper on all three workloads. The widest gap is on Support chatbot: the dearer model costs 2× as much as the cheaper one.
Does the cheaper model change with your input:output ratio?
Llama 3.1 8B Instruct is cheaper at every mix of input and output tokens, before cache discounts: its cheapest input price and its cheapest output price are both at or below Gemma 3 4B's, so the input:output ratio never changes the answer.
| Input : output tokens | Llama 3.1 8B Instruct | Gemma 3 4B |
|---|---|---|
| 1 : 3 (long answers) | USD 0.035 lower DeepInfra | USD 0.07 Amazon Bedrock |
| 1 : 1 | USD 0.03 lower DeepInfra | USD 0.06 Amazon Bedrock |
| 3 : 1 (the site’s blend) | USD 0.025 lower DeepInfra | USD 0.05 Amazon Bedrock |
| 10 : 1 (retrieval, long prompts) | USD 0.02182 lower DeepInfra | USD 0.04364 Amazon Bedrock |
| 30 : 1 (agents, big contexts) | USD 0.02065 lower DeepInfra | USD 0.04129 Amazon Bedrock |
USD per 1M tokens at the cheapest standard provider for each mix, before cache discounts. Thinking tokens bill as output.
What do Llama 3.1 8B Instruct and Gemma 3 4B cost per character in other languages?
Cost to send 1M characters at each model's cheapest non-promotional standard input price, with the Llama 3.3 70B tokenizer for Llama 3.1 8B Instruct and the Gemma 3 27B tokenizer for Gemma 3 4B:
| Content | Llama 3.1 8B Instruct | Gemma 3 4B |
|---|---|---|
| English | USD 0.0043 lower DeepInfra | USD 0.0087 Amazon Bedrock |
| Arabic MSA | USD 0.0077 lower DeepInfra | USD 0.014 Amazon Bedrock |
| Egyptian Arabic | USD 0.0079 lower DeepInfra | USD 0.014 Amazon Bedrock |
| Hindi | USD 0.010 lower DeepInfra | USD 0.011 Amazon Bedrock |
| Chinese | USD 0.016 lower DeepInfra | USD 0.027 Amazon Bedrock |
| Spanish | USD 0.0053 lower DeepInfra | USD 0.0090 Amazon Bedrock |
| Code | USD 0.0051 lower DeepInfra | USD 0.012 Amazon Bedrock |
From the real cost by language dataset (measured tokens per character on FLORES-200 and other texts). Your own text will differ.
Check it on your own traffic
- Llama 3.1 8B Instruct API pricing: all 6 providers and other tiers.
- Gemma 3 4B API pricing: all 3 providers and other tiers.
- Cost calculator with Llama 3.1 8B Instruct and Gemma 3 4B preloaded
- Llama 3 token counter
- Gemma 3 token counter
- Prompt caching calculator
More comparisons: Llama 3.1 8B Instruct vs Llama 3 8B · Llama 3.1 70B vs Llama 3.1 8B Instruct · Gemma 3 12B vs Gemma 3 4B · every Llama 3.1 8B Instruct comparison · every Gemma 3 4B comparison · all 662 price comparisons
Questions
Is Llama 3.1 8B Instruct cheaper than Gemma 3 4B?
Yes. On a blend of 3 input tokens to 1 output token, Llama 3.1 8B Instruct costs USD 0.025 per 1M tokens and Gemma 3 4B USD 0.05, at each model's cheapest standard price. For input alone, Llama 3.1 8B Instruct is cheaper (USD 0.02 against USD 0.04 per 1M); for output alone, Llama 3.1 8B Instruct is (USD 0.04 against USD 0.08). This compares price only, not quality.
What do Llama 3.1 8B Instruct and Gemma 3 4B cost per 1M tokens?
Llama 3.1 8B Instruct: from USD 0.02 input and USD 0.04 output at DeepInfra; median of 6 standard prices USD 0.21 / USD 0.22. Gemma 3 4B: from USD 0.04 input and USD 0.08 output at Amazon Bedrock; median of 3 standard prices USD 0.05 / USD 0.10. Each price is read from the provider's own pricing page; the source is linked in the table.
Which providers sell both Llama 3.1 8B Instruct and Gemma 3 4B?
3 providers have a standard price for both: DeepInfra (USD 0.025 and USD 0.0625 at 3:1), Amazon Bedrock (USD 0.22 and USD 0.05 at 3:1), Featherless (USD 0.23 and USD 0.0625 at 3:1). The first is the lowest combined price. Buying each model from its own cheapest provider costs USD 0.025 and USD 0.05.
Which is cheaper for a coding agent or a chatbot, Llama 3.1 8B Instruct or Gemma 3 4B?
For a coding agent (1,500 requests a day, 40,000 input tokens (85% cached), 2,000 output incl. reasoning): USD 39.60 a month on Llama 3.1 8B Instruct (DeepInfra) against USD 79.20 on Gemma 3 4B (Amazon Bedrock), a difference of USD 39.60. For a support chatbot (2,000 requests a day, 1,500 input tokens (60% cached), 300 output): USD 2.52 a month on Llama 3.1 8B Instruct (DeepInfra) against USD 5.04 on Gemma 3 4B (Amazon Bedrock), a difference of USD 2.52. Each uses the cheapest standard price for that workload, cached input included. Try your own numbers.
At what input:output ratio does the cheaper of Llama 3.1 8B Instruct and Gemma 3 4B change?
Llama 3.1 8B Instruct is cheaper at every mix of input and output tokens, before cache discounts: its cheapest input price and its cheapest output price are both at or below Gemma 3 4B's, so the input:output ratio never changes the answer.
Do Llama 3.1 8B Instruct and Gemma 3 4B have cached input pricing?
Llama 3.1 8B Instruct from USD 0.028 per 1M cached input tokens (Featherless; 1 of 6 standard prices list a discount). Gemma 3 4B: no standard price lists a cached-input discount. Cached tokens are billed at the input price where no cache price is published.
Which has the larger context window, Llama 3.1 8B Instruct or Gemma 3 4B?
Both go up to 131,072 tokens on the providers that state it.