ai-proxy: baidu provider does not recognize /v2/embeddings under protocol: original (request skipped as unsupported path)
Summary
With protocol: original, requests to the baidu provider's embeddings endpoint (/v2/embeddings) are misclassified: baiduProvider.GetApiName() only recognizes the chat-completions 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(currentmain, 2026-09-28) - Plugin:
ai-proxy(wasm-go), providerbaidu
Configuration
apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
name: ai-proxy-baidu-original
spec:
defaultConfig:
provider:
apiTokens:
- "<bce-api-key>"
protocol: original
type: baidu
url: file:///opt/plugins/wasm-go/extensions/ai-proxy/plugin.wasmSteps to reproduce
- Install Higress with the ai-proxy plugin using the config above, routed to the baidu backend.
- Send a baidu embeddings request through the gateway (using the plugin's own embeddings path):
curl -X POST http://<gateway>/v2/embeddings \
-H "Content-Type: application/json" \
-d '{"model":"embedding-v1","input":["hello"],"user_id":"u1"}'Expected behavior
GetApiName("/v2/embeddings") returns ApiNameEmbeddings — the capability that baiduProviderInitializer.DefaultCapabilities() itself declares — and the request/response bodies are processed accordingly (model mapping applied to the request body, response processed with the correct apiName).
Actual behavior
baiduProvider.GetApiName() (plugins/wasm-go/extensions/ai-proxy/provider/baidu.go:73) only matches baiduChatCompletionPath (/v2/chat/completions) and returns "" for /v2/embeddings. 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 (no model mapping, no per-API handling of the embeddings request/response),- a warning is logged:
unsupported path: /v2/embeddings, will not process http path and body.
Why this is a defect rather than an unsupported case
baiduProviderInitializer.DefaultCapabilities() (baidu.go:30-34) declares:
string(ApiNameEmbeddings): baiduEmbeddings, // "/v2/embeddings"so the provider advertises an embeddings capability that its own path resolver can never detect — GetApiName can never return ApiNameEmbeddings.
Notes
- The behavior above is a deterministic trace of the production request path (
onHttpRequestHeader) on the citedmaincommit; happy to attach a runtime-confirmed conformance case against llm-mock-server if that is preferred. - Proposed fix: #4219
Source: higress-group/higress