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

使用咨询 #6

Closed
nimrod1990 opened this issue May 16, 2023 · 7 comments
Closed

使用咨询 #6

nimrod1990 opened this issue May 16, 2023 · 7 comments

Comments

@nimrod1990
Copy link

我想在 gpt-academic 项目中使用你的 key,请教一下怎么设置 API 转发?

@chatanywhere
Copy link
Owner

gpt-academic应该也是用的openai官方库,参照教程改环境变量即可

@nimrod1990
Copy link
Author

nimrod1990 commented May 16, 2023

我在 huggingface 中部署,是不是修改 config.py中的以下内容即可?

重新URL重新定向,实现更换API_URL的作用(常规情况下,不要修改!!)

  | # (高危设置!通过修改此设置,您将把您的API-KEY和对话隐私完全暴露给您设定的中间人!)
  | # 格式 {"https://api.openai.com/v1/chat/completions": "在这里填写重定向的api.openai.com的URL"}
  | # 例如 API_URL_REDIRECT = {"https://api.openai.com/v1/chat/completions": "https://ai.open.com/api/conversation"}
  | API_URL_REDIRECT = {"https://api.chatanywhere.cn/v1/chat/completions": "https://api.chatanywhere.cn"}
 我试了一下还是不行,还需要修改什么吗?我是小白……搞不太明白。

@chatanywhere
Copy link
Owner

API_URL_REDIRECT = {"https://api.openai.com/v1/chat/completions": "https://api.chatanywhere.cn/v1/chat/completions"}

应该是这样吧

@nimrod1990
Copy link
Author

谢谢你的帮助~

@nimrod1990
Copy link
Author

可否添加对开源项目ChatPaper的支持?
需要如何在源码中修改反向代理?

@loukai99
Copy link

简单看了一下 他应该用的也是官方openai库 参照教程改环境变量即可

@nimrod1990
Copy link
Author

Set OPENAI_API_BASE environment variable

os.environ["OPENAI_API_BASE"] = "https://api.chatanywhere.cn/v1"

简单看了一下 他应该用的也是官方openai库 参照教程改环境变量即可

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

3 participants