EN ▾

Gemma 4 API Price: What You Pay Per Token

There is no single Gemma 4 API price, because the weights are open and many hosts sell access at their own rates. This page shows how to estimate your own bill and what our flat per-token pricing looks like in practice.

Updated

Balance scale weighing token cubes against coins, illustrating per-token API pricing

Key points

  1. Hosts set their own Gemma prices, so check each provider's current pricing before you compare.
  2. Our API charges $0.15 per 1M input tokens and $0.50 per 1M output tokens, with no subscription.
  3. A typical 2,000-in, 500-out request costs $0.00055, so 1,000 of them cost $0.55.
  4. Failed or refused requests are not charged, and credit never expires.

Short answer: it depends on who hosts it

If you searched for gemma 4 api price, the honest answer is that there is no one number. Gemma is an open-weight model family, so Google's own hosted offering, cloud marketplaces and independent inference providers each publish a separate rate sheet. Those rates change, and some hosts bill input and output tokens differently, add minimums, or put a free tier in front of a paid one. Check their current pricing on the day you decide.

What you can do today is learn the shape of the calculation. Every per-token API reduces to the same formula: input tokens times the input rate, plus output tokens times the output rate. Once you know your typical request size, you can drop in any provider's numbers and compare them in a minute.

This site is not Google's Gemma API and not a reseller of it. It is a hosted, OpenAI-compatible text API running one open-weight model tuned to answer without content refusals for lawful adult use, behind the model ID uncensored. The price is fixed and public, so it makes a clean worked example for the formula below.

The formula behind every token price

Providers quote prices per one million tokens. Convert that to a per-token rate by dividing by 1,000,000, then multiply by what you actually send and receive.

def cost_usd(input_tokens, output_tokens, in_rate=0.15, out_rate=0.50):
    return input_tokens / 1_000_000 * in_rate + output_tokens / 1_000_000 * out_rate

print(cost_usd(2_000, 500))      # 0.00055
print(cost_usd(100_000, 2_000))  # 0.016

The rates in the defaults are ours: $0.15 per 1M input and $0.50 per 1M output. Swap in another host's rates to compare. Two details trip people up.

  • Output costs more than input. On our API an output token costs a little over three times an input token, so a chatty model that writes long replies moves your bill more than a long prompt does.
  • The whole conversation is input every turn. Chat endpoints are stateless. Each request resends the history, so turn 20 of a roleplay session pays for turns 1 to 19 again as input.

What our API costs, with exact numbers

Our rates are $0.15 per 1M input tokens and $0.50 per 1M output tokens, billed from prepaid credit. There is no subscription, failed or refused requests are not charged, and credit does not expire. The table works out four common request shapes.

Request shapeInputOutputCost per request
Short question300200$0.000145
Typical chat turn2,000500$0.00055
Long story continuation20,0001,500$0.00375
Full 100,000-token context100,0002,000$0.016

Check one row by hand. The long continuation is 20,000 divided by 1,000,000 times 0.15, which is $0.003, plus 1,500 divided by 1,000,000 times 0.50, which is $0.00075. The two add up to $0.00375. The short question is $0.000045 for input and $0.0001 for output, so $0.000145.

The context window is 100,000 tokens, prompt and completion together, so the last row is the most you can spend on input in a single call. Even then the request costs under two cents.

One more point on reading these numbers. A price of $0.50 per 1M output tokens sounds abstract until you convert it. One million tokens is roughly three-quarters of a million English words, which is more than a few long novels. So the output side of a hobby project rarely reaches a dollar in a month, and the line item to watch is the input side on long-context work.

Monthly budgets for three kinds of project

Per-request figures are tiny, so it helps to scale them up to a month. These are examples, not forecasts. Replace the counts with your own.

A hobby chat app

Say 50 chat turns a day at 2,000 tokens in and 500 out. That is 1,500 turns in a 30-day month, or 3,000,000 input tokens and 750,000 output tokens. Input costs 3 times $0.15, which is $0.45. Output costs 0.75 times $0.50, which is $0.375. The month comes to $0.825.

A story-writing tool with long context

