everyapi
Integration · JS / TypeScript LLM frameworkOpenAI-compatible · one key · live model catalog
Vercel

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.

01Setup code

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

src/ai.ts
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 endpoint
import { generateText } from "ai";
 
const { text } = await generateText({
model: everyapi("claude-sonnet-5"),
prompt: "Explain the relationship between React Server Components and the RSC payload",
});
02Steps

From zero to your first call

  1. Install the SDK

    npm i ai @ai-sdk/openai. EveryAPI needs no dedicated Vercel AI SDK provider — just reuse @ai-sdk/openai.

  2. 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.

  3. 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.

  4. 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.

03FAQ

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.