bincooo / chatgpt-adapter

集成了openai-api、bing、gemini、coze、claude、绘画 多款AI的聊天接口适配到 OpenAI API 标准接口服务端。
GNU General Public License v3.0
473 stars 88 forks source link

Claude 报错 #50

Open ssfun opened 4 days ago

ssfun commented 4 days ago
------ START REQUEST 18e0ee76-a7ff-4932-a52e-31c9b0b927f1 ---------
POST /v1/chat/completions HTTP/1.1
Host: XXXX.hf.space
Accept: */*
Accept-Encoding: gzip
Authorization: sk-ant-XXXXX
Content-Length: 170
Content-Type: application/json
User-Agent: curl/8.7.1
X-Amzn-Trace-Id: Root=1-667cc816-4aa24ea2483cd75d0144b3d6
X-Direct-Url: https://XXXX.hf.space/--replicas/4dk3k/api/v1/chat/completions
X-Forwarded-For: 10.16.12.234
X-Forwarded-Host: XXXX.hf.space
X-Forwarded-Port: 443
X-Forwarded-Proto: http
X-Request-Id: 0lFVG5
X-Request-Id: 0lFVG5

2024-06-27 02:01:58 <internal/plugin/llm> claude/adapter.go:126 | [INFO] curr model: claude-3-5-sonnet-20240620
2024-06-27 02:02:00 <internal/plugin/llm> claude/adapter.go:126 | [ERRO] [retry] fetch organization failed: <Status: 403> Forbidden
2024-06-27 02:02:00 <internal/plugin/llm> claude/adapter.go:128 | [ERRO] fetch organization failed: <Status: 403> Forbidden
2024-06-27 02:02:00 <internal> gin.handler/basic.go:98 | [INFO] 
------ END REQUEST 18e0ee76-a7ff-4932-a52e-31c9b0b927f1 ---------
[GIN] 2024/06/27 - 02:02:00 | 500 |  2.070433164s |    10.16.12.234 | POST     "/v1/chat/completions"

请问可以怎么修复?

bincooo commented 4 days ago

更新本项目试试?

bincooo commented 4 days ago

大概在30分钟前,我提交针对这个错误的处理,也许能解决你的问题

ssfun commented 4 days ago

看仓库代码好像没有新更新,拉取的最新代码是3小时前的。

bincooo commented 4 days ago

哦,那就是我记错了。 你看看你拉取的commit里有没有这个,没有的话就更新试试

Screenshot 2024-06-27 at 10 46 40
ssfun commented 4 days ago

确认是拉取最新的代码编译部署,含有以上 commit

bincooo commented 4 days ago

那没有什么办法,huggingface上ip被claude标记得差不多了,Factory rebuild 换个ip试试,或者改为代理部署

ssfun commented 4 days ago

好的,感谢解疑!

ssfun commented 4 days ago

感觉可能不是IP问题,我走了 proxy 依旧会有上述报错,可以确认 proxy 可以正常访问 claude。

bincooo commented 4 days ago

嗯,我抽空看看。

bincooo commented 4 days ago

突然想起来,2.1.0 将claude的cookie配置转移到config.yaml了,不再是从Auth请求头传入。

ssfun commented 4 days ago

改在 config.yaml 上配置 cookie 后,Claude 可以使用了。

现在Auth请求配置比较割裂,建议后续版本将Auth请求全部都走 config.yaml 。另外建议增加接口 Auth 环境变量,方便在容器平台部署时使用

bincooo commented 4 days ago

直接config.yaml文件volumes托管不就行了?

ssfun commented 4 days ago

抱歉,可能没描述清楚,我是指各个服务的 Authorization 可以统一到 config.yaml 上管理。

另外再增加一个环境变量 AUTH_KEY 用作请求 Adapter 接口的 Authorization key

curl -i -X POST \
   -H "Content-Type:application/json" \
   -H "Authorization: AUTH_KEY" \
   -d \
'{
  "stream": true,
  "model": "coze",
  "messages": [
    {
      "role":    "user",
      "content": "hi"
    }
  ]
}' \
 'http://127.0.0.1:8080/v1/chat/completions'
bincooo commented 3 days ago

这个暂且搁置吧,没有硬性的需求需要