[Question] How to configure HTTP proxy for ai-proxy plugin to access external AI models? #13393
Replies: 2 comments
|
Unfortunately, the ai-proxy plugin currently does not support HTTP/HTTPS proxy configuration for its outbound requests. This is a confirmed limitation, not a misconfiguration on your side. Why your attempts didn't work:
Workarounds for your situation:
This is a known gap that has been discussed in the community [5]. If this feature is important for your use case, consider opening a feature request issue to add To reply, just mention @dosu. Docs are dead. Just use Dosu. |
|
The "not supported" part is right, but there is a way through, and it is worth knowing why the environment variables did nothing before reaching for it. APISIX makes these outbound calls with a cosocket HTTP client, and cosockets do not go through the OS networking layer, so they never read What ai-proxy does have is I checked that this actually redirects the outbound call rather than assuming it. On a standalone APISIX with a route like: plugins:
ai-proxy:
provider: openai-compatible
auth:
header:
Authorization: "Bearer sk-..."
options:
model: qwen-test
override:
endpoint: "http://relay:8080/v1/chat/completions"the request left APISIX to that address instead of the provider, and the receiving side logged So the shape that works for DashScope behind an HTTP proxy is a small relay next to APISIX, an nginx or similar with Note the endpoint accepts either scheme plus host, in which case the plugin computes the provider path itself, or a full URL with path and query, which it then uses as given. If your relay expects the provider's own path, the first form keeps the config shorter. |
Uh oh!
There was an error while loading. Please reload this page.
Environment:
APISIX version: 3.14
Deployment method: Running from source code (started via make run, not Docker)
OS: Linux
Plugin: ai-proxy with provider: openai-compatible
Problem Description
I'm using APISIX's ai-proxy plugin to proxy requests to Alibaba Cloud DashScope (an external AI service at https://dashscope.aliyuncs.com). However, my environment can only access the internet via an HTTP proxy.
Other routes that don't require the proxy (pointing to internal IPs like 10.x.x.x or 172.x.x.x) work fine. But when I try to access the DashScope route via ai-proxy, I get a 500 Internal Server Error.
What I've Tried
I attempted to configure the proxy by adding environment variables in conf/config.yaml like this:
But this configuration doesn't seem to take effect. After restarting APISIX by apisix reload, requests to the external AI endpoint still fail with 500, and there's no evidence that the proxy is being used.
My Route Configuration:
Questions
Additional Context
• Other internal routes (without proxy) work correctly, so APISIX core is functioning.
• I can confirm that the proxy server itself is working (e.g., curl -x my-proxy:port https://dashscope.aliyuncs.com succeeds from the same machine).
Any guidance would be greatly appreciated. Thanks!
All reactions