Skip to main content
Last Updated: September 17, 2026

Introduction

The Vercel AI SDK provides a shared interface for building AI-powered JavaScript and TypeScript applications. For AI SDK 7, use the published SaladCloud provider to connect to Salad AI Gateway. For self-hosted OpenAI-compatible servers, use @ai-sdk/openai-compatible instead.
This is a direct connection to SaladCloud using the AI SDK library, not a connection through the hosted Vercel AI Gateway. You do not need a Vercel account or Vercel API key.
The Vercel AI SDK works with SaladCloud in two ways:
  • Salad AI Gateway - no infrastructure to deploy or manage. Available in beta with pay-per-token billing. Connect to the shared endpoint using your organization-specific AI Gateway API key.
  • 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 in to the SaladCloud portal.
  2. Follow Pay-Per-Token Onboarding to add credits and create your organization’s AI Gateway API key.
This guide uses qwen3.6-35b-a3b.

Step 2: Install the Dependencies

In a new project directory, initialize an ES module project. If you already have a project, keep its existing configuration and adapt the examples to its module system.
Install the packages for your chosen backend:
Version 0.2.0 of the SaladCloud provider implements the AI SDK 7 provider interface. Do not use it with ai@6 or older.

Step 3: Configure the SaladCloud Provider

Create a .env file with your organization’s AI Gateway API key:
Create provider.js:
provider.js
The provider reads SALAD_CLOUD_API_KEY and defaults to https://ai.salad.cloud/v1. You do not need to supply a base URL or custom headers. A regular SaladCloud API key is not a substitute for an AI Gateway key.
Add .env and .env.local to your project’s .gitignore. Keep the key on the server: do not expose it in browser code or a NEXT_PUBLIC_ environment variable. In Next.js, run the provider inside a server-side route or action and store SALAD_CLOUD_API_KEY in .env.local or your hosting platform’s secret settings.

Step 4: Generate Text and Test the Connection

Create test.js. This example works with either provider.js above:
test.js
Run it with:
If you see a response, your setup is complete.

Streaming Chat Responses

Create stream.js to display text as it is generated:
stream.js

Troubleshooting

  • Unsupported model version: check npm ls ai @saladtechnologies-oss/ai-sdk-provider. Use ai@7 with SaladCloud provider 0.2.0.
  • Missing API key or HTTP 401: load .env with --env-file and use an organization-specific AI Gateway key in SALAD_CLOUD_API_KEY. For self-hosted deployments, check the separate Salad-Api-Key header configuration.
  • Unexpected endpoint: remove an old SALAD_CLOUD_BASE_URL override if you intend to use the shared AI Gateway.