Skip to content

[Enhancement]: Add configurable API URL for Cohere reranker (Azure AI support) #12328

@leondape

Description

@leondape

What features would you like to see added?

Add a configurable cohereApiUrl option for the Cohere reranker, similar to how the Jina reranker already supports a custom jinaApiUrl. This would allow users to use Azure AI-hosted Cohere reranker models (or any other Cohere-compatible endpoint) instead of being locked to the native https://api.cohere.com/v2/rerank URL.

More details

Currently, the CohereReranker class in @librechat/agents has the API URL hardcoded to https://api.cohere.com/v2/rerank:

const response = await axios.post<t.CohereRerankerResponse | undefined>(
  'https://api.cohere.com/v2/rerank',
  requestData,
  { headers: { ... } }
);

The JinaReranker already supports a configurable URL via apiUrl constructor parameter, JINA_API_URL env var, and jinaApiUrl in the web search config — but the Cohere reranker has no equivalent.

Azure AI hosts Cohere reranker models (e.g., Cohere-rerank-v3.5) as serverless API deployments with a different base URL format (e.g., https://<resource>.services.ai.azure.com/models/chat/completions), and they also use a different auth header format.

Proposed changes:

  1. @librechat/agents — Add an optional apiUrl parameter to the CohereReranker constructor (defaulting to https://api.cohere.com/v2/rerank), mirroring the JinaReranker pattern.
  2. packages/data-schemas — Add cohereApiUrl as an optional field (0) in webSearchAuth.rerankers.cohere.
  3. packages/data-provider — Add cohereApiUrl to the webSearchSchema and loadWebSearchConfig.
  4. Frontend (ApiKeyDialog) — Add a URL input field for the Cohere reranker option, similar to how Jina already has one.
  5. .env.example — Document COHERE_API_URL.

This would bring Cohere reranker configuration to parity with Jina and enable Azure AI (and other compatible) deployments.

Which components are impacted by your request?

Plugins, Endpoints, UI

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions