Integrations / Vercel AI SDK
V

Vercel AI SDK

Vercel · Verified setup guide

TypeScript toolkit for building AI features. One factory for any OpenAI-compatible endpoint.

Setup steps

  1. 1
    Installnpm i ai @ai-sdk/openai-compatible
  2. 2
    Create the providercreateOpenAICompatible with baseURL and apiKey below.
  3. 3
    Call a modelgenerateText with any /models id.

Configuration example

javascript
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";

const luxechain = createOpenAICompatible({
  name: "luxechain",
  baseURL: "https://api.luxechain.si/v1",
  apiKey: "lxc_live_YOUR_KEY",
});

const { text } = await generateText({
  model: luxechain("YOUR_MODEL_ID"),      // any model id from the /models page
  prompt: "Hello",
});
console.log(text);

Replace YOUR_MODEL_ID with any model from the catalogue. Never paste a real API key into a shared document.

Troubleshooting

createOpenAICompatible is the provider for endpoints that are not OpenAI itself; it speaks the chat-completions API.

If the tool rejects the endpoint, confirm the base URL exactly matches the value on the right, and that the key is active in your account.