Vercel AI SDK
MarkdownSDK · OpenAI Chat, OpenAI Responses, Anthropic Messages, Gemini
Full guide
| Format | Where to set it up |
|---|---|
| OpenAI Chat, OpenAI Responses, Anthropic Messages, Gemini | Providers: createOpenAICompatible({ name, baseURL, apiKey }) from @ai-sdk/openai-compatible; createAnthropic({ baseURL, apiKey }) from @ai-sdk/anthropic; createGoogleGenerativeAI({ baseURL, apiKey }) from @ai-sdk/google; createOpenAI({ baseURL }) or OPENAI_BASE_URL |
Setup
Copy the configuration and replace sk-... with your key from the Ailoot Dashboard. Prefer storing the key in the environment variable AILOOT_API_KEY, if the application supports it.
Before starting, request GET /v1/models with your Ailoot key. Choose an exact model ID whose methods include POST /v1/chat/completions, POST /v1/responses, POST /v1/messages, POST /v1beta/models/{model}:generateContent, then use that ID in the configuration. For agents, also check tool support and the features required by your client version.
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { createAnthropic } from "@ai-sdk/anthropic";
import { createGoogleGenerativeAI } from "@ai-sdk/google";
import { generateText } from "ai";
const ailoot = createOpenAICompatible({ name: "ailoot", baseURL: "https://api.ailoot.ai/v1", apiKey: process.env.AILOOT_API_KEY });
const claude = createAnthropic({ baseURL: "https://api.ailoot.ai/v1", apiKey: process.env.AILOOT_API_KEY });
const gemini = createGoogleGenerativeAI({ baseURL: "https://api.ailoot.ai/v1beta", apiKey: process.env.AILOOT_API_KEY });
const { text } = await generateText({ model: ailoot("deepseek-v4-pro"), prompt: "Hello" });
// claude("claude-sonnet-5-5"), gemini("gemini-3.6-flash")This configuration reads the key from the environment variable AILOOT_API_KEY. Set it before starting the application:
export AILOOT_API_KEY="sk-..." # add to ~/.zshrc or ~/.bashrcsetx AILOOT_API_KEY "sk-..." # then restart the terminalExample model: deepseek-v4-pro (OpenAI-compatible), claude-sonnet-5-5 (Anthropic), gemini-3.6-flash (Gemini). Choose any other model from the catalog — check that it supports the format you need.
Good to know
Test
- For the OpenAI format, the URL is
https://api.ailoot.ai/v1(or the full path if the application asks for a full URL). - For the Anthropic format, the URL is
https://api.ailoot.aiwith the path/v1. - For the Gemini format, the URL is
https://api.ailoot.aiwith the path/v1beta. - Ask a short question. If you get an error, check the code and Request ID, then consult Errors and limits.
- 404 immediately after setup almost always means the URL is wrong: an extra or missing
/v1. - 402 — insufficient balance for the reserve. Agents reserve more than chat: why.
Application documentation: https://ai-sdk.dev/providers/openai-compatible-providers