---
title: "OpenAI SDK setup for uncensored models: Python, Node, curl"
canonical: https://uncensoredllm.ai/guides/sdks
generated: 2026-11-24T09:14:34.531Z
source: https://uncensoredllm.ai/guides/sdks
base_url: https://api.uncensoredllm.ai/v1
---

# The OpenAI SDK with uncensored models

Set OPENAI_BASE_URL and OPENAI_API_KEY and keep your code: Python, TypeScript, curl and the Vercel AI SDK, streaming, JSON output, the error codes, and what a request costs at the live price.

Steps checked October 26, 2026 · prices as of November 24, 2026

Call UncensoredLLM with the OpenAI SDK using model `abliterated-model` and base URL `https://api.uncensoredllm.ai/v1`: set `OPENAI_BASE_URL` and `OPENAI_API_KEY` and keep the rest of your code. Every model on this catalog answers the same OpenAI wire format. This page has the Python, TypeScript, curl and Vercel AI SDK calls, streaming, JSON output, the error codes, and what a request costs at the live price.

## Two environment variables

Every SDK that speaks the OpenAI API reads the same two variables. Set them once; the code that follows needs no key or URL in it. The base URL ends in `/v1`; the key comes from the [console](https://app.uncensoredllm.ai/console), starts with `sk-ullm-`, is shown once and spends a prepaid balance that starts at $3.

```bash
export OPENAI_BASE_URL="https://api.uncensoredllm.ai/v1"
export OPENAI_API_KEY="sk-ullm-live-…"
```

- OPENAI_BASE_URL: https://api.uncensoredllm.ai/v1 ends in /v1; nothing after it
- OPENAI_API_KEY: sk-ullm-live-… created in the console
- model: glm-5.3-uncensored any id from the models page

## Python

The official `openai` package, unchanged. The response has the OpenAI shape, so code written for OpenAI reads it the same way.

```python
from openai import OpenAI

client = OpenAI()  # reads OPENAI_BASE_URL and OPENAI_API_KEY

response = client.chat.completions.create(
    model="glm-5.3-uncensored",
    messages=[{"role": "user", "content": "Explain how a lock pick works, step by step."}],
    max_tokens=600,
)
print(response.choices[0].message.content)
```

Streaming is the same flag as on OpenAI; the chunks arrive as the model writes them.

```python
with client.chat.completions.create(
    model="glm-5.3-uncensored",
    messages=[{"role": "user", "content": "Write a villain's monologue."}],
    stream=True,
) as events:
    for chunk in events:
        piece = chunk.choices[0].delta.content
        if piece:
            print(piece, end="", flush=True)
```

## TypeScript

The `openai` npm package takes `baseURL` and `apiKey` in its constructor; the environment variables above fill them.

```javascript
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: process.env.OPENAI_BASE_URL,
  apiKey: process.env.OPENAI_API_KEY,
});

const response = await client.chat.completions.create({
  model: 'glm-5.3-uncensored',
  messages: [{ role: 'user', content: 'Explain how a lock pick works, step by step.' }],
  max_tokens: 600,
});
console.log(response.choices[0]?.message.content);
```

## Vercel AI SDK

`@ai-sdk/openai` with a custom base URL; `provider.chat(id)` uses the Chat Completions path, which every listed model answers. `streamText`, `generateText` and `generateObject` all work.

```javascript
import { createOpenAI } from '@ai-sdk/openai';
import { streamText } from 'ai';

const provider = createOpenAI({
  baseURL: process.env.OPENAI_BASE_URL,
  apiKey: process.env.OPENAI_API_KEY,
});

const result = streamText({
  model: provider.chat('glm-5.3-uncensored'),
  prompt: 'Explain how a lock pick works, step by step.',
});
for await (const piece of result.textStream) process.stdout.write(piece);
```

## Check it with curl

The list call is free and tells you the key and base URL are right; the chat call is one billed request.

```bash
curl https://api.uncensoredllm.ai/v1/models -H "Authorization: Bearer sk-ullm-live-…"
```

```bash
curl https://api.uncensoredllm.ai/v1/chat/completions \
  -H "Authorization: Bearer sk-ullm-live-…" \
  -H "Content-Type: application/json" \
  -d '{"model": "glm-5.3-uncensored", "messages": [{"role": "user", "content": "Hello"}]}'
```

Every answer carries `x-uplink-request-id`; a non-streamed answer carries `x-uplink-charge`, what it cost in USD. The console’s usage page lists both.

## What a request costs

One request of 600 input and 250 output tokens, on four builds, at the catalog prices on 2026-11-24:

| Model | One request | 1,000 requests |
| --- | --- | --- |
| [GLM-5.3 Uncensored](https://uncensoredllm.ai/models/glm-5.3-uncensored) | $0.00044 | $0.44 |
| [DeepSeek V4.1 Flash Abliterated](https://uncensoredllm.ai/models/deepseek-v4.1-flash-abliterated) | $0.00093 | $0.93 |
| [GLM-5.3 Flash Uncensored](https://uncensoredllm.ai/models/glm-5.3-flash-uncensored) | $0.00018 | $0.18 |
| [Uncensored Kimi K3](https://uncensoredllm.ai/models/kimi-k3-uncensored) | $0.01 | $10.62 |

Detected refusals and invalid non-streamed JSON qualify for automatic refunds within the daily cap. [Verify your receipt](https://uncensoredllm.ai/statements/verify).

| Model | Build | Input $/M | Output $/M |
| --- | --- | --- | --- |
| [GLM-5.3 Uncensored](https://uncensoredllm.ai/models/glm-5.3-uncensored) glm-5.3-uncensored | Uncensored | $0.3243 | $0.9729 |
| [DeepSeek V4.1 Flash Abliterated](https://uncensoredllm.ai/models/deepseek-v4.1-flash-abliterated) deepseek-v4.1-flash-abliterated | Abliterated | $0.8488 | $1.6975 |
| [GLM-5.3 Flash Uncensored](https://uncensoredllm.ai/models/glm-5.3-flash-uncensored) glm-5.3-flash-uncensored | Uncensored | $0.1211 | $0.4238 |
| [Uncensored Kimi K3](https://uncensoredllm.ai/models/kimi-k3-uncensored) kimi-k3-uncensored | House build | $5.745 | $28.68 |

Prices per million tokens, read from the live catalog on 2026-11-24.

## JSON output, streaming and tools

`response_format` with `json_object` asks the model for a JSON body; an answer that is not the format asked for is refunded, as the receipt’s `refund` field records. `stream: true` works on every model. Tool calling works on the builds whose base model supports it; the model page says which.

```python
response = client.chat.completions.create(
    model="glm-5.3-uncensored",
    messages=[{"role": "user", "content": "Give three plot hooks as JSON with keys title and premise."}],
    response_format={"type": "json_object"},
)
```

## Errors

- `401 invalid_api_key`: the key is wrong or revoked. Copy it again from the console.
- `402 insufficient_balance`: the balance does not cover the request. `402 monthly_limit_reached`: the key hit the spend limit set on it.
- `404 model_not_found`: the id is not on the models page. Check the spelling.
- `429 rate_limited`: the key hit its rate limit; `retry-after` says how long to wait.
- A request that fails before the model answers is not charged.

## Questions

### What settings change to point the OpenAI SDK here?

Only two: OPENAI_BASE_URL to https://api.uncensoredllm.ai/v1 and OPENAI_API_KEY to a sk-ullm- key from the console. The model id is any id from the models page; the request and response shapes are unchanged. See the models page.

### Does the Anthropic or Gemini SDK work?

Yes. Every listed build answers the Anthropic Messages format at https://api.uncensoredllm.ai (set ANTHROPIC_BASE_URL and use the same key) and the Google Gemini generateContent format, alongside the OpenAI SDK, the Vercel AI SDK with the OpenAI provider, LiteLLM and plain HTTP.

### How do I stream tokens?

Set stream: true (stream=True in Python) exactly as on OpenAI; chunks arrive as the model writes them and every listed model supports it. The Vercel AI SDK streamText works the same way.

### Why does authentication fail?

A 401 invalid_api_key means the key is wrong or revoked: copy it again from the console, send it as the bearer token, and keep the base URL ending in /v1 with nothing after it. A request that fails before the model answers is not charged.

### Can I keep OPENAI_API_KEY for OpenAI and add this as a second client?

Yes. Construct a second client with baseURL https://api.uncensoredllm.ai/v1 and this key, and leave the default client alone.

### Is there a rate limit?

Per key, set in the console; a 429 carries retry-after. There is no account-wide cap beyond the balance.

### Where do the model ids come from?

The models page, or GET /v1/models with your key, which lists exactly the ids the key can call. See the models page.

Named here, at today’s prices:

- [GLM-5.3 Uncensored](https://uncensoredllm.ai/models/glm-5.3-uncensored), $0.9729 per M output, [GLM family](https://uncensoredllm.ai/uncensored/glm)
- [GLM-5.3 Flash Uncensored](https://uncensoredllm.ai/models/glm-5.3-flash-uncensored), $0.4238 per M output, [GLM family](https://uncensoredllm.ai/uncensored/glm)
- [Uncensored Kimi K3](https://uncensoredllm.ai/models/kimi-k3-uncensored), $28.68 per M output
- [DeepSeek V4.1 Flash Abliterated](https://uncensoredllm.ai/models/deepseek-v4.1-flash-abliterated), $1.6975 per M output, [DeepSeek family](https://uncensoredllm.ai/uncensored/deepseek)
- [Abliterated Model](https://uncensoredllm.ai/models/abliterated-model), $7.50 per M output

[Get a key](https://app.uncensoredllm.ai/console) Prepaid from $3, no subscription.

## New models and price changes, once a month.

New uncensored builds with their prices, price moves, and what the daily model check found.
