Point the AI SDK OpenAI-compatible provider at a pentest model

createOpenAICompatible once, then generateText, streamText and tool() against an uncensored build: tool support, usage fields, a Next.js route, errors, cost.

Steps checked November 2, 2026 · prices as of November 17, 2026

If you are writing your own tooling on the AI SDK, a triage script, a report drafter, a scope-aware agent, one createOpenAICompatible call puts every build in this catalog behind it, including the security-tuned ones that answer questions a stock model refuses. Below: the provider, then generateText, streamText and tool() against an uncensored build, tool support per build, a Next.js handler, the error codes and the live cost of a call.

What you need

Install ai and @ai-sdk/openai-compatible, the provider package for any server that answers OpenAI Chat Completions. zod only matters for the scope-lookup tool later on.

shell
1pnpm add ai @ai-sdk/openai-compatible zod
2# or
3npm install ai @ai-sdk/openai-compatible zod

Create the key in the console. It begins with sk-ptl-, you see it once, and it draws on prepaid credit you add from $10. Export it as a variable so no source file carries it.

shell
1export PENTESTLLM_API_KEY="sk-ptl-live-…"

Build the provider

Three arguments go into createOpenAICompatible: a name, this API’s baseURL and your apiKey. Stop the URL at /v1, since the SDK appends /chat/completions itself. Set includeUsage or streamed answers come back without token counts, and the cost section further down needs them.

provider.ts
1import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
2
3export const uncensored = createOpenAICompatible({
4 name: 'pentestllm',
5 baseURL: 'https://api.pentestllm.ai/v1',
6 apiKey: process.env.PENTESTLLM_API_KEY,
7 includeUsage: true, // usage in streaming responses too
8});
name
pentestllm
free text; the key under which providerOptions addresses this provider
baseURL
https://api.pentestllm.ai/v1
stops at /v1
apiKey
process.env.PENTESTLLM_API_KEY
goes out as Authorization: Bearer
model
uncensored('glm-5.3-uncensored')
any id on the models page; provider.chatModel(id) does the same

The same URL and key work in the plain OpenAI SDKs and in every other client that speaks this format. For a try without installing anything, the prompt box on the home page gives a few free turns, and the playground runs any build once you have a key.

First reply with generateText

Calling the provider with an id gives you a chat model object for the model field. Back come text, finishReason and a usage object whose inputTokens, outputTokens and totalTokens are exactly what you were charged for. The sample question is one a stock model often declines; the builds here answer it.

generate.ts
1import { generateText } from 'ai';
2import { uncensored } from './provider';
3
4const { text, usage, finishReason } = await generateText({
5 model: uncensored('glm-5.3-uncensored'),
6 prompt: 'Explain how a JWT alg=none bypass works and how to test for it on an in-scope login endpoint.',
7});
8
9console.log(text);
10console.log(usage.inputTokens, usage.outputTokens, usage.totalTokens, finishReason);

Streaming, and a route handler

streamText does not wait for the model. Read textStream piece by piece, then await result.usage, which settles once the last chunk arrives. Report drafts are where streaming pays off: the tester reads while the model writes.

stream.ts
1import { streamText } from 'ai';
2import { uncensored } from './provider';
3
4const result = streamText({
5 model: uncensored('glm-5.3-flash-uncensored'),
6 prompt: 'Draft the executive summary of a web app pentest report: two criticals, one high, remediation first.',
7});
8
9for await (const piece of result.textStream) process.stdout.write(piece);
10
11const usage = await result.usage; // resolves when the stream ends; needs includeUsage on the provider
12console.log(usage.inputTokens, usage.outputTokens);

Inside a Next.js route, hand back result.toTextStreamResponse() when the client wants raw text, or result.toUIMessageStreamResponse() when it uses useChat.

route.ts
1// app/api/chat/route.ts
2import { streamText } from 'ai';
3import { uncensored } from '@/lib/provider';
4
5export async function POST(req: Request) {
6 const { prompt } = (await req.json()) as { prompt: string };
7 const result = streamText({
8 model: uncensored('glm-5.3-uncensored'),
9 prompt,
10 });
11 return result.toTextStreamResponse();
12}

Tool calls

A tool() is a description, an inputSchema and an execute function. With stopWhen: isStepCount(5) the SDK runs whatever the model asks for, feeds the result back and repeats, five rounds at most. steps keeps every call and result. The example gives the model a scope lookup, the kind of guardrail an engagement agent should have before it touches a host.

