Run the EveryAPI gateway inside Vercel AI SDK
The Vercel AI SDK can use a custom OpenAI-compatible provider created with @ai-sdk/openai. Point that provider at EveryAPI, then test each SDK feature with the selected model because structured output, reasoning, and tools depend on model support.
One base URL line points Vercel AI SDK at EveryAPI
Default global Base URL / China-first Base URL: https://api.everyapi.ai/v1 / https://api-cn.everyapi.ai/v1
import { createOpenAI } from "@ai-sdk/openai"; export const everyapi = createOpenAI({ baseURL: "https://api.everyapi.ai/v1", apiKey: process.env.EVERYAPI_KEY, # set EVERYAPI_KEY=sk-everyapi-... in .env}); # Calls made with this provider instance use the EveryAPI endpointimport { generateText } from "ai"; const { text } = await generateText({ model: everyapi("claude-sonnet-5"), prompt: "Explain the relationship between React Server Components and the RSC payload",});From zero to your first call
- Install the SDK
npm i ai @ai-sdk/openai. EveryAPI needs no dedicated Vercel AI SDK provider — just reuse @ai-sdk/openai.
- Decide between createOpenAI and env
createOpenAI suits running multiple providers side by side (e.g. EveryAPI + OpenAI direct at once); env suits going purely through EveryAPI with only the openai helper in your code.
- Switch upstreams via the model name field
Pass a model ID from your EveryAPI account catalog to the custom provider instance. Availability and supported features vary by model.
- Test the SDK features you use
Start with text generation, then test streaming, structured output, reasoning, or tools separately for the chosen model. OpenAI-compatible transport does not guarantee identical capabilities across providers.
Vercel AI SDK × EveryAPI
Why not use @ai-sdk/anthropic / @ai-sdk/google?
Native provider packages expose provider-specific features. A custom @ai-sdk/openai instance offers one OpenAI-compatible integration path through EveryAPI; choose based on the features your application requires.