Skip to content

VoyageAI ​

A specialist provider for the retrieval half of RAG: embeddings plus reranking, nothing else. Use it when you already generate text elsewhere but want Voyage's vectors and reranker. Multimodal inputs work (image and video alongside text), but remote URL media and Base64 media cannot mix in one request.

Capabilities ​

Embeddings (text, image, video) and reranking.

Configuration ​

Configure via environment variables. config/ai.php only forwards them with env() — set the values in .env or the host environment, never hardcode keys in the config file.

php
// In config/ai.php
return [
    'Ai' => [
        'providers' => [
            'voyageai' => [
                'className' => 'Crustum\Ai\Providers\VoyageAiProvider',
                'key' => env('VOYAGE_AI_API_KEY'),
                'url' => env('VOYAGE_AI_URL', 'https://api.voyageai.com/v1'),
                'models' => [
                    'embeddings' => [
                        'default' => env('VOYAGE_AI_EMBEDDINGS_MODEL', 'voyage-4'),
                        'dimensions' => (int)env('VOYAGE_AI_EMBEDDINGS_DIMENSIONS', 1024),
                    ],
                    'reranking' => [
                        'default' => env('VOYAGE_AI_RERANKING_MODEL', 'rerank-3'),
                    ],
                ],
            ],
        ],
    ],
];
Config keyEnv varPurpose
className—Provider class. Keep the default unless subclassing.
key (apiKey also accepted)VOYAGE_AI_API_KEYKey from dash.voyageai.com. Required. Note the VOYAGE_AI_ prefix with underscore.
urlVOYAGE_AI_URLAPI base URL. Change only for proxies or gateways.
models.embeddings.defaultVOYAGE_AI_EMBEDDINGS_MODELEmbeddings model.
models.embeddings.dimensionsVOYAGE_AI_EMBEDDINGS_DIMENSIONSVector width of the embeddings model.
models.reranking.defaultVOYAGE_AI_RERANKING_MODELReranker used when no per-call model is given.
headers— (config only)Extra HTTP headers merged into every request. Add as a plain array if needed.

Per-call model: overrides the configured model for that call.

See also ​

Released under the MIT License.