Skip to content

Jina ​

Jina's search stack for the retrieval half of RAG: embeddings plus reranking. Use it when the job is text in, vectors or orderings out, and text generation lives on another provider.

Capabilities ​

Embeddings 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' => [
            'jina' => [
                'className' => 'Crustum\Ai\Providers\JinaProvider',
                'key' => env('JINA_API_KEY'),
                'url' => env('JINA_URL', 'https://api.jina.ai/v1'),
                'models' => [
                    'embeddings' => [
                        'default' => env('JINA_EMBEDDINGS_MODEL', 'jina-embeddings-v4'),
                        'dimensions' => (int)env('JINA_EMBEDDINGS_DIMENSIONS', 2048),
                    ],
                    'reranking' => [
                        'default' => env('JINA_RERANKING_MODEL', 'jina-reranker-v3.5'),
                    ],
                ],
            ],
        ],
    ],
];
Config keyEnv varPurpose
className—Provider class. Keep the default unless subclassing.
key (apiKey also accepted)JINA_API_KEYKey from jina.ai. Required.
urlJINA_URLAPI base URL. Change only for proxies or gateways.
models.embeddings.defaultJINA_EMBEDDINGS_MODELEmbeddings model.
models.embeddings.dimensionsJINA_EMBEDDINGS_DIMENSIONSVector width. Must match the embeddings model.
models.reranking.defaultJINA_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.