tools.ts
1import { generateText, isStepCount, tool } from 'ai';
2import { z } from 'zod';
3import { uncensored } from './provider';
4
5const { text, steps } = await generateText({
6 model: uncensored('glm-5.3-uncensored'),
7 tools: {
8 scope: tool({
9 description: 'Look up a host in the engagement scope file',
10 inputSchema: z.object({
11 host: z.string().describe('The hostname or IP to check'),
12 }),
13 execute: async ({ host }) => ({ host, inScope: true, notes: 'prod web tier, test window 02:00-06:00 UTC' }),
14 }),
15 },
16 stopWhen: isStepCount(5), // keep calling tools for up to 5 steps
17 prompt: 'Is app.example.test in scope, and when may I test it?',
18});
19
20const toolCalls = steps.flatMap((step) => step.toolCalls);
21console.log(toolCalls.length, text);

Tool use depends on the base model having learned it. When every route of a build accepts tool calls, the catalog adds tools to its supported parameters; on 2026-11-17 that is true of 41 listed builds. The agent tools page lists each of them. None of the builds on this page publishes that field on 2026-11-17, so take an id from that list for agent work and use these for plain answers.

nemotron-3-ultra-550b-a55b-uncensored
takes tool calls
Nemotron 3 Ultra 550B Uncensored
abliterated-model-large-flash
takes tool calls
Abliterated Large Flash
abliterated-model-large
takes tool calls
Abliterated Model Large
abliterated-model-large-v2
takes tool calls
Abliterated Model Large V2

Separate from your own tools, the gateway offers built-in ones: web search and fetch, a remote MCP server, a code sandbox. You declare them in the request’s tools array and they run within that single request; the agent tools page covers them.

Cost per call

Take a call of 2,000 input tokens and 400 output tokens, about what a system prompt plus a short exchange comes to. At the catalog prices of 2026-11-17, the four builds cost:

ModelOne call1,000 calls
GLM-5.3 Uncensored$0.0009$0.90
GLM-5.3 Abliterated$0.0061$6.11
DeepSeek V4.1 Flash Abliterated$0.0024$2.38
GLM-5.3 Flash Uncensored$0.00036$0.36

To reconcile an invoice, take usage.inputTokens and usage.outputTokens from each result and multiply by the per-million rates in this table.

Uncensored models and their prices per million tokens
GLM-5.3 Uncensoredglm-5.3-uncensoredUncensored$0.282$0.846
GLM-5.3 Abliteratedglm-5.3-abliteratedAbliterated$2.1825$4.365
DeepSeek V4.1 Flash Abliterateddeepseek-v4.1-flash-abliteratedAbliterated$0.8488$1.6975
GLM-5.3 Flash Uncensoredglm-5.3-flash-uncensoredUncensored$0.1053$0.3685

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

Prove the key works

Listing models costs nothing and confirms both the key and the URL. The ids that come back are the ones this key may call.

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

Each response carries a request id header, and a non-streamed response also carries its charge in USD. Both show on the usage page of the console; the rest of the API is on the docs page.

When it fails

  • 401 invalid_api_key: a wrong or revoked key, or the provider reading a variable you never set. Recopy the key and check the variable name.
  • 402 insufficient_balance: not enough credit for this request; add some in the console. 402 monthly_limit_reached: the monthly cap you put on the key is used up.
  • 403 scope_denied: the key was restricted to a set of models that does not include this one.
  • 404 model_not_found: whatever you passed to uncensored(‘…’) is not an id on the models page. Ids are not display names; 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

Chat Completions, and every listed build answers it. The builds on this page also list /v1/responses in the catalog, so @ai-sdk/openai works as well: its default openai(id) takes the Responses route, and openai.chat(id) stays on Chat Completions.

It works through openai.chat(id). The compatible provider fits a third-party endpoint better: Chat Completions is its default, includeUsage adds counts to streams, and providerOptions carries any extra request field. See the OpenAI SDK guide.

Same values. OpenCode accepts a custom OpenAI-compatible provider in its config, with this base URL, your key and the model ids unchanged. See the OpenCode guide.

streamText inside the POST handler, then return result.toTextStreamResponse() for text or result.toUIMessageStreamResponse() for a useChat client. The route snippet above is complete.

Every model above is on the uncensored model list with its live price per million tokens. Per-token pricing sets the whole catalog side by side, and the family directory groups the builds by base model.

Get a keyPrepaid 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.

Help