EN ▾
Get API key

gpt5apikey.comBest Uncensored LLM: the options compared

GPT-5 API Key Setup: SDK Config and a Cheaper Option

A key plus a base URL is all the OpenAI SDK needs. This page shows the setup in Python, Node and curl, and how changing one URL points the same code at an uncensored model.

Updated

A glowing key entering a terminal connected by a data line to a server, illustrating API key setup.
Key points
  • The OpenAI SDK reads a key and a base URL; swapping both is the whole migration.
  • Keep keys in environment variables, never in source files or client-side code.
  • Our endpoint uses the model ID uncensored and the same chat completions format.
  • A $0.50 trial credit lets you test the setup before topping up.
gpt5apikey.com/best-uncensored-llm/

The short version

If you searched for gpt-5 api key setup, the process has four steps, and they are the same for any OpenAI-compatible service: create a key in the provider's dashboard, store it as an environment variable, point your SDK at the provider's base URL, and send a test request. Nothing about the flow is specific to one model name.

  1. Create a key and copy it once. Treat it like a password.
  2. Export it as OPENAI_API_KEY (or any name you prefer) in your shell or deployment settings.
  3. Set the base URL. For the OpenAI platform you can leave the default. For this site it is https://api.gpt5apikey.com/v1.
  4. Call POST /v1/chat/completions with a model ID and a list of messages.

The rest of this page walks through each step with code you can paste. The examples use this site's endpoint and the model ID uncensored, so you can run them as soon as you have a key from the API key page. If you hold a key from another provider, the same snippets work after you change the base URL, the key and the model name.

Store the key before you write any code

Most leaked keys end up in a public repository because someone pasted them into a script for a quick test. Avoid that habit from the first minute. Put the key in an environment variable and read it at runtime.

On macOS or Linux, add this to your shell profile or a local .env file that your tooling loads:

export OPENAI_API_KEY="paste-your-key-here"
export OPENAI_BASE_URL="https://api.gpt5apikey.com/v1"

Recent versions of the official OpenAI SDKs read both OPENAI_API_KEY and OPENAI_BASE_URL on their own, so a client created with no arguments will already point at the right host. Being explicit in code is still clearer for the next person who reads it, and the examples below do that.

Add .env to .gitignore before your first commit. If a key ever lands in a commit, deleting the file is not enough, because the history keeps it. Revoke the key and create a new one.

Never ship the key to a browser

A key placed in front-end JavaScript is visible to every visitor. Call the API from a server route or a backend job, and let your page talk to your own server. This also gives you one place to add your own rate limits and logging.

Python with the openai package

Install the SDK with pip install openai. Then create a client with the base URL and key, and send a chat request.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.gpt5apikey.com/v1",
    api_key=os.environ["OPENAI_API_KEY"],
)

resp = client.chat.completions.create(
    model="uncensored",
    messages=[
        {"role": "system", "content": "You are a direct, concise assistant."},
        {"role": "user", "content": "Explain what a base URL is in two sentences."},
    ],
    temperature=0.7,
)

print(resp.choices[0].message.content)
print(resp.usage)

The usage object reports prompt and completion tokens, which is what you are billed on. Responses also carry an X-Balance-USD header, so you can watch your remaining credit without opening a dashboard.

For long outputs, stream the reply so the first words appear quickly:

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Write a short scene set in a lighthouse."}],
    stream=True,
)
for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)

Node.js and curl

The Node SDK has the same shape. Install it with npm install openai.

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.gpt5apikey.com/v1",
  apiKey: process.env.OPENAI_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Give me three names for a fantasy tavern." }],
});

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

When something misbehaves, drop the SDK and test with curl. If curl works and your code does not, the fault is in your client setup, not in the key.

curl https://api.gpt5apikey.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Say hello in one line."}]
  }'

You can also list what the key can use with GET /v1/models. It is a cheap way to confirm that authentication works before you send a real prompt.

Switching providers with configuration, not code edits

People who search for a setup guide are often not starting from zero. They have an app that already calls a hosted model, and they want a second option for requests that a stricter provider refuses, or for jobs where cost matters. The clean way to handle that is to move the three provider-specific values out of your code.

import os
from openai import OpenAI

client = OpenAI(
    base_url=os.environ.get("LLM_BASE_URL", "https://api.gpt5apikey.com/v1"),
    api_key=os.environ["LLM_API_KEY"],
)
MODEL = os.environ.get("LLM_MODEL", "uncensored")

With this layout, a staging environment can use one provider and production another, and a rollback is a settings change. The request format is the same everywhere in the OpenAI-compatible family, so messages, stream, tools and response_format keep working without edits. Only the model name changes.

Be clear-eyed about what a swap means. This service is not the official API of any big vendor and it does not route to other vendors. It runs one open-weight model, tuned to answer without content refusals for lawful adult use, and it is text only. Prompts that depend on image input, embeddings or fine-tuning need a different tool. The quickstart lists the supported features, including streaming, tool calling and JSON mode.

Errors you are likely to hit

Most first-run failures come from a short list of mistakes.

  • Wrong base URL. The path must end in /v1. A missing suffix or a doubled /v1/v1 gives a not-found response.
  • Key not loaded. If os.environ["OPENAI_API_KEY"] raises a KeyError, your shell session never saw the export. Open a new terminal or load the .env file.
  • Wrong model name. Use uncensored here. A model name copied from another provider will not match.
  • Extra whitespace. A trailing newline pasted with the key breaks the Authorization header. Trim it.

Rate limit responses

A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 concurrent requests and 60 requests per minute. Go over and you get HTTP 429. The error code rate_limited means too many requests per minute, and concurrency means too many at once. A streamed request holds its slot until the stream finishes, so a client that abandons streams without closing them can hit the concurrency limit sooner than you expect. On temporary overload the API also returns 429 with a Retry-After: 5 header, so wait five seconds and retry.

Check the X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency response headers if you want to confirm which limits apply to your key.

Testing for free, then paying only for what you use

After you sign up with Google, or with an email and password, the key page offers a one-click trial claim of $0.50 in credit. It needs no card, lasts 7 days, and each person gets one. At the listed rates that is enough for hundreds of short test calls, which is plenty to check your client setup, streaming and any tool calling code.

When you move to real use, credit is prepaid. Top-ups run from $20 to $500 in whole amounts, with a bonus of 5% from $50, 10% from $100 and 15% from $200. You can pay with USDT on TRC20 or USDC on Base. Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens, failed or refused requests are not charged, and credit never expires. The pricing page has the full table.

If you are still choosing a model and want to see how this option sits next to others, the comparison of uncensored LLM options covers the trade-offs. Prompts sent to this API are not used for training.

Questions and answers

Where do I put my API key in the OpenAI SDK?

Pass it as the api_key argument, or set the OPENAI_API_KEY environment variable and let the SDK read it. Keep it out of source files and out of browser code.

Do I need to change my code to use a different OpenAI-compatible provider?

Only three values: the base URL, the key and the model name. The request and response formats stay the same.

Can I test the setup without paying?

Yes. New users can claim $0.50 of trial credit with one click on the API key page. It needs no card and is valid for 7 days.

Why do I get a 429 error right after starting?

You hit the per-minute or concurrency limit for your key, or the service was briefly overloaded. Check the error code, then wait and retry; an overload response carries a Retry-After header of 5 seconds.

Your key is one form away

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

Get API key