Skip to main content
The VoyageProviderSettings interface defines the configuration options you can pass when creating a Voyage AI provider instance using createVoyage().

Properties

baseURL
string
Use a different URL prefix for API calls, e.g. to use proxy servers.Default: https://api.voyageai.com/v1See Voyage AI API Reference
apiKey
string
API key that is sent using the Authorization header.Default: Value from the VOYAGE_API_KEY environment variable
headers
Record<string, string>
Custom headers to include in the requests.
fetch
FetchFunction
Custom fetch implementation. You can use it as a middleware to intercept requests, or to provide a custom fetch implementation for testing.

Usage

import { createVoyage } from '@voyageai/ai-provider';

const voyage = createVoyage({
  apiKey: 'your-api-key',
  baseURL: 'https://custom-proxy.example.com/v1',
  headers: {
    'Custom-Header': 'value',
  },
});

Using a custom fetch function

import { createVoyage } from '@voyageai/ai-provider';

const voyage = createVoyage({
  fetch: async (url, init) => {
    console.log('Making request to:', url);
    const response = await fetch(url, init);
    console.log('Response status:', response.status);
    return response;
  },
});

Using environment variables

import { createVoyage } from '@voyageai/ai-provider';

// Automatically uses VOYAGE_API_KEY from environment
const voyage = createVoyage();

Build docs developers (and LLMs) love