Key points
- Our base URL is https://api.uncensoredgptapi.com/v1 and the model ID is
uncensored. - Python and Node SDKs take base_url or baseURL; both also read environment variables.
- Most failures come from a missing /v1, a doubled path, or an old model name.
- GET /v1/models is the quickest way to confirm the URL and key are right.
What the base URL does
The gpt api base_url is the address that an OpenAI SDK prepends to every endpoint path. By default the official SDKs send requests to OpenAI's servers. If you set a different base URL, the same client code sends the same request format to another server that speaks the same protocol.
That is all that OpenAI-compatible means in practice. Our API accepts POST /v1/chat/completions and GET /v1/models with the same JSON shapes, the same Authorization: Bearer header and the same streaming format. So you change three values:
- Base URL:
https://api.uncensoredgptapi.com/v1 - API key: the key from your dashboard
- Model:
uncensored
Our service is an independent one that runs a single open-weight model. It is not OpenAI's API and not a router to other vendors, so model names like gpt-4o do not exist here. Use uncensored everywhere.
Python with the OpenAI SDK
In the current Python SDK, pass base_url when you create the client.
from openai import OpenAI
client = OpenAI(
base_url="https://api.uncensoredgptapi.com/v1",
api_key="YOUR_API_KEY",
)
resp = client.chat.completions.create(
model="uncensored",
messages=[
{"role": "system", "content": "You are a concise assistant."},
{"role": "user", "content": "Explain what a base URL is in two sentences."},
],
)
print(resp.choices[0].message.content)If your code is older and uses openai.api_base, it is on the pre-1.0 SDK, where the global setting has a different name. Upgrading the package is usually easier than adapting. Check the version with pip show openai.
It helps to know how the SDK builds a request. It takes your base URL, appends the endpoint path such as /chat/completions, and adds the Authorization: Bearer header from your key. That is the whole mechanism. When something fails, print or log the final URL, and compare it with the curl command in the next section.
The same client accepts timeout and max_retries settings. The defaults retry a few times on connection problems, which is fine for most scripts. For rate limits, catch the SDK's rate limit exception and back off. A streamed request holds its concurrency slot until it ends, so a burst of long streams can hit the concurrency limit even when your request count per minute is low.
import time
from openai import OpenAI, RateLimitError
client = OpenAI(base_url="https://api.uncensoredgptapi.com/v1", api_key="YOUR_API_KEY", max_retries=0)
def ask(text, tries=4):
for attempt in range(tries):
try:
r = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": text}],
)
return r.choices[0].message.content
except RateLimitError:
time.sleep(5 * (attempt + 1))
raise RuntimeError("still rate limited")The wait of five seconds on the first retry matches the Retry-After: 5 value the API sends on temporary overload. Waiting longer on each later attempt avoids hammering the endpoint.
Node and curl
The Node SDK uses baseURL with a capital URL.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.uncensoredgptapi.com/v1",
apiKey: process.env.API_KEY,
});
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Name three uses for a base URL." }],
});
console.log(resp.choices[0].message.content);Without any SDK, curl shows exactly what the SDK does. The full URL is the base URL plus /chat/completions.
curl https://api.uncensoredgptapi.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"uncensored","messages":[{"role":"user","content":"ping"}]}'Reading that command is the clearest way to grasp the base URL: everything up to and including /v1 is the base, and the SDK adds the rest.
Environment variables
If you cannot edit the code, or you want one setting for several scripts, the OpenAI SDKs read OPENAI_BASE_URL and OPENAI_API_KEY from the environment when no explicit value is given.
export OPENAI_BASE_URL="https://api.uncensoredgptapi.com/v1"
export OPENAI_API_KEY="YOUR_API_KEY"
python my_script.pyThis is handy for tools you did not write. Anything built on the OpenAI SDK may pick the variables up without changes, though you still need to set the model name to uncensored inside the tool. If the tool hard-codes a model, you need its own setting or a code change.
Keeping two endpoints apart
Many projects test against one endpoint and ship against another, or switch between them by environment. Keep the three values out of your code and read them from configuration, so a switch is a change to a file and not a code edit.
import os
from openai import OpenAI
client = OpenAI(
base_url=os.environ.get("LLM_BASE_URL", "https://api.uncensoredgptapi.com/v1"),
api_key=os.environ["LLM_API_KEY"],
)
MODEL = os.environ.get("LLM_MODEL", "uncensored")Using your own variable names instead of the SDK's defaults avoids a quiet trap: a tool that reads OPENAI_API_KEY from the shell will send whatever key is set there to whatever base URL is set next to it. If you have an old OpenAI key in your profile and a new base URL in your project, you can end up sending one service's key to the other. Separate names make that impossible, and you can see at a glance which endpoint a script will use.
Treat the model name as configuration too. It is the value most often left behind when you switch, and it produces the most confusing failures, since everything else looks correct.
Streaming and tools use the same base URL
Changing the base URL does not limit features. Streaming, tool calling and JSON mode go through the same /chat/completions path, so code that worked against the original API keeps working. Streaming returns Server-Sent Events, with usage reported at the end of the stream.
from openai import OpenAI
client = OpenAI(base_url="https://api.uncensoredgptapi.com/v1", api_key="YOUR_API_KEY")
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Count from one to five."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
print()The guard on chunk.choices matters. The final chunk that carries usage may have no choices, and code that indexes into an empty list would crash on the last message. Tool calls stream the same way, as partial tool_calls deltas that you assemble before running the function, and results go back as messages with role: "tool". JSON mode takes response_format={"type": "json_object"}.
Apps and frameworks with a base URL field
Many apps expose the same setting under different names: API base, endpoint, custom OpenAI URL, or host. The rule does not change. Paste the base URL including /v1, paste the key, and type uncensored as the model name.
SillyTavern, for example, lets you add an OpenAI-compatible endpoint. LangChain's ChatOpenAI class accepts a base_url argument. Other front-ends call the field a proxy URL or reverse proxy. Field names vary by version, so look for the one that takes a URL ending in /v1.
A few apps ask for a model from a dropdown they fill by calling GET /v1/models. That endpoint works here and returns the model list, so the dropdown should show uncensored once the URL and key are correct. If it stays empty, the URL or key is wrong.
When an app offers both a base URL field and an "organization" or "project" field, leave the extra fields empty. Those exist for the original service and mean nothing here. If an app insists on a key that starts with a certain prefix, try a different connection type, such as a generic or custom OpenAI-compatible option, rather than the preset for the original service.
Some desktop tools test the connection by requesting a specific model name from the original provider, and report a failure even when the endpoint is fine. In that case, skip the test button and send a real message instead. If the reply arrives, the URL, key and model are correct, and the tool is only being strict in its check.
Browser-based tools can also run into cross-origin rules, since the request leaves the page for a different host. If a web tool fails in the browser but the same call works in curl, run the request from a small server of your own so the key stays out of client-side code, which is the safer design in any case.
Common mistakes and how to fix them
Almost every failed setup comes from a short list.
- Missing /v1. The base URL is
https://api.uncensoredgptapi.com/v1, the whole address up to/v1and not only the host name. Without/v1the SDK builds paths that do not exist. - Doubled path. If you paste
.../v1/chat/completionsas the base URL, the SDK appends the path again. Give it only the base. - Trailing slash. Most SDKs handle it, but a few tools do not. Try without one.
- Old model name. A model name like
gpt-4oleft over from the original code will not match. Setuncensored. - Wrong key. Use the key from this service. An OpenAI key does not work here, and ours does not work on OpenAI.
- Rate limit errors. HTTP 429 with code
rate_limitedmeans too many requests per minute; codeconcurrencymeans too many at once. A 429 with aRetry-After: 5header marks temporary overload, so wait five seconds and retry.
Our troubleshooting guide goes through integration errors in more detail.
Verify the setup in one call
Before you run your whole application, call the models endpoint. It is cheap and confirms the URL and the key together.
curl https://api.uncensoredgptapi.com/v1/models \
-H "Authorization: Bearer $API_KEY"If that returns a list containing uncensored, send a real chat request. For a full key, expect up to 8 concurrent requests and 300 requests per minute; a trial key allows 2 concurrent and 60 per minute. Each response includes X-Request-Id, X-Balance-USD and the rate limit headers, useful when you debug.
To get a key, sign up and use the API key page, where new users can claim a $0.50 trial credit with one click. The docs cover streaming, tool calling and JSON mode once the connection works.
