apisix icon indicating copy to clipboard operation
apisix copied to clipboard

Currently, all AI upstream services are simulated using this fake server method.

Open shreemaan-abhishek opened this issue 6 months ago • 1 comments

Currently, all AI upstream services are simulated using this fake server method. I'm worried that the difference between the fake server and the real LLM request here is too big.

Should we introduce a container specifically for LLM Fake Server?

Originally posted by @membphis in https://github.com/apache/apisix/pull/13307#discussion_r3201089261

shreemaan-abhishek avatar May 08 '26 01:05 shreemaan-abhishek

While investigating this issue, I ran a small deterministic probe on Apple arm64 against unchanged APISIX source at master 39b9e43. It exposed a concrete fixture-fidelity gap on the request side — the same side the quoted concern is about.

The existing t/plugin/ai-proxy-fixture.t baseline passes all 50 assertions. In a separate local probe against the unchanged fake server, GET /v1/messages with only X-AI-Fixture: anthropic/messages-basic.json returned 200 and the recorded response despite having no Anthropic auth headers or request body. As a control, the existing Bedrock Converse handler rejected the same invalid method with 400.

This shows that the fake server can accept an invalid provider request shape and still return a plausible fixture response. Response-focused fixture tests could therefore miss adapter regressions in the method or required fields.

To be clear about scope: this is a test-fidelity observation, not a security report. t/ and t/lib/ are out of the project's threat model per §4.2 and §4.3 point 10 of docs/en/latest/security-threat-model.md.

This evidence does not by itself justify a separate LLM fake-server container. The current server already enforces a detailed request contract for Bedrock, so provider-specific validation in the existing server appears to be the smallest change that closes the demonstrated gap.

A separate container may still be useful if the intended scope includes behavior that the current server cannot represent reliably, such as stateful interactions, provider SDK behavior, transport-level differences, or more realistic streaming. Is there a container-specific requirement beyond request-contract validation that should define the boundary of #13340?

dev404ai avatar Aug 11 '26 12:08 dev404ai