@ai-sdk/openai createOpenAI
Native OpenAI-compatible supportVercel 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
- 01
Create the provider
createOpenAI accepts baseURL and apiKey and returns a provider you can call with any catalog id.
typescriptimport { 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"); - 02
Stream a response
streamText works unchanged; the usage object is available in the final result.
streamingimport { 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.
