EN ▾
Get API key

Gemma 4 API: Integration & Pricing Guide

Developers searching for a gemma api often need a dedicated, uncensored text-completion endpoint that works with existing OpenAI-compatible client code. This guide explains how to integrate a high-context, prepaid API alternative that bypasses content refusals while maintaining standard developer workflows.

Gemma 4 API: Integration & Pricing Guide

Key points

  1. The service provides a single uncensored model via an OpenAI-compatible interface, not a specific vendor's named model.
  2. Billing is prepaid by token usage at transparent rates with no monthly subscriptions or hidden fees.
  3. Top-ups are by crypto (USDT on TRC20, USDC on Base) with instant credit bonuses for larger amounts.
  4. The endpoint supports streaming, function calling, and JSON mode within a 100k context window.

Introduction to Gemma 4 API

When developers look for a gemma api, they are often seeking access to open-weight models that can handle diverse topics without strict corporate guardrails. The current market offers various endpoints, but many still impose content filters that interrupt creative or technical workflows. This guide focuses on an independent, hosted solution that prioritizes transparency and reliability.

Our service provides a dedicated text-completion endpoint identified by the model ID uncensored. It is an open-weight model running on our own infrastructure, tuned to answer without content refusals for lawful adult use. This means you get raw model outputs that reflect the model's training data more directly, without post-processing filters.

It is important to note that this is not the official API from Google or any other specific vendor. We are an independent provider serving a compatible endpoint. If you are specifically looking for Google's official Gemma 4 API, you should check their documentation for their specific pricing and limits. However, if your goal is reliable, uncensored text generation via a standard interface, this endpoint offers a reliable alternative.

Why Choose an Uncensored Endpoint

Standard API endpoints often prioritize brand safety over accuracy, leading to refusals on controversial or adult topics even when they are perfectly valid for the use case. An uncensored endpoint removes these arbitrary barriers, allowing the model to generate content based on its training data rather than a safety classifier.

  • Freedom of Output: The model does not refuse lawful adult, fictional, security-research, or controversial topics. This is important for creative writing, roleplay, and deep analysis.
  • Predictable Behavior: Without dynamic filters that can change based on server load or policy updates, your outputs remain consistent across requests.
  • Cost Efficiency: You pay for the tokens you use, not for a subscription that includes unused capacity. Errors and refusals (when they do happen) are free.

While uncensored models may occasionally produce content that standard filters would block, they offer greater fidelity to the underlying language model. The only hard limit that always applies is the refusal of sexual content involving minors.

Setting Up Your Environment

Integrating this API requires minimal changes to your existing codebase if you are already using OpenAI-compatible SDKs. The base URL for our service is https://api.gemmaapi.top/v1. You can use this URL with the official OpenAI SDKs for Python, Node.js, or any other language that supports the standard chat-completions interface.

To get started, you need an API key. You can create one by signing up with Google or using an email and password on the Get API key page. The key is shown immediately after creation. No phone number is required, and your account only needs an email address.

Once you have your key, you can configure your client to use our base URL. This allows you to send requests to our endpoint while keeping your existing client code structure. The model ID you must send in your requests is uncensored. This ensures you are hitting the correct uncensored model.

from openai import OpenAI

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

resp = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)

Remember that your API key is unique to your account. You can generate a new key at any time, which will replace the old one. This is useful if you suspect a key has been compromised.

Making Your First Request

With your environment configured, you can make your first request. The API supports the standard POST /v1/chat/completions endpoint. You send your prompt and receive a text response. The model has a context window of 100,000 tokens, which includes both the prompt and the completion.

curl https://api.gemmaapi.top/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
  }'

When you send a request, you specify the model ID as uncensored. The API will process your input and return the completion. If you do not set the max_tokens parameter, the response can run to the end of the window. Set a lower value to limit the response.

The pricing is straightforward: $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. You pay only for what you use. If a request fails or is refused, you are not charged for those tokens. This prepaid model ensures you always know your costs in advance.

Advanced Features: Tools & JSON

Beyond simple text generation, the API supports advanced features that are essential for building complex applications. You can use function calling (tools) to allow the model to interact with external services. This is done by providing a schema of available functions and letting the model decide which one to call.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.gemmaapi.top/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

Additionally, you can enforce JSON output by setting the response_format to {"type": "json_object"}. This is useful for applications that require structured data from the model. You can also control the randomness of the output using parameters like temperature, top_p, stop, seed, presence_penalty, and frequency_penalty.

