claude-to-chatgpt
claude-to-chatgpt copied to clipboard
Docker部署后访问API提示Internal Server Error
按照文档部署docker:docker run -d -p 8000:8000 wtzeng/claude-to-chatgpt:latest
然后执行curl命令报错Internal Server Error
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer sk-xxxxx" -d '{ "model": "gpt-3.5-turbo", "messages": [{"role": "user", "content": "Hello!"}] }' http://localhost:8000/v1/chat/completions
docker日志:
INFO: 172.17.0.1:58932 - "GET /v1/chat/completions HTTP/1.1" 405 Method Not Allowed
INFO: 172.17.0.1:58946 - "POST /v1/chat/completions HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
return await self.app(scope, receive, send)
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/fastapi/applications.py", line 276, in __call__
await super().__call__(scope, receive, send)
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/starlette/middleware/cors.py", line 84, in __call__
await self.app(scope, receive, send)
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/fastapi/routing.py", line 237, in app
raw_response = await run_endpoint_function(
File "/root/.cache/pypoetry/virtualenvs/claude-to-chatgpt-9TtSrW0h-py3.9/lib/python3.9/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
return await dependant.call(**values)
File "/app/claude_to_chatgpt/app.py", line 49, in chat
openai_response = await response.__anext__()
File "/app/claude_to_chatgpt/adapter.py", line 148, in chat
raise Exception(f"Error: {response.status_code}")
请问是什么问题呢
大概率是你没有绑手机号来获得那五美金的免费额度。 你不绑手机就是零额度,我刚在workbench试过了,提示得很明显了。
另外一个原因是你的服务器出口ip不被允许。你需要部署在官方允许的地区vps上。https://www.anthropic.com/supported-countries