Use the OpenAI Python SDK with an uncensored LLM API
The official openai package talks to any server that speaks the Chat Completions format. Change the base URL and key and the rest of your code stays as it is.
Set it up
- Sign in at wildwestapi.com/signup/ with the six-digit code sent to your email, open the dashboard and create an API key. It starts with sk-ww- and is shown in full once, so copy it somewhere safe.
- Install the package with pip install openai.
- Export the key as WILDWEST_API_KEY in your shell or .env file.
- Create the client with base_url set to https://wildwestapi.com/v1 and api_key read from WILDWEST_API_KEY.
- Call client.chat.completions.create with model outlaw-1.
A working call
The client takes base_url and api_key as constructor arguments. The README for the package also lists the OPENAI_BASE_URL and OPENAI_API_KEY environment variables, which the client reads when the arguments are left out.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://wildwestapi.com/v1",
api_key=os.environ["WILDWEST_API_KEY"],
)
resp = client.chat.completions.create(
model="outlaw-1",
messages=[{"role": "user", "content": "Write the opening of a noir story."}],
)
print(resp.choices[0].message.content)Use outlaw-1 to start, or any id from the models page.
Environment variables instead of arguments
If you would rather not touch the code, set the two variables the SDK reads on its own and call OpenAI() with no arguments. This is handy for scripts and notebooks that already create a client, because nothing in them has to change.
export OPENAI_BASE_URL="https://wildwestapi.com/v1"
export OPENAI_API_KEY="$WILDWEST_API_KEY"Be careful with this in a shell where you also use OpenAI itself: every client started there will now send its key to Wild West.
Streaming and tool calling
Pass stream=True to chat.completions.create and loop over the chunks, reading chunk.choices[0].delta.content. Tool calling uses the normal tools parameter with function definitions. Most of the models support tools, so check the models page for the one you pick.
One limit to know
The API exposes the Chat Completions endpoint. The newer client.responses.create call targets a different path, so keep using chat.completions. Run this from a server, a script or a notebook. A browser tab cannot call the API directly because it does not answer cross-origin requests.
FAQ
Do I need to change my existing OpenAI code?
Only the client construction. Set base_url and api_key, and change the model string to outlaw-1. The create call and the response shape are the same.
Which model id should I use?
outlaw-1 is a good default. glm-5.3-outlaw, glm-5.3-flash-outlaw, mimo-v2.6-flash-outlaw and qwen3.8-27b-outlaw are the other uncensored ids. apex-flash and glm-5.3-flash-cyber are security tuned, not uncensored.