These features make the API suitable for a wide range of use cases, from automated customer support to data extraction and analysis. The model is tuned to handle these tasks effectively without content refusals interfering with the output.

Streaming Data Efficiently

For applications that require real-time feedback, the API supports streaming via Server-Sent Events (SSE). This allows you to receive the response token by token as it is generated, rather than waiting for the entire completion to be ready.

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Tell the story in second person."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

When streaming, you can also retrieve token usage information in the last chunk of the response. This allows you to track your usage in real-time and ensure you stay within your prepaid credit limits. Streaming is particularly useful for chat interfaces where users expect immediate feedback.

The API has a limit of 300 requests per minute per key and allows 8 concurrent requests. This ensures fair usage and maintains high performance for all users. If you need to handle a larger volume of requests, you can manage concurrency within your client code.

Cost Optimization Strategies

Understanding the pricing structure helps you optimize your costs. The API charges $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. Since the context window is 100,000 tokens, you can send large prompts without incurring excessive costs.

To optimize your spending, consider the following strategies:

  • Monitor Token Usage: Use the token usage information in the last chunk of streaming responses to track your usage.
  • Set Max Tokens: Define a max_tokens limit to prevent unexpectedly long outputs that could drain your credit.
  • Top-Up Bonuses: Top up your credit by crypto (USDT on TRC20, USDC on Base) to receive bonuses. A $50 top-up gives you a +5% bonus, a $100 top-up gives you a +10% bonus, and a $200 top-up gives you a +15% bonus.

Errors and refusals are free, so you do not need to worry about paying for failed requests. Your prepaid credit never expires, so you can top up when it is convenient for you.

Troubleshooting Common Errors

Even with a reliable API, you may encounter errors. Common issues include rate limits, invalid API keys, or malformed requests. If you exceed the limit of 300 requests per minute, you will receive a rate limit error. You can resolve this by reducing the frequency of your requests or implementing exponential backoff in your client code.

If you receive an authentication error, double-check your API key. Remember that each account has one active key, and generating a new one replaces the old one. Ensure you are using the correct base URL: https://api.gemmaapi.top/v1.

If the model returns an unexpected output, check your request parameters. Ensure that the model ID is set to uncensored and that your prompt is correctly formatted. You can also use the seed parameter to reproduce specific outputs for debugging purposes.

Comparison with Standard Models

When comparing this uncensored endpoint to standard models like GPT-4 or Claude, the primary difference lies in content filtering. Standard models often refuse to generate content on controversial or adult topics, even if it is relevant to the user's query. This uncensored model does not impose these restrictions, providing more direct and unfiltered outputs.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.gemmaapi.top/v1", apiKey: process.env.API_KEY });

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);

In terms of performance, the model offers a 100k context window and supports streaming, function calling, and JSON mode. These features are comparable to those offered by major vendors. However, the pricing is usage-based, which can be more cost-effective for intermittent users who do not need a monthly subscription.

For developers who need a reliable, uncensored text API, this service provides a solid alternative that integrates smoothly with existing tools. It is not a replacement for all use cases, but it is an excellent choice for content generation, creative writing, and research where content flexibility is key.

Questions and answers

Is this the official Gemma API from Google?

No, this is an independent service. We do not serve Google's official Gemma model. We provide a dedicated, uncensored text-completion endpoint that is compatible with OpenAI's API format. If you are looking for Google's official API, please check their documentation for their specific pricing and limits.

What model does the API serve?

The API serves a single uncensored model identified by the model ID 'uncensored'. It is an open-weight model run on our own servers, tuned to answer without content refusals for lawful adult use. It is not GPT, Claude, Gemini, Grok, DeepSeek, Qwen, Llama, or any other vendor's model.

How do I top up my credit?

Top-ups are by crypto (USDT on TRC20, USDC on Base), in any whole amount from $20 to $500. You receive a +5% bonus for $50 top-ups, a +10% bonus for $100 top-ups, and a +15% bonus for $200 top-ups. Credit never expires and is not refunded for mistakes, but errors and refusals are free.

What are the limits for requests?

You are limited to 300 requests per minute per key and 8 concurrent requests at the same time per key. The maximum request body size is 8 MB. Each account has one active key; generating a new key replaces the old one.

Your key is one form away

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