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

Docker部署后访问API提示Internal Server Error #23

Open
junyangfan opened this issue Aug 10, 2023 · 2 comments
Open

Docker部署后访问API提示Internal Server Error #23

junyangfan opened this issue Aug 10, 2023 · 2 comments

Comments

@junyangfan
Copy link

按照文档部署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}")

请问是什么问题呢

@shawnWXN
Copy link

大概率是你没有绑手机号来获得那五美金的免费额度。 你不绑手机就是零额度,我刚在workbench试过了,提示得很明显了。

@shawnWXN
Copy link

另外一个原因是你的服务器出口ip不被允许。你需要部署在官方允许的地区vps上。https://www.anthropic.com/supported-countries

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

2 participants