ENATIV Logo
ENATIV
Back
© 2026 ENATIV
ProjectsServicesKnowledge hubContact
contact@enativ.pl
  1. Knowledge hub
  2. ›
  3. AI
  4. ›
  5. Vercel AI SDK

Vercel AI SDK

A TypeScript library for AI chats with streaming, tools and a swappable model provider.

AIUsing since 2024 · Featured project: ENATIV Portfolio

Category
AI
Using since
2024
Featured project
ENATIV Portfolio

In practice

I pick the AI SDK when an AI feature should live inside a TypeScript app and not tie it to one model provider. The chat on this site, ENATIV Portfolio, runs on it with streaming and tools, and Next.js serves the API route.

What is Vercel AI SDK?

The Vercel AI SDK is an open-source TypeScript toolkit for building apps on language models. Its Core layer gives one API for generating text, structured objects and tool calls, and its UI layer adds chat hooks such as useChat for React. That keeps answer streaming and tool calls inside a plain API route.

The same code runs against many model providers. OpenAI and Anthropic are among them, and others, OpenRouter for one, come as community providers. Swapping the model changes configuration, not the rest of the app. You write all of it in TypeScript.

License
Apache 2.0
Language
TypeScript

How I work with Vercel AI SDK

I start from what the feature has to do and which data it may touch, and only then pick a model. The provider is replaceable, the limits are not. First I settle what happens when the model gets it wrong, because a prompt cannot fix that.

  1. Streaming and validation

    The answer streams to the browser through streamText, and I validate the request and the conversation history on the server before anything reaches the model. That is how I built the chat route in ENATIV Portfolio. Only then does the answer reach the user piece by piece.

  2. Tools with limits

    The model gets tools, but I decide what they can do. The inquiry tool only drafts a message, sending needs the visitor to confirm it, and the server sets the recipient. Project citations read from the registry, not from the "memory" of the model.

  3. Caps and provider

    I keep the provider in one place and cap the number of steps and the answer length, so one request cannot grow into a chain of model calls. I treat the system prompt as guidance for the model, not as a safeguard. On top of that comes a fixed set of test questions that I run on every model change.

When it fits, and when it doesn't

The AI SDK fits when AI is a feature of an app, not a system of its own.

A good fit when

  • A chat or assistant in a Next.js app with streamed answers.
  • A feature that has to call tools: look up data, draft a message, read a record.
  • A project where the model provider may change during the life of the product.
  • A reply with a fixed shape, such as sorting a ticket into a closed list of categories.

Not a fit when

  • An app without TypeScript, since the SDK is written in it.
  • A single script that asks a model once: a plain HTTP request is enough.
  • A large processing pipeline in a team that already knows another tool.
  • A team where nobody will maintain the prompts and the response validation.

There I look at LangChain, and at OpenRouter for reaching many models through one account, which this site uses. When the assistant should answer from your own documents, that is a separate topic: RAG.

Frequently asked questions

The library is free under Apache 2.0 and does not tie you to Vercel hosting: it is a TypeScript package that runs on Node.js. You pay the model provider for usage, so the cost follows traffic and the chosen model, not the library itself.
The model and provider are a single argument of the call, so a switch is configuration, not new logic. The prompts and tools still need a check, because models call them differently. Before switching I run the same test questions on both models and compare the results.
I don't treat it as a choice for good. I take the AI SDK when I get a TypeScript app and want a thin layer over the model. I consider LangChain when the team already uses it or the project is a large processing pipeline.
In the chat on this site, ENATIV Portfolio, the history lives only in the browser memory and the server keeps no thread. In a client project, storing conversations is a separate decision, because it involves personal data and needs consent and a retention period.

On this page

  • In practice
  • What is Vercel AI SDK?
  • How I work with Vercel AI SDK
  • When it fits, and when it doesn't
  • Frequently asked questions

Related topics

  • Vercel AI SDK
  • Next.js
  • RAG
  • TypeScript
  • React

Related services

  • AI IntegrationCustom AI solutions, chatbots, and intelligent automation for your business.
  • Semantic Search & AI Q&ASearch that understands what users mean, with answers grounded in your own content, in a new app, an existing one or your CMS.
  • AI Customer SupportAI assistants for chat, email and helpdesk: suggested replies, ticket triage and a website chatbot that hands over to a human.
  • AI for BusinessRolling out Claude, ChatGPT Enterprise, Copilot or Gemini for your team, plus a knowledge assistant that respects user permissions.

Want to add AI to your app?

Tell me what the assistant should do and which data it can use. I will say whether a chat with a few tools is enough or the project needs more. The scope is described on the [[service:ai|AI integration]] page.

Describe your projectSee ENATIV Portfolio