---
title: "OpenAI SDK base URL for uncensored pentest models"
canonical: https://pentestllm.ai/guides/sdks
generated: 2026-11-18T03:35:58.573Z
source: https://pentestllm.ai/guides/sdks
base_url: https://api.pentestllm.ai/v1
---

# Change the OpenAI SDK base URL to an uncensored security model

Set OPENAI_BASE_URL plus OPENAI_API_KEY and your OpenAI SDK code calls an uncensored build: Python, TypeScript, curl, the AI SDK, streaming, JSON, errors, cost.

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

You have scripts on the OpenAI SDK and a model that declines half of what an engagement asks. Every build in this catalog speaks the OpenAI wire format, so pointing those scripts at an uncensored or security-tuned build is two environment variables and no code change. This page shows the calls in Python, TypeScript, curl and the Vercel AI SDK, the error codes, and the live cost of a request.

## What you need: two variables

Any client built on the OpenAI API honors `OPENAI_BASE_URL` and `OPENAI_API_KEY`. Export both and none of the snippets below needs a URL or a key written into it. Stop the URL at `/v1`. The key is created in the [console](https://app.pentestllm.ai/console), begins with `sk-ptl-`, is shown to you once, and draws on credit you add from $10.

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

- OPENAI_BASE_URL: https://api.pentestllm.ai/v1 stops at /v1
- OPENAI_API_KEY: sk-ptl-live-… from the console
- model: glm-5.3-uncensored any id listed on the models page

No install at all: the prompt box on the home page gives a few free turns, and the [playground](https://pentestllm.ai/playground) runs the same builds from the browser once you hold a key.

## Python

Stock `openai` package, nothing patched. Because the response keeps the OpenAI shape, scripts you already have for triage or report drafting read it unchanged. The sample asks about a token bypass on an endpoint inside your scope, the kind of question a stock model tends to decline.

```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 JWT alg=none bypass works and how to test for it on an in-scope login endpoint."}],
    max_tokens=600,
)
print(response.choices[0].message.content)
```

Streaming is the usual `stream=True`; chunks arrive while the model writes, which suits long report sections.

```python
with client.chat.completions.create(
    model="glm-5.3-uncensored",
    messages=[{"role": "user", "content": "Draft the methodology section of a web application pentest report."}],
    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 client accepts `baseURL` and `apiKey` as constructor options; read them from the two variables.

```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 JWT alg=none bypass works and how to test for it on an in-scope login endpoint.' }],
  max_tokens: 600,
});
console.log(response.choices[0]?.message.content);
```

## Vercel AI SDK

Give `@ai-sdk/openai` the base URL and call `provider.chat(id)`, which keeps requests on Chat Completions, the route every listed build answers. `streamText`, `generateText` and `generateObject` all run on it. The [AI SDK guide](https://pentestllm.ai/guides/ai-sdk) goes deeper, tool calls included.

```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 JWT alg=none bypass works and how to test for it on an in-scope login endpoint.',
});
for await (const piece of result.textStream) process.stdout.write(piece);
```

## Prove it with curl

Listing models is free and confirms the key and URL together. The chat call after it is a single billed request.

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

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

Each response carries a request id header, and a non-streamed response also carries its charge in USD. The usage page of the console shows both.

## Cost per request

A request of 600 input tokens and 250 output tokens, across four builds, at the catalog prices of 2026-11-17:

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

| Model | Build | Input $/M | Output $/M |
| --- | --- | --- | --- |
| [GLM-5.3 Uncensored](https://pentestllm.ai/models/glm-5.3-uncensored) glm-5.3-uncensored | Uncensored | $0.282 | $0.846 |
| [DeepSeek V4.1 Flash Abliterated](https://pentestllm.ai/models/deepseek-v4.1-flash-abliterated) deepseek-v4.1-flash-abliterated | Abliterated | $0.8488 | $1.6975 |
| [GLM-5.3 Flash Uncensored](https://pentestllm.ai/models/glm-5.3-flash-uncensored) glm-5.3-flash-uncensored | Uncensored | $0.1053 | $0.3685 |
| [Kimi K3 Uncensored](https://pentestllm.ai/models/kimi-k3-uncensored) kimi-k3-uncensored | Uncensored | $5.745 | $28.68 |

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

## JSON, streaming, tools

Ask for a JSON body with `response_format` set to `json_object`; findings tables and detection rules are easier to parse that way. If the answer misses the format you asked for, the charge is refunded and the receipt’s `refund` field says so. `stream: true` is accepted on every model. Tool calling depends on the base model; each model page states whether its build takes it.

```python
response = client.chat.completions.create(
    model="glm-5.3-uncensored",
    messages=[{"role": "user", "content": "Return the three OWASP Top 10 categories most likely on a login form as JSON with keys category and first_test."}],
    response_format={"type": "json_object"},
)
```

## When it fails

- `401 invalid_api_key`: wrong or revoked key. Recopy it from the console.
- `402 insufficient_balance`: too little credit for this request. `402 monthly_limit_reached`: the monthly cap you set on the key is used up.
- `404 model_not_found`: that id is not on the models page. Compare the spelling.
- `429 rate_limited`: the key’s rate limit tripped; wait as long as `retry-after` says.
- Nothing is charged for a request that fails before a model answers.

## Questions

### Can I use the Anthropic SDK instead of the OpenAI one?

The API answers the Anthropic messages format too; the Claude Code setup page shows that path. This guide stays on the OpenAI format because every listed build answers it, from the OpenAI SDKs, the Vercel AI SDK, LiteLLM or plain HTTP. See the Claude Code setup page.

### I still need OpenAI for other calls. Can both coexist?

Yes. Build a second client with baseURL https://api.pentestllm.ai/v1 and this key, and leave your default client and its variables untouched.

### What rate limit applies?

Whatever you set per key in the console; a 429 carries retry-after. Beyond the balance itself there is no account-wide ceiling.

### Where is the list of valid model ids?

On the models page, or from GET /v1/models with your key, which returns exactly the ids that key may call. See the models page.

Every model above is on the [uncensored model list](https://pentestllm.ai/models) with its live price per million tokens. [Per-token pricing](https://pentestllm.ai/pricing) sets the whole catalog side by side, and the [family directory](https://pentestllm.ai/uncensored) groups the builds by base model.

[Get a key](https://app.pentestllm.ai/console) Prepaid from $10, 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.
