A single createOpenAICompatible call connects the AI SDK to every model in this catalog. Below: the provider, then generateText, streamText and tool() on an uncensored build, which builds accept tool calls, a Next.js route, the error codes, and the live price of one call.
What you need
- Node with pnpm or npm.
- A key from the console: it starts with
sk-unr-, shows once, and spends a prepaid balance opened from $10 by card, WeChat Pay or crypto. - A model id from the models page.
To see a build answer before installing anything, open /chat: the same models, in the browser, with free turns each day.
Install and set the key
ai is the SDK; @ai-sdk/openai-compatible is its provider for endpoints that answer in the OpenAI Chat Completions shape. zod is only for the tool example.
pnpm add ai @ai-sdk/openai-compatible zod# ornpm install ai @ai-sdk/openai-compatible zodKeep the key in an environment variable so it never appears in source.
export UNRESTRICTABLE_API_KEY="sk-unr-live-…"Build the provider
Hand createOpenAICompatible a name, our baseURL and the apiKey. Leave the URL ending at /v1; the SDK appends /chat/completions itself. Turn on includeUsage so streamed replies report token counts too; the cost section below relies on those numbers.
import { createOpenAICompatible } from '@ai-sdk/openai-compatible'; export const uncensored = createOpenAICompatible({ name: 'unrestrictable', baseURL: 'https://api.unrestrictable.ai/v1', apiKey: process.env.UNRESTRICTABLE_API_KEY, includeUsage: true, // token counts on streams as well});- name
- unrestrictablea label of your choosing; it is the provider key inside providerOptions
- baseURL
- https://api.unrestrictable.ai/v1stops at /v1, with no path after it
- apiKey
- process.env.UNRESTRICTABLE_API_KEYgoes out as Authorization: Bearer
- model
- uncensored('glm-5.3-uncensored')any id on the models page; provider.chatModel(id) does the same thing
The identical base URL and key serve every other client that talks this format, the OpenAI SDKs among them.
A first answer with generateText
Calling the provider with an id, provider('model-id'), gives you a chat model to pass as model. Back comes text, finishReason and a usage object whose inputTokens, outputTokens and totalTokens are what you were charged for.
import { generateText } from 'ai';import { uncensored } from './provider'; const { text, usage, finishReason } = await generateText({ model: uncensored('glm-5.3-uncensored'), prompt: 'Explain how a lock pick works, step by step.',}); console.log(text);console.log(usage.inputTokens, usage.outputTokens, usage.totalTokens, finishReason);Streaming with streamText
streamText returns immediately. Read textStream to get each piece as it is written; result.usage is a promise that settles when the stream closes.
import { streamText } from 'ai';import { uncensored } from './provider'; const result = streamText({ model: uncensored('glm-5.3-flash-uncensored'), prompt: "Write a villain's monologue.",}); for await (const piece of result.textStream) process.stdout.write(piece); const usage = await result.usage; // settles once the stream closes; requires includeUsage on the providerconsole.log(usage.inputTokens, usage.outputTokens);Inside a Next.js route handler, send back result.toTextStreamResponse() for raw text, or result.toUIMessageStreamResponse() when the client uses useChat.
// app/api/chat/route.tsimport { streamText } from 'ai';import { uncensored } from '@/lib/provider'; export async function POST(req: Request) { const { prompt } = (await req.json()) as { prompt: string }; const result = streamText({ model: uncensored('glm-5.3-uncensored'), prompt, }); return result.toTextStreamResponse();}Tools
A tool() bundles three things: a description, an inputSchema, and the execute function that runs. Setting stopWhen: isStepCount(5) allows the SDK to run the tool, feed the result back and continue, for at most five rounds. Every call and its result lands in steps.
import { generateText, isStepCount, tool } from 'ai';import { z } from 'zod';import { uncensored } from './provider'; const { text, steps } = await generateText({ model: uncensored('glm-5.3-uncensored'), tools: { weather: tool({ description: 'Get the weather in a location', inputSchema: z.object({ location: z.string().describe('The location to get the weather for'), }), execute: async ({ location }) => ({ location, temperature: 72 }), }), }, stopWhen: isStepCount(5), // run tools for at most 5 steps prompt: 'What is the weather in San Francisco?',}); const toolCalls = steps.flatMap((step) => step.toolCalls);console.log(toolCalls.length, text);Tool calls only work on a build whose base model learned them. The catalog lists tools under a build’s parameters only when each of its routes accepts tool calls; on 2026-11-16, 40 listed builds carry it, and the agent tools page lists each of them. None of the builds on this page publish that field on 2026-11-16; take a build from that list for tool work and use these for text.
- nemotron-3-ultra-550b-a55b-uncensored
- takes tool callsNemotron 3 Ultra 550B Uncensored
- abliterated-model-large-flash
- takes tool callsAbliterated Large Flash
- abliterated-model-large
- takes tool callsAbliterated Model Large
- abliterated-model-large-v2
- takes tool callsAbliterated Model Large V2
The gateway also has built-in tools (web search, page fetch, a remote MCP server, a code sandbox) that run inside the request when declared in its tools array; the agent tools page describes each.
The price of a call
Take a call of 2,000 input and 400 output tokens, roughly a system prompt plus a short exchange. On four builds, at the catalog prices of 2026-11-16:
| Model | One call | 1,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 check a bill, take usage.inputTokens and usage.outputTokens from each result and multiply them by the per-million prices in this table.
| GLM-5.3 Uncensored | Uncensored | $0.282 | $0.846 |
| GLM-5.3 Abliterated | Abliterated | $2.1825 | $4.365 |
| DeepSeek V4.1 Flash Abliterated | Abliterated | $0.8488 | $1.6975 |
| GLM-5.3 Flash Uncensored | Uncensored | $0.1053 | $0.3685 |
Confirm the setup
Listing the models costs nothing and confirms both the key and the base URL. The response holds exactly the ids this key may use.
curl https://api.unrestrictable.ai/v1/models -H "Authorization: Bearer sk-unr-live-…"Every reply carries a request id header; a non-streamed one also carries its charge in USD. The console’s usage page shows both, and the docs page covers the rest of the API.
When it fails
401 invalid_api_key: the key is mistyped or has been revoked. Copy a fresh one from the console and confirm the variable name the provider reads.402 insufficient_balance: not enough credit for this request; top up in the console.402 monthly_limit_reached: the key reached the monthly spend cap you gave it.403 scope_denied: the key is scoped to specific models, and this id is outside that scope.404 model_not_found: the id insideuncensored(‘…’)does not exist on the models page. Compare the spelling, and remember a display name is not an id.429 rate_limited: the key is over its rate limit. Aretry-afterheader says how long to wait.- Nothing is charged for a request that fails before the model starts answering.
Questions
Chat Completions, which every listed build answers. Since the catalog also lists /v1/responses on the builds here, the @ai-sdk/openai package reaches them as well: its default openai(id) goes through the Responses API, while openai.chat(id) stays on Chat Completions.
Either one works. The compatible provider was built for endpoints like ours: Chat Completions out of the box, includeUsage for streamed token counts, providerOptions for extra request fields. With @ai-sdk/openai, use its .chat() factory. See the OpenAI SDK guide.
Yes. OpenCode is built on the AI SDK, and its config accepts a custom provider that speaks the OpenAI format, so the base URL, the key and the model ids carry over unchanged. See the OpenCode guide.
In the POST handler, call streamText and return result.toTextStreamResponse() for plain text, or result.toUIMessageStreamResponse() if the page uses useChat. The route snippet above is complete as written.
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.