6 views
-/https://github.com/berriai/litellm/issues/31167
GitHub · issue

#31167 [Bug]: Cohere rerank v2 duplicates endpoint path for versioned api_base

  • State: open
  • Author: @VectorPeak
  • Labels: bug, SDK

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

When using Cohere rerank v2 with a custom `api_base` that already ends in `/v2`, LiteLLM appends `/v2/rerank` again and builds an invalid duplicated endpoint path.

For example, `api_base="https://api.cohere.ai/v2"` currently resolves to:

```text https://api.cohere.ai/v2/v2/rerank ```

Expected behavior: versioned Cohere v2 API roots should resolve to the v2 rerank endpoint without duplicating the version path:

```text https://api.cohere.ai/v2/rerank ```

I would like to work on this issue. A draft fix is open in #31162.

### Steps to Reproduce

1. Use Cohere rerank v2 with a custom `api_base` ending in `/v2`. 2. Build the complete URL through `CohereRerankV2Config.get_complete_url`. 3. Observe that `/v2/rerank` is appended to a base that already includes `/v2`.

Example:

```python from litellm.llms.cohere.rerank_v2.transformation import CohereRerankV2Config

config = CohereRerankV2Config() url = config.get_complete_url( api_base="https://api.cohere.ai/v2", model="rerank-v3.5", )

print(url) # Current behavior: https://api.cohere.ai/…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (2 events)
#0 of 0 · 31d18h29m13s ago — entered · #import:https:::github.com:berriai:litellm post #2390
A2A streaming handling has broader transport, protocol, compatibility, and regression-testing risks, while the rerank change is a localized URL-normalization fix with focused tests.
#0 of 0 · 31d18h13m2s ago — current · #import:https:::github.com:berriai:litellm post #2640
Dependency remediation spans package constraints, transitive compatibility, build artifacts, and security validation, whereas the other change is a localized endpoint-construction correction with an existing draft fix.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search