Skip to main content
Last Updated: May 18, 2026

Introduction

The Vercel AI SDK is a popular framework for building AI-powered applications in JavaScript and TypeScript. It provides a unified interface for text generation, streaming, structured output, and tool calling - and includes an @ai-sdk/openai-compatible package for connecting to any OpenAI-compatible endpoint, including SaladCloud. The Vercel AI SDK works with SaladCloud in two ways:
  • Salad AI Gateway - no infrastructure to deploy or manage. Sign up for access, point your app at a single shared endpoint, and use your Salad API key directly. Currently in closed beta with monthly flat-rate access.
  • Self-hosted model - deploy your own SaladCloud container group for full control over the model, hardware, and configuration. Still very easy to set up and use.

Prerequisites

Before getting started, make sure you have:

Step-by-Step Setup

Step 1: Choose Your Backend

Salad AI Gateway is the fastest way to get started - no container groups to deploy, no cold starts to wait for.
  1. Sign up for early access at salad.com/ai-gateway.
  2. Once approved, find your Salad API key in the portal.
Available models:

Step 2: Install the Dependencies

In your project directory, install the Vercel AI SDK and the OpenAI-compatible provider:
The Vercel AI SDK uses ES modules. Make sure your package.json has "type": "module" set:
To use environment variables for your API key and endpoint, also install dotenv:

Step 3: Configure the SaladCloud Provider

Store your credentials in a .env file:
Create a provider instance pointing to the AI Gateway endpoint:
No custom headers are needed - your Salad API key in apiKey is all that’s required.

Step 4: Generate Text and Test the Connection

Use generateText to test that your setup works:
Run it with:
If you see a response, your setup is complete.

Streaming Chat Responses

Use streamText for chat interfaces that display responses as they are generated: