EN ▾
Get API key

How to Use a Gemini API Alternative With OpenAI SDKs

If you searched how to use gemini api, one clarification first: this site is not Google's Gemini. It is an independent, OpenAI-compatible text API that runs an uncensored open-weight model, and any OpenAI SDK talks to it once you change the base URL and the key.

Updated

Isometric terminal sending data blocks through a cable into a glowing cube, representing an API call

Key points

  1. This is not Google's API. It is a separate service with the model ID uncensored.
  2. Change two settings in any OpenAI client: base URL and key.
  3. Streaming, tool calling and JSON mode are supported.
  4. New accounts can claim $0.50 of trial credit with one click, no payment details.

The short version

You can be sending requests in about five minutes. The whole process is the same as using any OpenAI-style API, only with a different address.

  1. Sign up with Google, or with an email and password.
  2. Open the API key page and claim the trial credit with one click.
  3. Copy your key and keep it in an environment variable.
  4. Point your OpenAI client at https://api.geminiuncensored.top/v1.
  5. Set the model to uncensored and send a chat completion.

The rest of this page walks through each step with code you can paste, then covers streaming, JSON mode and the errors people hit most often. Read the section on what the endpoint is first if you were hoping for Google's own models, because it saves you a wasted afternoon. Everything else assumes you only need text in and text out.

What you are calling, and what you are not

The name on the domain points at a familiar search, so it helps to be exact. This service is not run by Google and is not the official Gemini API. It does not route your request to Gemini or to any other vendor. Behind the endpoint sits one open-weight model, operated by an independent provider and tuned to answer without content refusals for lawful adult use. There is one hard limit: nothing sexual involving minors, ever.

It is also text only. There is no image, audio or video generation, no embeddings and no fine-tuning. If your project needs Google's multimodal features, use Google's own documentation and SDKs. Those use a different request shape (contents and parts) than the chat messages array used here, so code written for one will not run against the other without changes.

What you get in return is a plain, familiar interface. These are the facts you need to configure a client:

SettingValue
Base URLhttps://api.geminiuncensored.top/v1
Model IDuncensored
Auth headerAuthorization: Bearer <key>
EndpointsPOST /v1/chat/completions, GET /v1/models
Context window100,000 tokens, prompt plus completion
Max request body8 MB

Get a key and a little credit

Registration works with a Google account or with an email and password. After you sign up, the API key page shows your key and a button to claim trial credit: $0.50, one claim per person, valid for 7 days, and no payment details required. That sounds small, but at $0.15 per million input tokens and $0.50 per million output tokens it covers hundreds of short requests. A typical call with 2,000 input tokens and 500 output tokens costs $0.00055, so the trial credit pays for roughly 900 of them.

When you want more, top up with any whole amount from $20 to $500. Bonuses apply on larger top-ups: +5% from $50, +10% from $100 and +15% from $200. This site takes crypto only, in USDT on TRC20 or USDC on Base. Credit never expires and there is no subscription, so you only spend what you send. The pricing page lists the details.

Store the key outside your source code. In a shell, that looks like this:

export UNCENSORED_API_KEY="paste-your-key-here"

Your first request with curl

Before installing anything, check that the key works. This request sends one message and prints the reply as JSON.

curl https://api.geminiuncensored.top/v1/chat/completions \
  -H "Authorization: Bearer $UNCENSORED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [
      {"role": "system", "content": "You are a concise writing assistant."},
      {"role": "user", "content": "Give me three opening lines for a noir short story."}
    ],
    "temperature": 0.8
  }'

The answer arrives in choices[0].message.content, the same place you would look with any OpenAI-style service. Add -i to the curl command and you will also see response headers. X-Balance-USD shows what is left on your account, and X-Request-Id is the value to quote if you ever need to ask about a specific call.

You can list what the endpoint offers with GET https://api.geminiuncensored.top/v1/models. Expect the single ID uncensored.

Python and Node examples

Python with the openai package

Install the official SDK with pip install openai. Only the client constructor and the model name differ from a stock setup.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.geminiuncensored.top/v1",
    api_key=os.environ["UNCENSORED_API_KEY"],
)

reply = client.chat.completions.create(
    model="uncensored",
    messages=[
        {"role": "system", "content": "You are a concise writing assistant."},
        {"role": "user", "content": "Summarize the plot of Hamlet in two sentences."},
    ],
    temperature=0.7,
)

print(reply.choices[0].message.content)
print(reply.usage.prompt_tokens, reply.usage.completion_tokens)

Node with the openai package

Install with npm install openai. The pattern is identical.

import OpenAI from "openai";

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

