Skip to content

Vercel AI SDK

Vercel AI SDK is a TypeScript library that gives your app a common way to call supported models and handle their replies.

Visit Vercel AI SDK

What do you install, and what runs the model?

You add the AI SDK to your TypeScript app. It gives the app shared functions for things like generating text or filling named fields. A supported model service still produces the response.

You can choose a direct provider connection or configure Vercel AI Gateway. Some examples use the gateway. Check which connection the example makes before using it.

Whose usage bill and limits apply?

The SDK repository is Apache 2.0 licensed. Model use still has separate costs and limits. With a direct connection, check the provider. With a gateway connection, check the gateway’s billing setup and whether any provider usage is billed separately.

With your own provider key in Vercel AI Gateway, the provider bills successful model usage, but a fallback after your key fails or a separately priced add-on can use Gateway credits. Record which account receives the charge and what the app should show when a request is paused. Keep keys on the server. Check what each connected service receives before sending real records.

What should you check when changing models?

Keep your app’s expected fields and example inputs. The SDK’s shared functions can reduce code changes, but providers do not all support the same options or produce the same answers.

Confirm that the new model supports the output you need. Check whether the reply matches the original facts, how you handle a missing field and what happens when the connection fails.

How can you compare two replies without calling a model?

Write a fictional workshop description and draw two pretend replies. Leave provider accounts, keys and real records out.

  1. Use the same fields
    Ask both imaginary replies for a title and one category from your list.
  2. Handle a partial result
    Give one reply a title and no category. The app should keep the original description and let a person fill the missing field.
  3. Check a connection change
    On paper, label which service would receive the request and which account would pay. Mark any change in supported options before assuming the switch works.