Imagine 400 requests a day at 20,000 in and 1,500 out. Over 30 days that is 12,000 requests, so 240 million input tokens and 18 million output tokens. Input is 240 times $0.15, or $36. Output is 18 times $0.50, or $9. Total: $45. Here the input side dominates, which is why trimming old history pays off.

A batch classification job

Run 500,000 short items at 300 in and 20 out. That is 150 million input tokens ($22.50) and 10 million output tokens ($5.00), so $27.50 for the whole job.

Ways to keep the bill small

Cost control is mostly about input, because that is where bills quietly grow. A few habits make a visible difference without hurting quality.

  • Trim history. Keep the system prompt and the last handful of turns, and replace older turns with a short summary. A conversation that resends 15,000 tokens of history on every turn pays $0.00225 in input each time, before the model writes a word. Cut that to 4,000 tokens and the input cost per turn falls to $0.0006.
  • Set max_tokens when you know the answer is short. It is optional on this API, since the completion can use the rest of the window, but a cap protects you from a runaway reply on a classification task.
  • Stream and stop early. With stream: true you can drop the connection once you have what you need, for example when a user leaves a page.
  • Batch sensibly. A full key allows 8 concurrent requests and 300 per minute, so a bulk job can run eight workers in parallel without hitting the limits.

None of these tricks change the rate. They change the number of tokens, which is the other half of the formula, and usually the half you control.

Topping up and the trial

You prepay. Top-ups are any whole amount from $20 to $500, with a bonus of 5% from $50, 10% from $100 and 15% from $200. A $100 top-up gives $110 of credit, and $200 gives $230. This site takes crypto only, using USDT on TRC20 or USDC on Base. The pricing page has the current table.

New users can claim $0.50 of trial credit with one click on the API key page after sign-up. It is one per person, valid for 7 days, and needs no card. At the typical turn above ($0.00055), $0.50 covers about 900 requests, enough to judge output quality before you pay anything. The trial key is limited to 2 concurrent requests and 60 requests per minute, while a full key allows 8 and 300.

Create the account on the API key page. Sign-up works with Google, or with email and password.

Check your own bill from the response

Do not trust estimates blindly. The API reports usage, and every response carries an X-Balance-USD header, so you can watch real spend. This script sends one request and prints the token counts and the cost using the formula above.

from openai import OpenAI

client = OpenAI(base_url="https://api.gemmansfw.com/v1", api_key="YOUR_KEY")

r = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Write a four-line poem about rain."}],
)
u = r.usage
cost = u.prompt_tokens / 1e6 * 0.15 + u.completion_tokens / 1e6 * 0.50
print(u.prompt_tokens, u.completion_tokens, f"${cost:.6f}")

Run it on your real prompts for an afternoon, average the numbers, and you have a per-request cost you can multiply with confidence. The quickstart covers streaming, tool calling and JSON mode if your app needs them.

How to compare against other Gemma hosts

When you line up another provider against ours, compare like with like.

  1. Collect their input and output rates per 1M tokens from their own pricing page.
  2. Run the formula on your measured request sizes, not on a round number.
  3. Look for extras: minimum spend, per-request fees, charges for failed calls, credit that expires.
  4. Check the rate limits against your concurrency. Ours are 8 concurrent requests and 300 per minute on a full key.
  5. Read their content policy. If your use is lawful adult fiction or roleplay, a model with built-in refusals will cost you retries no matter how cheap the token is.

That last point is the real reason this API exists. The model is open-weight, run by an independent provider, and tuned to answer without content refusals for lawful adult use. One hard limit stays: no sexual content involving minors. It is text only, with no images, audio, embeddings or fine-tuning. For a wider look at alternatives, see the cost and capability analysis.

Questions and answers

What is the Gemma 4 API price per million tokens?

It varies by host and changes over time, so check each provider's current pricing. On this site the rates are $0.15 per 1M input tokens and $0.50 per 1M output tokens for the model ID uncensored.

Is this the official Google Gemma API?

No. It is an independent, OpenAI-compatible text API running one open-weight model, and it is not run by Google or any other model vendor.

Do I pay for failed or refused requests?

No. Failed or refused requests are not charged, and prepaid credit never expires.

How can I test the price before paying?

Claim the $0.50 trial credit on the API key page after sign-up. It needs no card, is valid for 7 days, and covers roughly 900 typical chat turns.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API keyRead the docs