const reply = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Name five dystopian novel titles." }],
});

console.log(reply.choices[0].message.content);

Any other OpenAI-compatible library follows the same recipe. The docs page shows the three lines to change in a typical client. Keep the base URL and key in one configuration place, such as a settings module or an environment file, so that moving between this endpoint and any other OpenAI-style service stays a change in one file. Teams that do this early rarely have trouble later when they test a second provider next to the first one.

Moving code that was written for Google's SDK

If you already have a script built on Google's Python or JavaScript client, the port is mostly a rename job. The ideas map one to one even though the field names differ. This table lists the usual equivalents.

In Google's SDKHere
Client created with a Google keyOpenAI client with base_url and your key from this site
Model name chosen per callmodel="uncensored"
contents with partsA messages list of role and content pairs
A separate system instructionA first message with the role system
Generation config objectTop-level fields: temperature, top_p, max_tokens, stop, seed
Reading the answer from a text propertychoices[0].message.content

Two things will not carry over. Image, audio and video inputs have no equivalent here, because this endpoint handles text only. And any feature that depends on a specific Google model, such as its built-in tools, has to be rebuilt with ordinary function calling. Plan an hour for a small project: change the client, convert the message format, run your old test prompts and compare the answers by eye.

Streaming and JSON mode

Long answers feel faster when tokens show up as they are produced. Set stream to true and read the server-sent events. The final chunk carries usage, and it has no choices, so guard for that.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.geminiuncensored.top/v1",
    api_key=os.environ["UNCENSORED_API_KEY"],
)

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Write a 150-word scene set on a night train."}],
    stream=True,
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

A streamed request holds one of your concurrency slots until the stream ends, so closing connections you no longer need matters more than it does with plain requests.

When your program has to parse the answer, turn on JSON mode with response_format. Also tell the model in the prompt which keys you expect, because the flag guarantees valid JSON, not a particular schema.

import json
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.geminiuncensored.top/v1",
    api_key=os.environ["UNCENSORED_API_KEY"],
)

reply = client.chat.completions.create(
    model="uncensored",
    response_format={"type": "json_object"},
    messages=[
        {"role": "user", "content": "Return JSON with keys title and tags (a list) for a story about a lighthouse keeper."},
    ],
)

data = json.loads(reply.choices[0].message.content)
print(data["title"], data["tags"])

Tool calling works through the usual tools and tool_choice fields, with results sent back as messages whose role is tool.

Habits that save time and money

A few routines pay off from the first day. Cap output where you can: max_tokens is optional, but a limit of a few hundred tokens stops a runaway answer from costing more than planned. Trim what you resend, because a prompt that fills the whole 100,000-token window costs $0.015 in input every time you send it, and a chat that resends everything gets pricier with each message. Pin a seed while testing prompts so a changed answer comes from your edit and not from chance. Save the X-Request-Id header with each call, which makes any bug report specific. Finally, when you retry after a 429, honor the five seconds from Retry-After and add a short random delay so parallel workers do not all return at once.

Errors you are likely to meet

Most first-day problems come from a short list of causes.

  • Base URL without /v1. The URL must end in /v1. Without it, the SDK builds paths the server does not know.
  • Wrong model name. Send uncensored, the one model ID this endpoint exposes. A model name copied from another vendor's docs will not match it.
  • Google-style payloads. A body with contents and parts belongs to Google's API. Here you send messages.
  • HTTP 429 with code rate_limited. You sent more than 300 requests in a minute on a full key, or 60 on a trial key. Slow down and retry.
  • HTTP 429 with code concurrency. You have too many requests in flight: 8 on a full key, 2 on a trial key. Queue your calls or lower your worker count.
  • HTTP 429 with a Retry-After: 5 header. The service is temporarily overloaded. Wait the five seconds and send the call again.

Failed or refused requests are not charged, so retrying costs you nothing extra. If you are comparing uncensored options before settling on one, the page on uncensored Grok alternatives and their common mistakes covers the choices people usually weigh.

Questions and answers

Can I call Google's Gemini models with this API?

No. This is an independent service with one open-weight model, ID uncensored. It does not proxy Google or any other vendor.

Do I need to install a special SDK?

No. The official OpenAI SDKs for Python and Node work after you change the base URL and key. Plain HTTP calls with curl work too.

How long does the trial credit last?

The $0.50 trial credit is valid for 7 days from the claim, needs no payment details and is limited to one per person. Trial keys allow 2 concurrent requests and 60 requests per minute.

Are my prompts used for training?

No. Prompts sent to the API are not used for training.

Your key is one form away

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