Skip to content

[Bug]: NewAPI model fetching fails when local proxy is required #4239

Description

@sanqixy-sudo

Module

Agent Detection & Connection

Platform

Windows

AionUi Version

2.2.2

Bug Description

AionUI fails to fetch the model list from an OpenAI-compatible/NewAPI endpoint, while the exact same endpoint and API key work normally in Codex, Cherry Studio, and curl when using my local proxy.

AionUI shows:

Backend POST /api/provider/fetch-models failed (502)
{"success":false,"error":"Upstream service unavailable.","code":"BAD_GATEWAY"}

The API endpoint itself is working correctly. The issue appears to be that AionUI's backend model-fetching request does not use or inherit my local/system proxy.

Base URL:
https://api.7cloudvps.com/v1

Local HTTP proxy:
http://127.0.0.1:7897

Steps to Reproduce

  1. Start a local HTTP proxy at 127.0.0.1:7897.
  2. Open AionUI on Windows.
  3. Go to Models and add a Custom/OpenAI-compatible provider.
  4. Set the API URL to https://api.7cloudvps.com/v1.
  5. Enter a valid API key.
  6. Try to fetch/search the model list.
  7. AionUI returns 502 BAD_GATEWAY and cannot load the models.

For comparison, direct curl access also fails:

curl.exe -4 -v --http1.1 "https://api.7cloudvps.com/v1/models" -H "Authorization: Bearer <API_KEY>"

Result:
Recv failure: Connection was reset
schannel: failed to receive handshake, SSL/TLS connection failed

But the same request works correctly through the local proxy:

curl.exe -x http://127.0.0.1:7897 -i "https://api.7cloudvps.com/v1/models" -H "Authorization: Bearer <API_KEY>"

Result:
HTTP/1.1 200 Connection established
HTTP/1.1 200 OK

The full model list is returned successfully.

The same NewAPI endpoint also works normally in Codex and Cherry Studio.

Expected Behavior

AionUI's backend model-fetching request should use or inherit the configured/system proxy.

When a proxy such as http://127.0.0.1:7897 is available, requests to /v1/models should go through that proxy, just like Codex, Cherry Studio, and curl.

Ideally, AionUI should support HTTP_PROXY / HTTPS_PROXY or provide a dedicated per-provider proxy option for OpenAI-compatible/NewAPI providers.

Actual Behavior

AionUI appears to connect directly to the upstream API when executing /api/provider/fetch-models.

Because direct access to this endpoint is reset during the TLS handshake on my network, AionUI returns:

502 BAD_GATEWAY
Upstream service unavailable

The same endpoint works immediately when accessed through my local HTTP proxy at 127.0.0.1:7897.

So the behavior appears to be:

AionUI backend fetch-models
→ direct connection
→ TLS connection reset
→ 502 BAD_GATEWAY

While:

Codex / Cherry Studio / curl
→ local proxy 127.0.0.1:7897
→ NewAPI
→ 200 OK

Additional Context

This does not appear to be a general NewAPI compatibility issue.

I have another NewAPI endpoint that AionUI can fetch models from normally.

The problematic endpoint returns the following models successfully when accessed through the proxy:

kimi-k2
kimi-k2-thinking
kimi-k2.5
kimi-k2.6
kimi-k2.7-code
kimi-k2.7-code-highspeed
kimi-k3

Please check whether the AionUI backend/AionCore process responsible for /api/provider/fetch-models correctly supports or inherits proxy settings.

A dedicated proxy configuration for OpenAI-compatible providers would also be very useful.

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions