
# Voyage AI Provider

[patelvivekdev/voyage-ai-provider](https://github.com/patelvivekdev/voyageai-ai-provider) is a community provider that uses [Voyage AI](https://www.voyageai.com) to provide Embedding support for the AI SDK.

## Setup

The Voyage provider is available in the `voyage-ai-provider` module. You can install it with

<Tabs items={['pnpm', 'npm', 'yarn']}>
  <Tab>
    <Snippet text="pnpm add voyage-ai-provider" dark />
  </Tab>
  <Tab>
    <Snippet text="npm install voyage-ai-provider" dark />
  </Tab>
  <Tab>
    <Snippet text="yarn add voyage-ai-provider" dark />
  </Tab>
</Tabs>

## Provider Instance

You can import the default provider instance `voyage ` from `voyage-ai-provider`:

```ts
import { voyage } from 'voyage-ai-provider';
```

If you need a customized setup, you can import `createVoyage` from `voyage-ai-provider` and create a provider instance with your settings:

```ts
import { createVoyage } from 'voyage-ai-provider';

const voyage = createVoyage({
  baseURL: 'https://api.voyageai.com/v1',
  apiKey: process.env.VOYAGE_API_KEY,
});
```

You can use the following optional settings to customize the Voyage provider instance:

- **baseURL** _string_

  The base URL of the voyage API

- **headers** _Record&lt;string,string&gt;_

  Custom headers to include in the requests.

## Embedding Models

You can create models that call the [Voyage embeddings API](https://docs.voyageai.com/reference/embeddings-api)
using the `.embedding()` factory method.

```ts
import { voyage } from 'voyage-ai-provider';

const embeddingModel = voyage.textEmbeddingModel('voyage-3');
```

You can find more models on the [Voyage Library](https://docs.voyageai.com/docs/embeddings) homepage.

### Model Capabilities

| Model                   | Default Dimensions             | Context Length |
| ----------------------- | ------------------------------ | -------------- |
| `voyage-3-large`        | 1024 (default), 256, 512, 2048 | 32,000         |
| `voyage-3`              | 1024                           | 32000          |
| `voyage-code-3`         | 1024 (default), 256, 512, 2048 | 32000          |
| `voyage-3-lite`         | 512                            | 32000          |
| `voyage-finance-2`      | 1024                           | 32000          |
| `voyage-multilingual-2` | 1024                           | 32000          |
| `voyage-law-2`          | 1024                           | 32000          |
| `voyage-code-2`         | 1024                           | 16000          |

<Note>
  The table above lists popular models. Please see the [Voyage
  docs](https://docs.voyageai.com/docs/embeddings) for a full list of available
  models.
</Note>

### Add settings to the model

The settings object should contain the settings you want to add to the model.

```ts
import { voyage } from 'voyage-ai-provider';

const embeddingModel = voyage.textEmbeddingModel('voyage-3', {
  inputType: 'document', // 'document' or 'query'
  truncation: false,
  outputDimension: 1024, // the new model voyage-code-3, voyage-3-large has 4 different output dimensions: 256, 512, 1024 (default), 2048
  outputDtype: 'float', // output data types - int8, uint8, binary, ubinary are supported by the new model voyage-code-3, voyage-3-large
});
```

Learn more about the [output data types.](https://docs.voyageai.com/docs/faq#what-is-quantization-and-output-data-types)


## Navigation

- [Writing a Custom Provider](/v4/providers/community-providers/custom-providers)
- [Qwen](/v4/providers/community-providers/qwen)
- [Ollama](/v4/providers/community-providers/ollama)
- [Chrome AI](/v4/providers/community-providers/chrome-ai)
- [FriendliAI](/v4/providers/community-providers/friendliai)
- [Portkey](/v4/providers/community-providers/portkey)
- [Cloudflare Workers AI](/v4/providers/community-providers/cloudflare-workers-ai)
- [Cloudflare AI Gateway](/v4/providers/community-providers/cloudflare-ai-gateway)
- [OpenRouter](/v4/providers/community-providers/openrouter)
- [Azure AI](/v4/providers/community-providers/azure-ai)
- [Crosshatch](/v4/providers/community-providers/crosshatch)
- [Requesty](/v4/providers/community-providers/requesty)
- [Mixedbread](/v4/providers/community-providers/mixedbread)
- [Voyage AI](/v4/providers/community-providers/voyage-ai)
- [Hyperbolic](/v4/providers/community-providers/hyperbolic)
- [Mem0](/v4/providers/community-providers/mem0)
- [Letta](/v4/providers/community-providers/letta)
- [LLamaCpp](/v4/providers/community-providers/llama-cpp)
- [Anthropic Vertex](/v4/providers/community-providers/anthropic-vertex-ai)
- [Spark](/v4/providers/community-providers/spark)
- [Inflection AI](/v4/providers/community-providers/inflection-ai)
- [LangDB](/v4/providers/community-providers/langdb)
- [Zhipu AI](/v4/providers/community-providers/zhipu)
- [SambaNova](/v4/providers/community-providers/sambanova)
- [Dify](/v4/providers/community-providers/dify)
- [Sarvam](/v4/providers/community-providers/sarvam)


[Full Sitemap](/sitemap.md)
