Skip to main content

Installation

Install the Voyage AI Provider package to use Voyage AI models with the Vercel AI SDK.

Install the packages

You need both the Voyage AI Provider and the Vercel AI SDK:
npm install voyage-ai-provider ai
The ai package provides the core Vercel AI SDK functions like embed(), embedMany(), and rerank() that work with the Voyage AI Provider.

Get your API key

You need a Voyage AI API key to use the provider:
  1. Sign up at Voyage AI
  2. Navigate to your dashboard to create an API key
  3. Copy your API key for the next step

Configure your environment

Add your API key to your environment variables:
VOYAGE_API_KEY=your-api-key
Keep your API key secure and never commit it to version control. Use environment variables or a secrets management service.

Verify installation

Create a simple test file to verify your installation:
test.ts
import { voyage } from 'voyage-ai-provider';
import { embed } from 'ai';

const model = voyage.textEmbeddingModel('voyage-3-lite');

const { embedding } = await embed({
  model,
  value: 'Hello, Voyage AI!',
});

console.log('Embedding length:', embedding.length);
Run the test:
node test.ts
If you see the embedding length printed, you’re ready to use Voyage AI Provider!

Next steps

Quickstart

Generate your first embeddings

Text embeddings

Learn about text embedding models

Build docs developers (and LLMs) love