Vercel AI SDK: createOpenAICompatible

@ai-sdk/openai-compatible uses the chat completions endpoint, which works for every model on 666 AI. Tested against our live API.

Replace YOUR-ENDPOINT with the endpoint shown on your API Key page after you sign up, and YOUR-KEY with your key. One key works for every model on 666 AI — Claude, GPT, Gemini, DeepSeek, Qwen and 200+ more.

Code

npm install ai @ai-sdk/openai-compatible

import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText, streamText, embed } from "ai";

const ai666 = createOpenAICompatible({
  name: "ai666",
  baseURL: "https://YOUR-ENDPOINT/v1",
  apiKey: process.env.YOUR_KEY,
  includeUsage: true,
});

const { text } = await generateText({
  model: ai666("anthropic/claude-sonnet-5.5"),
  prompt: "Say hi in 3 words.",
});
console.log(text);

const result = streamText({ model: ai666("google/gemini-3.5-flash"), prompt: "Count from 1 to 3." });
for await (const delta of result.textStream) process.stdout.write(delta);

const { embedding } = await embed({
  model: ai666.embeddingModel("openai/text-embedding-3-small"),
  value: "hello",
});
console.log(embedding.length);

Why not createOpenAI?

createOpenAI({ baseURL }) also works, but openai('id') calls the Responses API by default; for non-OpenAI models use .chat('id') or the compatible provider above.

FAQ

Edge / serverless?

Yes. Keep the key in a server-side environment variable.

Create a free accountAll modelsDeveloper guides