Key points
- Base URL https://api.gemma4api.com/v1, Bearer auth, two methods: chat completions and models.
- Model ID is
uncensored; context is 100,000 tokens shared by prompt and completion. - Full keys allow 8 concurrent requests and 300 per minute; trial keys allow 2 and 60.
- Over a limit you get HTTP 429 with the code rate_limited or concurrency.
Quick reference
| Item | Value |
|---|---|
| Base URL | https://api.gemma4api.com/v1 |
| Auth header | Authorization: Bearer <key> |
| Model ID | uncensored |
| Endpoints | POST /v1/chat/completions, GET /v1/models |
| Context window | 100,000 tokens, prompt plus completion |
| Max request body | 8 MB |
| Price | $0.15 per 1M input tokens, $0.50 per 1M output tokens |
The API follows the OpenAI chat completions format, so any OpenAI SDK or client works once you change the base URL and the key. This page is the reference. For a guided first request, use the quickstart docs, and to get a key go to the API key page.
A note on naming. This is an independent service running one open-weight model, tuned to answer without content refusals for lawful adult use. It is not the official API of Google or of any other model vendor, and it is not a router across vendors. It is text only: no image, audio or video generation, no embeddings and no fine-tuning.
Authentication
Every request needs a key in the Authorization header. Sign up with Google or with email and password, then open the key page. New users can claim $0.50 of trial credit with one click there, one per person, valid for 7 days, no card needed.
curl https://api.gemma4api.com/v1/models \
-H "Authorization: Bearer $GEMMA_API_KEY"
The response lists the available model, uncensored. A missing or wrong key returns an authentication error. Treat the key like a password. Keep it on the server side, out of browser code and out of version control.
POST /v1/chat/completions
This is the main endpoint. Send a JSON body with a model and a list of messages.
curl https://api.gemma4api.com/v1/chat/completions \
-H "Authorization: Bearer $GEMMA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Give me three names for a fantasy tavern."}
],
"temperature": 0.8,
"max_tokens": 200
}'
Message roles are system, user, assistant and tool. The reply arrives in choices[0].message.content, and the usage object gives prompt and completion token counts, which are what you are billed on.
Request parameters
| Parameter | Notes |
|---|---|
model | Required. Use uncensored. |
messages | Required. The conversation so far. You resend history on every call. |
max_tokens | Optional. Without it the completion can use the rest of the 100,000-token window. |
temperature, top_p | Passed through to the model. |
stop | Passed through. Ends generation when a listed sequence appears. |
seed | Passed through, for more repeatable sampling. |
frequency_penalty, presence_penalty | Passed through. |
stream | true for server-sent events. |
response_format | {"type":"json_object"} for JSON mode. |
tools, tool_choice | Tool calling, in the OpenAI format. |
The maximum body size is 8 MB. Because prompt and completion share 100,000 tokens, a prompt of 90,000 tokens leaves at most 10,000 for the answer.
Streaming
Add "stream": true and the response becomes an SSE stream of chunks, with token usage reported at the end. The text arrives in choices[0].delta.content. A Node.js example with the official package:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.gemma4api.com/v1",
apiKey: process.env.GEMMA_API_KEY,
});
const stream = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Describe a rainy harbour town in one paragraph." }],
stream: true,
});
for await (const chunk of stream) {
const piece = chunk.choices?.[0]?.delta?.content;
if (piece) process.stdout.write(piece);
}
Plan for one operational rule: a streamed request occupies its concurrency slot until the stream ends. If a client disconnects badly or a loop forgets to read the stream to the end, you can run out of slots while the request count looks low.
JSON mode and tool calling
JSON mode
Set response_format to {"type": "json_object"} to get a JSON object back. Also tell the model in the system or user message what keys you expect, because the format setting asks for valid JSON, not for your schema.
curl https://api.gemma4api.com/v1/chat/completions \
-H "Authorization: Bearer $GEMMA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [
{"role": "system", "content": "Reply with JSON: {\"title\": string, \"tags\": string[]}"},
{"role": "user", "content": "Summarize: a lighthouse keeper finds a message in a bottle."}
],
"response_format": {"type": "json_object"}
}'
Validate the parsed result in your code and keep max_tokens high enough that the object is not cut off in the middle.
Tool calling
Pass function definitions in tools and, if you want, steer them with tool_choice. When the model decides to call a function, the message contains tool_calls, and in streaming mode those arrive as streamed tool_calls deltas that you assemble. You run the function yourself, then send the output back as a message with role: "tool" and the matching tool_call_id. The docs quickstart shows a first request.
Keep tool descriptions short and precise. The model chooses based on names and descriptions, and vague ones lead to wrong calls.
Parameters and billing in practice
Choosing parameters
A reference is more useful with some defaults. For factual or code-like tasks, use a low temperature such as 0.2 to 0.5, and leave top_p near 1. For creative writing, raise temperature to between 0.8 and 1.0 and set top_p around 0.95. If replies repeat phrases, add a small frequency_penalty, for example 0.3. If you need results you can compare run to run, set a fixed seed, and treat the output as repeatable rather than guaranteed identical.
Use stop when the model should end at a marker, such as the next speaker label in a script. Use max_tokens as a safety limit on cost and length. Because output tokens cost $0.50 per 1M, a cap of 500 tokens bounds the output side of any request at $0.00025.
Reading the bill
Billing follows the usage object. Prompt tokens are priced at $0.15 per 1M and completion tokens at $0.50 per 1M. A request with 1,200 prompt tokens and 300 completion tokens costs $0.00018 for input plus $0.00015 for output, a total of $0.00033. Your balance after the call is in the X-Balance-USD header, so you do not need a separate call to check it. This is also how you can spot a runaway loop: if the balance falls faster than expected, the headers show it on the next response.
Prepaid means your spend stops when your credit does. There is no overage billing, and credit never expires. Failed or refused requests are not charged.
Troubleshooting checklist
- Call
GET /v1/modelswith your key. If that fails, the problem is the key or the base URL, not your request body. - Confirm the base URL ends in
/v1and that you sendContent-Type: application/jsonwith raw HTTP clients. - Check that
modelis exactlyuncensored. - If you see 429, read the error code.
rate_limitedmeans slow down your request rate.concurrencymeans fewer parallel calls or finished streams. - If a body is rejected, check its size against the 8 MB limit and the total token count against 100,000.
- Keep the
X-Request-Idvalue from a failing call. It identifies that request if you need help.
Most integration problems fall into the first three items. Work through them in order before you suspect anything on the service side, and keep your X-Request-Id values handy when you do need to ask for help.
Limits, headers and errors
| Full key | Trial key | |
|---|---|---|
| Concurrent requests | 8 | 2 |
| Requests per minute | 300 | 60 |
Every response includes these headers:
X-Request-Id: a unique ID for the call. Log it.X-Balance-USD: your remaining balance.X-RateLimit-Limit-Requests: the requests-per-minute limit on your key.X-RateLimit-Limit-Concurrency: the concurrency limit on your key.
Going over a limit returns HTTP 429. The error code rate_limited means too many requests per minute, and concurrency means too many at once. During temporary overload the API also returns 429 with Retry-After: 5. In all cases, wait and retry with a growing pause rather than hammering the endpoint. Requests that fail or are refused are not charged.
The rates behind these numbers, and the top-up bonuses, are on the pricing page. Top-ups run from $20 to $500, and you can pay with crypto (USDT on TRC20, USDC on Base).
More guides
Questions and answers
What is the base URL?
https://api.gemma4api.com/v1. Append /chat/completions or /models. Authenticate with a Bearer token.
Which model name do I send?
Always uncensored. GET /v1/models returns the list of available IDs.
Is there an official OpenAPI spec or other SDK?
Use any OpenAI SDK in your language and change the base URL and key. The endpoints and parameters on this page are the supported surface.
What is the maximum prompt size?
The context window is 100,000 tokens for prompt plus completion, and the request body can be up to 8 MB.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
