Point Vercel AI SDK at Tium
You need the base URL https://api.tium.ai/v1 and an API key from your dashboard. Keys are shown once at creation.
1.Install the OpenAI-compatible provider
npm install @ai-sdk/openai-compatible ai. The first is the provider factory, the second is the SDK core that generateText and streamText come from.
tium.tsimport { createOpenAICompatible } from "@ai-sdk/openai-compatible"; import { generateText } from "ai"; export const tium = createOpenAICompatible({ name: "tium", baseURL: "https://api.tium.ai/v1", apiKey: process.env.TIUM_API_KEY, }); const { text } = await generateText({ model: tium("glm-5.3-flash"), prompt: "Say hello.", });2.Construct the provider once and export it
name is a local label used in error messages and telemetry; it is not sent to us and does not have to be tium. Export the provider so every call site shares one configured instance.
3.Pass a slug to it
tium("glm-5.3-flash") builds a model. Any slug from the catalog works in the same call, and streamText takes the same model as generateText.
Check that it worked
Run the file above. A successful call also returns usage, and every response carries its cost and your remaining balance in the X-Tium-* headers.
npx tsx tium.tsEvery response also carries its own cost and your remaining balance in the X-Tium-* headers. See the header reference.
What Vercel AI SDK gets wrong
Tool-specific behaviour that surprises people, and what to do about it.
There is deliberately no @tium package
Some providers ship a named package that wraps exactly the code above. We decided against publishing one: an npm scope is permanent, the AI SDK ships breaking majors, and a provider package that falls behind breaks builds rather than merely reading as out of date. You lose nothing by constructing it yourself, because a named package would be these same four lines with our name on the import.
baseURL keeps its /v1
The SDK appends the route to what you give it. This is the same version-segment rule as everywhere else on this site, and the same 404 if you drop it.
Keep the key server-side
process.env.TIUM_API_KEY belongs in a server route, an action, or a backend job. The AI SDK will happily run in a browser bundle, and a key shipped to a browser is a key you have given away.