一、介绍
- 最近开发OpenAi的Rest Api遇到API文档打不开的情况,于是在网上找了一个代理通道,分享给大家使用。
二、代理使用方法
- 代理地址:https://api.openai-proxy.com,支持OpenAI官方所有接口。本服务只做代理中转,不会保存任何数据。
- 直接将官方接口域名 api.openai.com 替换为 api.openai-proxy.com 即可在国内网络环境下直接调用,支持SSE。
三、操作代码
curl "https://api.vveai.com/v1/models" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY"
curl "https://api.openai.com/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Write a haiku that explains the concept of recursion."
}
]
}'
- 如果放在Apipost中运行的话,将两个 -H 放在Header里面即可,消息内容 -d 放在raw里面即可。