Skip to content

feat(ai-proxy): add anonymous affinity cookie fallback#3574

Open
hongshi1 wants to merge 1 commit intohigress-group:mainfrom
hongshi1:codex/ai-proxy-anonymous-affinity
Open

feat(ai-proxy): add anonymous affinity cookie fallback#3574
hongshi1 wants to merge 1 commit intohigress-group:mainfrom
hongshi1:codex/ai-proxy-anonymous-affinity

Conversation

@hongshi1
Copy link
Copy Markdown

@hongshi1 hongshi1 commented Mar 9, 2026

Ⅰ. Describe what this PR did

Added anonymous affinity cookie fallback for stateful AI APIs in ai-proxy. When x-mse-consumer is absent, the first successful response returns a higress-ai-affinity cookie and subsequent requests use that cookie for stable token selection.

Ⅱ. Does this pull request fix one issue?

fixes #3473

Ⅲ. Why don't you add test cases (unit test/integration test)?

Added provider unit tests and TestConsumerAffinity regression coverage for anonymous cookie fallback.

Ⅳ. Describe how to verify it

Run go test ./provider/... and go test . -run TestConsumerAffinity -count=1 -timeout 60s under plugins/wasm-go/extensions/ai-proxy.

Ⅴ. Special notes for reviews

This change only affects stateful APIs with multiple apiTokens configured and keeps x-mse-consumer as the first-priority affinity key.

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


gexuancheng seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

同一个模型多个AI服务提供商如何hash路由 || How to hash route multiple AI service providers for the same model

2 participants