同样的配置 openai 和 claude 就没问题:
location /xai {
proxy_pass https://api.x.ai/;
proxy_ssl_server_name on;
proxy_set_header Host api.x.ai;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
请求:
https://chat.xxxxx.com/xai/v1/chat/completions
报错:
{
"code": "Some requested entity was not found",
"error": "No handler found on route. Please double check your URL and consult https://api.x.ai/docs for more information."
}
1
vincentWdp 3 天前
|
2
vacuitym OP @vincentWdp 不是的,proxy_pass https://api.x.ai/ 只有这个最后没加/才会把 xai 加进去
|
3
vincentWdp 3 天前
@vacuitym 抱歉, 我弄错了, 😨
|
4
vacuitym OP ![]() 已 fixed 。
原因是他转发到了 https://api.x.ai//v1/chat/completions ,v1 前面多了一个/,只需要修改为 location /xai/ 就可以解决了 |