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

Blocked by OpenAI #2

Closed
aleung opened this issue Nov 16, 2023 · 10 comments
Closed

Blocked by OpenAI #2

aleung opened this issue Nov 16, 2023 · 10 comments

Comments

@aleung
Copy link

aleung commented Nov 16, 2023

似乎是从今天起,这种cloudflare上的API proxy也被OpenAI block了。我尝试了一下,不送原始请求的header,依然不行。CF会自动添加 "cf-ipcountry": "CN" 这个 header。

网上找到有人遇到同样问题:
https://community.cloudflare.com/t/use-cloudflare-worker-to-reverse-proxy-openai-but-blocked/581714

@janlay
Copy link
Owner

janlay commented Nov 16, 2023

谢谢反馈。你有试过主动添加 cf-ipcountry: US 这样的 header 吗?

@janlay
Copy link
Owner

janlay commented Nov 16, 2023

I confirm that explicitly setting CF-IPCountry: US would be overwritten by Cloudflare. Finally this project comes to the end.

@wittefeng
Copy link

I confirm that explicitly setting CF-IPCountry: US would be overwrite. Finally it comes to the end.

添加了还是不行,你本地ip确认是cn的吗?

@janlay
Copy link
Owner

janlay commented Nov 16, 2023

I confirm that explicitly setting CF-IPCountry: US would be overwrite. Finally it comes to the end.

添加了还是不行,你本地ip确认是cn的吗?

嗯,添加了也无效,会被覆盖。我用本地直连测试是这样的。这个问题暂时无解了。

@Subdue0
Copy link

Subdue0 commented Nov 16, 2023

凉了凉了,昨天才用上,今天就没了。

@nivalxer
Copy link

看起来是cf目前会透传请求者IP所属地区,然后触发了openai的风控。小伙伴试了一下,在前面再套一个cdn可以解决,例如aws的cdn到cf的worker域名就行(必须得非CN地区的CDN节点)。

@jackie099
Copy link

看起来是cf目前会透传请求者IP所属地区,然后触发了openai的风控。小伙伴试了一下,在前面再套一个cdn可以解决,例如aws的cdn到cf的worker域名就行(必须得非CN地区的CDN节点)。

记得转发parameters和关闭cache

@aleung
Copy link
Author

aleung commented Nov 21, 2023

在后面用 Cloudflare AI Gateway 将 API 再代理一层就可以了。参考这个:flyisland/cf-openai-proxy#1

@yushiro
Copy link

yushiro commented Nov 21, 2023

在后面用 Cloudflare AI Gateway 将 API 再代理一层就可以了。参考这个:flyisland/cf-openai-proxy#1

感谢,套壳gateway成功访问api了,又复活了。

@janlay
Copy link
Owner

janlay commented Nov 23, 2023

 ~/Desktop % curl -fsSL cloudflare.com/cdn-cgi/trace | grep loc=
loc=CN
 ~/Desktop % echo $OPENAI_API_ENDPOINT
https://***.janlay.net
 ~/Desktop % openai hello
Hello! How can I assist you today?

测试确认已解封

@janlay janlay closed this as completed Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants