Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法完全伪装地址导致无法访问Gemini API #977

Open
WeskerC opened this issue Mar 12, 2024 · 4 comments
Open

无法完全伪装地址导致无法访问Gemini API #977

WeskerC opened this issue Mar 12, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@WeskerC
Copy link

WeskerC commented Mar 12, 2024

Describe the bug
A clear and concise description of what the bug is.

  • 使用Hysteria2作为代理协议时会导致无法使用Gemini API,提示:
    ”FailedPrecondition: 400 User location is not supported for the API use.“

切换到VMESS协议或ss协议时使用正常
image

To Reproduce
Steps to reproduce the behavior.
Gemini

    1. 在python中import google.generativeai as genai
    1. 添加hysteria2代理环境后,运行以下代码:
GOOGLE_API_KEY='请输入你的API key'
genai.configure(api_key=GOOGLE_API_KEY)
genai.list_models()

Expected behavior
A clear and concise description of what you expected to happen.
使代理状态不被获取,能够正常伪装状态并访问API

Logs
Attach logs from the client/server when the error occurs.

Device and Operating System
What are you using it on.
Win11 Python 3.9
iOS 17.2.1

Additional context
Add any other context about the problem here.
非常感谢作者及支持者们的辛勤付出!!

@WeskerC WeskerC added the bug Something isn't working label Mar 12, 2024
@tobyxdd
Copy link
Collaborator

tobyxdd commented Mar 13, 2024

不是很理解 "无法完全伪装地址" 是什么意思。每条连接双方的地址是确定的,不存在 “我用一个地址,但又不完全用” 的说法。建议你先研究下你的连接是不是走了代理,走了正确的代理,以及这个提示是否只和 IP 有关

@WeskerC
Copy link
Author

WeskerC commented Mar 19, 2024

不是很理解 "无法完全伪装地址" 是什么意思。每条连接双方的地址是确定的,不存在 “我用一个地址,但又不完全用” 的说法。建议你先研究下你的连接是不是走了代理,走了正确的代理,以及这个提示是否只和 IP 有关

感谢回复。

确认已经走了代理,并且同一IP在使用vmess协议的时候没有问题。由于我安装了warp之后Hysteria也可以用了,技术知识有限,能否以上内容判断是什么原因?

之前是在分别通过ss/vmess使用chatgpt时出现问题,ss不可以但是vmess可以。

再次感谢~!

@ghost
Copy link

ghost commented Mar 27, 2024

你的VPS是否同時存在 ipv4和ipv6兩個IP?
如果是的話,訪問chatgpt這個問題的原因是伺服器ipv4的IP被拉入黑名單了,shadowsocks默認情形下會優先ipv4,但是vmess默認爲ipv6
gemini api無法訪問的原因其實並不是代理工具的問題,而是VPS的IP地址段落被Google認爲是在中國的原因,按照中國大陸的說法是「IP被谷歌送中了」

@ghost
Copy link

ghost commented Mar 27, 2024

只要相應的域名和IP沒有被設定爲直連的話,那就是經過代理轉發的,代理工具本身並不存在僞裝不徹底的問題。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants