Skip to content
Updates & support on Telegram

@ai-sdk/openai createOpenAI

Native OpenAI-compatible support

Vercel AI SDK with a custom OpenAI-compatible provider

The AI SDK ships an OpenAI-compatible provider factory. Pass the base URL and key once, then every generateText and streamText call targets this catalog.

Base URL

https://uncensoredai.dev/v1

  1. 01

    Create the provider

    createOpenAI accepts baseURL and apiKey and returns a provider you can call with any catalog id.

    typescript
    import { createOpenAI } from "@ai-sdk/openai";
    
    const gateway = createOpenAI({
      baseURL: "https://uncensoredai.dev/v1",
      apiKey: process.env.UNCENSOREDAI_API_KEY,
    });
    
    const model = gateway("deepseek-v4.1-flash");
  2. 02

    Stream a response

    streamText works unchanged; the usage object is available in the final result.

    streaming
    import { streamText } from "ai";
    
    const result = streamText({
      model,
      prompt: "Summarise SSE in one sentence.",
    });

Commands and configuration below are shown exactly as the tool expects them, so they stay in English.

FAQ

Do tool calls work?+

Yes on models that accept the tools array. Bind tools per request as usual.

Can I mix models per request?+

Yes. Call gateway(id) with a different id for each request.

More integrations

Vercel AI SDK Custom Provider — Streaming Setup · UncensoredAI