#4839·higress

ai-proxy: cohere provider does not recognize /v1/rerank under protocol: original (request skipped as unsupported path)

Author: 123123213weqwCreated Sep 29, 2026Updated Sep 29, 2026

Summary

With protocol: original, requests to the cohere provider's rerank endpoint (/v1/rerank) are misclassified: cohereProvider.GetApiName() only recognizes the chat path and returns an empty ApiName, so the plugin treats the request as an unsupported path and skips all request/response body processing.

Environment

  • Higress commit: b44d4f77011ad7f63c2fefef5b8cd2dec0cff1c6 (current main, 2026-09-28)
  • Plugin: ai-proxy (wasm-go), provider cohere

Configuration

yaml
apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
  name: ai-proxy-cohere-original
spec:
  defaultConfig:
    provider:
      apiTokens:
        - "<cohere-api-key>"
      protocol: original
      type: cohere
  url: file:///opt/plugins/wasm-go/extensions/ai-proxy/plugin.wasm

Steps to reproduce

  1. Install Higress with the ai-proxy plugin using the config above, routed to api.cohere.com.
  2. Send a cohere v1 rerank request through the gateway:
bash
curl -X POST http://<gateway>/v1/rerank \
  -H "Content-Type: application/json" \
  -d '{"model":"rerank-v3.5","query":"hello","documents":["hi","bye"],"top_n":2}'

Expected behavior

GetApiName("/v1/rerank") returns ApiNameCohereV1Rerank — the capability that cohereProviderInitializer.DefaultCapabilities() itself declares — and the request/response bodies are processed accordingly.

Actual behavior

cohereProvider.GetApiName() (plugins/wasm-go/extensions/ai-proxy/provider/cohere.go:120) only matches cohereChatCompletionPath (/v1/chat) and returns "" for /v1/rerank. Under protocol: original the provider-specific GetApiName is the resolver (plugins/wasm-go/extensions/ai-proxy/main.go:243-249), so apiName ends up empty and onHttpRequestHeader takes the unsupported-path branch (main.go:274-278):

  • DontReadRequestBody() / DontReadResponseBody() are called — no body processing happens at all,
  • a warning is logged: unsupported path: /v1/rerank, will not process http path and body.

Why this is a defect rather than an unsupported case

cohereProviderInitializer.DefaultCapabilities() declares:

go
string(ApiNameCohereV1Rerank): cohereRerankPath, // "/v1/rerank"

so the provider advertises a rerank capability that its own path resolver can never detect — GetApiName can never return ApiNameCohereV1Rerank.

Notes

  • The behavior above is a deterministic trace of the production request path (onHttpRequestHeader) on the cited main commit; happy to attach a runtime-confirmed conformance case against llm-mock-server if that is preferred.
  • Proposed fix: #4218