OpenAI Compatible API Key Header: Setup and Fixes
The OpenAI compatible API key header is a single line, Authorization: Bearer followed by your key, sent with every request to the right base URL. Most failures come from small slips around that line, and this page covers each one.
Updated

Key points
- +Send the key as Authorization: Bearer YOUR_KEY on every request.
- +The base URL is https://api.geminiuncensored.com/v1 and clients append the endpoint path themselves.
- +GET /v1/models is the fastest way to confirm that your key and URL work.
- +Most auth problems trace back to a stray space, a doubled /v1 or a key stored in the wrong variable.
The short answer
Every request to this service carries one header:
curl https://api.geminiuncensored.com/v1/models \
-H "Authorization: Bearer YOUR_KEY"
That is the whole scheme. The word Bearer, one space, then the key with nothing around it. No custom header names, no key in the query string, no signature. If you already have code that talks to an OpenAI-style API, you change two values, the base URL and the key, and set the model name to uncensored.
Two endpoints are available: POST /v1/chat/completions for chat and GET /v1/models for the model list. The model list call is cheap and a good first test, since a successful reply proves the URL and the key at once.
Where each value goes
| Setting | Value | Notes |
|---|---|---|
| Base URL | https://api.geminiuncensored.com/v1 | Ends in /v1, no trailing slash needed |
| Header | Authorization: Bearer YOUR_KEY | Set automatically by OpenAI SDKs |
| Content type | Content-Type: application/json | Needed for POST requests with curl |
| Model | uncensored | Goes in the request body, not the header |
The base URL already contains /v1. A client that adds /chat/completions produces the full path /v1/chat/completions. If you paste the complete endpoint into a field that expects only a base, the request lands on a path like /v1/chat/completions/chat/completions and fails.
Get a key from the API key page. After sign-up with Google, or with email and password, new users can claim $0.50 of trial credit with one click, valid for 7 days. The trial key has lower limits than a full key: 2 concurrent requests and 60 requests per minute.
Set it up in Python and Node
The official OpenAI SDKs build the header for you. Pass the key and the base URL when you create the client.
from openai import OpenAI
client = OpenAI(
base_url="https://api.geminiuncensored.com/v1",
api_key="YOUR_KEY",
)
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Reply with the single word: ready"}],
)
print(resp.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.geminiuncensored.com/v1",
apiKey: process.env.UNCENSORED_API_KEY,
});
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Reply with the single word: ready" }],
});
console.log(resp.choices[0].message.content);
Reading the key from an environment variable keeps it out of your repository. Both SDKs also read OPENAI_API_KEY and OPENAI_BASE_URL automatically when you create a client with no arguments, which is handy for tools you do not control. Export both and the tool picks them up.
export OPENAI_API_KEY="YOUR_KEY"
export OPENAI_BASE_URL="https://api.geminiuncensored.com/v1"
curl "$OPENAI_BASE_URL/chat/completions" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "uncensored", "messages": [{"role": "user", "content": "ping"}]}'
Fix common authentication problems
When a request is rejected, the cause is nearly always one of these. A rejected key is normally reported as an HTTP 401 status, though you should read the error body in your own client for the exact text.
| Symptom | Likely cause | Fix |
|---|---|---|
| Key rejected right after pasting | Trailing space or newline copied with the key | Trim the value; in shell use printf or tr -d '\n' when storing it |
| Works in curl, fails in the app | The app sends your key to the default OpenAI URL | Set the base URL field or OPENAI_BASE_URL |
| Not-found error on every call | Missing /v1 or a doubled endpoint path | Use the base URL exactly as shown above |
| Key ignored | Sent as x-api-key or in the URL | Use the Authorization header with Bearer |
| Intermittent rejections after a deploy | An old key in a second environment variable | Print which variable your process reads |
| Rate-limit responses | Over 300 requests per minute, or 8 concurrent, on a full key | Queue and retry with a delay |
A quick isolation test: run the curl command from the first section on the same machine as your app. If curl succeeds, the key and URL are fine and the bug is in how your app builds the client.
Check everything with one script
When a tool misbehaves, a small diagnostic script separates a key problem from a tool problem. This one reads the key from the environment, calls the model list and prints what it finds.
import os
import requests
BASE = "https://api.geminiuncensored.com/v1"
KEY = os.environ.get("UNCENSORED_API_KEY", "").strip()
print("key length:", len(KEY))
r = requests.get(
BASE + "/models",
headers={"Authorization": "Bearer " + KEY},
timeout=30,
)
print("status:", r.status_code)
print("request id:", r.headers.get("X-Request-Id"))
print("balance:", r.headers.get("X-Balance-USD"))
print(r.text[:300])
chat = requests.post(
BASE + "/chat/completions",
headers={"Authorization": "Bearer " + KEY},
json={"model": "uncensored", "messages": [{"role": "user", "content": "ping"}]},
timeout=60,
)
print("chat status:", chat.status_code)
Compare the printed key length with what you expect. A length that is off by one usually means a newline was saved with the key. A good status on both calls means the problem sits in the tool you are configuring, not in your credentials.
Configure tools that have a custom endpoint field
Many desktop clients, editor plugins and chat front ends include a setting for an OpenAI-compatible provider. The labels differ, but they map onto the same three values.
| You may see | Enter |
|---|---|
| Base URL, API base, endpoint, host | https://api.geminiuncensored.com/v1 |
| API key, secret key, token | Your key, without the word Bearer |
| Model, model name, model ID | uncensored |
Do not type the word Bearer into a key field. The tool adds it when it builds the header, and a doubled prefix is a classic cause of rejected keys. If a tool offers a "test connection" button, it normally calls the model list, which is the same check as the curl command above.
If the tool insists on a list of models it knows, look for an option named "custom" or "other" and type the model ID by hand.
Behind a server of your own
When browser code needs the model, send the browser to your own endpoint and attach the header there. A tiny proxy keeps the key private:
import express from "express";
const app = express();
app.use(express.json());
app.post("/chat", async (req, res) => {
const upstream = await fetch("https://api.geminiuncensored.com/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.UNCENSORED_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ model: "uncensored", messages: req.body.messages }),
});
res.status(upstream.status).json(await upstream.json());
});
app.listen(3000);
Add your own user checks and a per-user limit before you put it online, since anyone who can reach this route can spend your balance.
Read the response headers
Successful responses include headers that help you operate the integration:
X-Request-Ididentifies the request. Log it, and include it whenever you report a problem.X-Balance-USDshows your remaining prepaid credit, so you can alert before it runs out.X-RateLimit-Limit-RequestsandX-RateLimit-Limit-Concurrencyreport the limits that apply to your key.
To see them, add -i to curl, or use client.chat.completions.with_raw_response.create(...) in the Python SDK and read .headers. Failed or refused requests are not charged, so retrying after an error does not cost you tokens.
Keep the key safe
A bearer key is a password. Anyone who has it can spend your balance, so treat it that way.
- Never put it in front-end JavaScript, a mobile app bundle or a public repository. Call the API from your server and let your own users authenticate with your system.
- Treat a key you have pasted into a chat, a ticket or a screenshot as exposed, and replace it.
- Do not log full Authorization headers. Log the request id instead.
Prompts are not used for training, but your key is still yours to guard. If you are moving an existing Gemini-based app, the quickstart for migrating walks through the changes in order, and the pricing page explains prepaid credit and crypto top-ups in USDT on TRC20 or USDC on Base.
More guides
Questions and answers
What format does the Authorization header use?
Authorization: Bearer YOUR_KEY, with a single space after the word Bearer and no quotes around the key.
Can I pass the key as a query parameter?
No. Send it in the Authorization header. Keys in URLs end up in logs and browser history.
Which URL do I give my OpenAI client?
Use https://api.geminiuncensored.com/v1 as the base URL. The client adds /chat/completions or /models itself.
How do I test that my key works?
Send GET /v1/models with the header. A normal response with the model list means the key and URL are correct.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.