Skip to content

Instantly share code, notes, and snippets.

@GrayXu
Last active February 27, 2025 12:06
Show Gist options
  • Save GrayXu/f1b72353b4b0493d51d47f0f7498b67b to your computer and use it in GitHub Desktop.
Save GrayXu/f1b72353b4b0493d51d47f0f7498b67b to your computer and use it in GitHub Desktop.
OpenAI GPT API for Zotero-PDF-Translate

This gist is for zotero-pdf-translate.
Please ask your question at repo issues for faster responses
请在仓库issue进行提问以获得更快的回复


  1. Register an account on the OpenAI website.
  2. After successful registration, go to API keys and create an key, which looks like sk-XXXXXX.
  3. Fill in the url with the complete URL, such as https://api.openai.com/v1/chat/completions.
  4. For the model, enter a model name such as gpt-4o.
  5. When using the official OpenAI API, ensure your network environment allows direct connection to OpenAI .
  6. When using a 3-party OpenAI compatible API, follow the same format as above.

  1. OpenAI网站注册账号。
  2. 注册成功后,打开API keys,创建密钥(API Secret Key),如sk-XXXXXX
  3. 接口填写如https://api.openai.com/v1/chat/completions的完整调用URL。
  4. 模型填写如gpt-4o的模型名。
  5. 使用官方接口需要确保你的网络环境可以直连OpenAI。
  6. 使用第三方OpenAI兼容接口时,填写规范与上述对齐即可。
@MiaomiaoDai
Copy link

Screenshot 2024-12-02 at 21 24 37 Screenshot 2024-12-02 at 21 25 50

你好,请问我的zotera7,配置栏这里没有显示“状态”,报错如下,是什么原因呢

@Kingyum-Hou
Copy link

Screenshot 2024-12-02 at 21 24 37 Screenshot 2024-12-02 at 21 25 50
你好,请问我的zotera7,配置栏这里没有显示“状态”,报错如下,是什么原因呢
这个报告貌似指出你没有权限访问4o模型,你可以用其它模型试试,例如我用的是“gpt-4-turbo-preview“,更多模型可以看官网"https://platform.openai.com/docs/models"

@MiaomiaoDai
Copy link

你好,请问我的zotera7,配置栏这里没有显示“状态”,报错如下,是什么原因呢
这个报告貌似指出你没有权
限访问4o模型,你可以用其它模型试试,例如我用的是“gpt-4-turbo-preview“,更多模型可以看官网"https://platform.openai.com/docs/models"

Screenshot 2024-12-02 at 21 40 11

感谢您的回复!!我目前是国外ip,用的是自己的gpt账号,已经购买了付费版,感觉应该有权限访问4o模型?我尝试了您说的这个模型,出现了同样的报错。我看到其他朋友在配置项的最后一栏都有“status”,我的没有,并且报错中有“failed with status code 404”,有点奇怪。再次感谢!!

@GrayXu
Copy link
Author

GrayXu commented Dec 3, 2024

@MiaomiaoDai 购买付费版ChatGPT不等于你有OpenAI API权限。

@2402548258
Copy link

屏幕截图 2024-12-19 104244
不翻译也不报错是为什么

@cjyyx
Copy link

cjyyx commented Dec 20, 2024

@Amamiya23
Copy link

我也提供下使用最近很火的国产模型deepseek的api教程,因为它也是兼容chatgpt接口的,只需要把接口改为https://api.deepseek.com/v1/chat/completions,然后模型务必设置为deepseek-chat,即可成功调用
zotero_LepuZFXQIh
zotero_veeggh44dv

@ivy-kripac
Copy link

请问大家的prompt是怎么配置的呢 我重新配置了prompt之后就不能用了,现在想找原来默认的也找不回来了

@wangbob-0787
Copy link

prompt:As an academic expert with specialized knowledge in iron and steel making, please provide a proficient and precise translation from ${langFrom} to ${langTo}. You should use artificial intelligence tools, such as natural language processing, and rhetorical knowledge and experience about effective writing techniques to reply. Make the reply looks like a native speaker. Some specific terms such as name do not need to be translated. The text is as follows: ${sourceText} Please provide the translated result without any additional explanation and remove 。

@ivy-kripac
Copy link

prompt:As an academic expert with specialized knowledge in iron and steel making, please provide a proficient and precise translation from ${langFrom} to ${langTo}. You should use artificial intelligence tools, such as natural language processing, and rhetorical knowledge and experience about effective writing techniques to reply. Make the reply looks like a native speaker. Some specific terms such as name do not need to be translated. The text is as follows: ${sourceText} Please provide the translated result without any additional explanation and remove 。

谢谢你!

@bailynlove
Copy link

截屏2025-02-05 下午8 15 05 老师们,想配置ollama的本地api可行吗?现在是一直报错404 page not found,需要穿透工具吗?

@GrayXu
Copy link
Author

GrayXu commented Feb 5, 2025

@bailynlove 不用穿透,直接配置接口就行

@bailynlove
Copy link

@bailynlove 不用穿透,直接配置接口就行

感谢老师!接口配置为http://127.0.0.1:11434/v1/chat/completions成功翻译

@Ostrich0119
Copy link

Ostrich0119 commented Feb 17, 2025

请问我在模型那一栏中只可以选择3.5turbo,应该如何解决?
image

@curious-energy
Copy link

Screenshot 2024-12-02 at 21 24 37 Screenshot 2024-12-02 at 21 25 50
你好,请问我的zotera7,配置栏这里没有显示“状态”,报错如下,是什么原因呢

刚刚我配置gpt-3.5-turbo的时候,基本认为都填对的,然后一直报这个错误,实在没办法了我就重新填写了一次api-key, 可能复制不认真会导致粘贴错误,然后我先尝试了gpt-4o,这次突然可以运行了,再次改成gpt-3.5-turbo也正常使用。基于以上猜测,一是复制api-key要小心一些,纯文本复制,以防复制到一些隐形的特殊符号,还有可能是界面的保存按键不是每次都生效,多试几次,最后实在不行重启软件试试。

@Freeworld1103
Copy link

为什么我的chat GPT的客户端可以正常使用,可是在zotero里面配置好后就提示“余额不足”呢??
截屏2025-02-20 17 33 20
请大神指教

@zzz660
Copy link

zzz660 commented Feb 27, 2025

注意是HTTP POST,接口别选错了

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