mirror of
https://github.com/HanaokaYuzu/Gemini-API.git
synced 2026-04-12 12:23:03 -06:00
错误:status code 500: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1) #73
Labels
No labels
advanced
advanced
bug
dependencies
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
model
pull-request
question
unreproducible
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mirrors/Gemini-API#73
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @glaw1984 on GitHub (Jul 10, 2025).
错误:status code 500: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1)
@HanaokaYuzu commented on GitHub (Jul 10, 2025):
Please enable debug logs and send the full console output.
@glaw1984 commented on GitHub (Jul 10, 2025):
`2025-07-10 01:21:11.943 | INFO | uvicorn.protocols.http.h11_impl:send:473 - 205.210.31.155:63860 - "GET / HTTP/1.1" 404
2025-07-10 01:28:45.302 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: POST https://accounts.google.com/RotateCookies "HTTP/2 200 OK"
2025-07-10 01:37:45.728 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: POST https://accounts.google.com/RotateCookies "HTTP/2 200 OK"
2025-07-10 01:46:46.281 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: POST https://accounts.google.com/RotateCookies "HTTP/2 200 OK"
2025-07-10 01:55:46.671 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: POST https://accounts.google.com/RotateCookies "HTTP/2 200 OK"
2025-07-10 02:04:47.098 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: POST https://accounts.google.com/RotateCookies "HTTP/2 200 OK"
2025-07-10 02:13:47.486 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: POST https://accounts.google.com/RotateCookies "HTTP/2 200 OK"
2025-07-10 02:22:48.015 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: POST https://accounts.google.com/RotateCookies "HTTP/2 200 OK"
2025-07-10 02:31:48.431 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: POST https://accounts.google.com/RotateCookies "HTTP/2 200 OK"
2025-07-10 02:36:54.976 | INFO | httpx._client:send_single_request:1740 - HTTP Request: POST https://gemini.google.com//BardChatUi/data/assistant.lamda.BardFrontendService/StreamGenerate "HTTP/2 200 OK"
2025-07-10 02:36:56.449 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: GET https://www.google.com "HTTP/2 200 OK"
2025-07-10 02:36:56.717 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: GET https://gemini.google.com/app "HTTP/2 200 OK"
2025-07-10 02:36:56.810 | ERROR | app.server.chat:create_chat_completion:160 - Error generating content from Gemini API: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1)
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 522, in generate_content
raise Exception
Exception
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 527, in generate_content
match ErrorCode(response_json[0][5][2][0][1][0]):
│ └ 'wrb.fr', None, None, None, None, [13, None, [['type.googleapis.com/assistant.boq.bard.application.BardErrorInfo', [1013]...
└ <enum 'ErrorCode'>
File "/usr/local/lib/python3.12/enum.py", line 751, in call
return cls.new(cls, value)
│ │ │ └ 1013
│ │ └ <enum 'ErrorCode'>
│ └ <function Enum.new at 0xffffa2bc3380>
└ <enum 'ErrorCode'>
File "/usr/local/lib/python3.12/enum.py", line 1170, in new
raise ve_exc
└ None
ValueError: 1013 is not a valid ErrorCode
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 66, in wrapper
return await func(client, *args, **kwargs)
│ │ │ └ {'prompt': 'hi', 'files': [], 'model': <Model.G_2_5_FLASH: ('gemini-2.5-flash', {'x-goog-ext-525001261-jspb': '[1,null,null,n...
│ │ └ ()
│ └ <app.services.client.GeminiClientWrapper object at 0xffffa04f2ad0>
└ <function GeminiClient.generate_content at 0xffffa09a9300>
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 547, in generate_content
raise APIError(
└ <class 'gemini_webapi.exceptions.APIError'>
gemini_webapi.exceptions.APIError: Failed to generate contents. Invalid response data received. Client will try to re-initialize on next request.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/run.py", line 12, in
uvicorn.run(
│ └ <function run at 0xffffa1d15080>
└ <module 'uvicorn' from '/app/.venv/lib/python3.12/site-packages/uvicorn/init.py'>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/main.py", line 580, in run
server.run()
│ └ <function Server.run at 0xffffa1d17ec0>
└ <uvicorn.server.Server object at 0xffffa0a35b80>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/server.py", line 67, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0xffffa1d17f60>
│ │ └ <uvicorn.server.Server object at 0xffffa0a35b80>
│ └ <function run at 0xffffa21bafc0>
└ <module 'asyncio' from '/usr/local/lib/python3.12/asyncio/init.py'>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
│ │ └ <coroutine object Server.serve at 0xffffa04c10e0>
│ └ <function Runner.run at 0xffffa1f34720>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /app/.venv/lib/python3.12/site-packages/uvicorn/server.py:71> wai...
│ │ └ <cyfunction Loop.run_until_complete at 0xffffa04e36b0>
│ └ <uvloop.Loop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
└ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0xffffa0f70ef0>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
│ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <fastapi.applications.FastAPI object at 0xffffa292b6b0>
└ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0xffffa0f70ef0>
File "/app/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
│ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
└ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
File "/app/.venv/lib/python3.12/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <starlette.middleware.errors.ServerErrorMiddleware object at 0xffffa08ef890>
└ <fastapi.applications.FastAPI object at 0xffffa292b6b0>
File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
│ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0xffff9f7f3880>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <starlette.middleware.cors.CORSMiddleware object at 0xffffa08e74a0>
└ <starlette.middleware.errors.ServerErrorMiddleware object at 0xffffa08ef890>
File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 85, in call
await self.app(scope, receive, send)
│ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0xffff9f7f3880>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0xffffa0c0ba40>
└ <starlette.middleware.cors.CORSMiddleware object at 0xffffa08e74a0>
File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
│ │ │ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0xffff9f7f3880>
│ │ │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ │ │ └ <starlette.requests.Request object at 0xffff9f96ede0>
│ │ └ <fastapi.routing.APIRouter object at 0xffffa0f5c320>
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0xffffa0c0ba40>
└ <function wrap_app_handling_exceptions at 0xffffa0d209a0>
File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7f3a60>
│ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
└ <fastapi.routing.APIRouter object at 0xffffa0f5c320>
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 714, in call
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7f3a60>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0xffffa0f5c320>>
└ <fastapi.routing.APIRouter object at 0xffffa0f5c320>
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 734, in app
await route.handle(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7f3a60>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <function Route.handle at 0xffffa0d21e40>
└ APIRoute(path='/v1/chat/completions', name='create_chat_completion', methods=['POST'])
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7f3a60>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <function request_response..app at 0xffffa04c4040>
└ APIRoute(path='/v1/chat/completions', name='create_chat_completion', methods=['POST'])
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
│ │ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7f3a60>
│ │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ │ └ <starlette.requests.Request object at 0xffff9f96e1e0>
│ └ <function request_response..app..app at 0xffff9f7f3ec0>
└ <function wrap_app_handling_exceptions at 0xffffa0d209a0>
File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7f3ba0>
│ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f59eba0>>
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
└ <function request_response..app..app at 0xffff9f7f3ec0>
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
│ └ <starlette.requests.Request object at 0xffff9f96e1e0>
└ <function get_request_handler..app at 0xffffa04c40e0>
File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
└ <function run_endpoint_function at 0xffffa0d20540>
File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
│ │ └ {'api_key': '7SK6543', 'tmp_dir': PosixPath('/tmp/tmpcn5ac32s'), 'request': ChatCompletionRequest(model='gemini-2.5-flash', m...
│ └ <function create_chat_completion at 0xffffa07971a0>
└ Dependant(path_params=[], query_params=[], header_params=[], cookie_params=[], body_params=[ModelField(field_info=Body(Pydant...
File "/app/app/server/chat.py", line 124, in _send_with_split
return await session.send_message(text, files=files)
│ │ │ └ []
│ │ └ 'hi'
│ └ <function ChatSession.send_message at 0xffffa09a9580>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 777, in send_message
return await self.geminiclient.generate_content(
│ └ <member 'geminiclient' of 'ChatSession' objects>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 74, in wrapper
return await wrapper(client, *args, retry=retry - 1, **kwargs)
│ │ │ │ └ {'prompt': 'hi', 'files': [], 'model': <Model.G_2_5_FLASH: ('gemini-2.5-flash', {'x-goog-ext-525001261-jspb': '[1,null,null,n...
│ │ │ └ 2
│ │ └ ()
│ └ <app.services.client.GeminiClientWrapper object at 0xffffa04f2ad0>
└ <function GeminiClient.generate_content at 0xffffa09a9260>
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 50, in wrapper
await client.init(
│ └ <function GeminiClientWrapper.init at 0xffffa0795300>
└ <app.services.client.GeminiClientWrapper object at 0xffffa04f2ad0>
File "/app/app/services/client.py", line 29, in init
await super().init(**kwargs)
└ {'timeout': 60, 'auto_close': False, 'close_delay': 300, 'auto_refresh': True, 'refresh_interval': 540, 'verbose': False}
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 190, in init
access_token, valid_cookies = await get_access_token(
└ <function get_access_token at 0xffffa09a84a0>
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/utils/get_access_token.py", line 172, in get_access_token
raise AuthError(
└ <class 'gemini_webapi.exceptions.AuthError'>
gemini_webapi.exceptions.AuthError: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1)
2025-07-10 02:36:56.831 | INFO | uvicorn.protocols.http.h11_impl:send:473 - 129.146.113.177:54052 - "POST /v1/chat/completions HTTP/1.1" 500
2025-07-10 02:36:56.832 | ERROR | uvicorn.protocols.http.h11_impl:run_asgi:408 - Exception in ASGI application
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 522, in generate_content
raise Exception
Exception
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 527, in generate_content
match ErrorCode(response_json[0][5][2][0][1][0]):
│ └ 'wrb.fr', None, None, None, None, [13, None, [['type.googleapis.com/assistant.boq.bard.application.BardErrorInfo', [1013]...
└ <enum 'ErrorCode'>
File "/usr/local/lib/python3.12/enum.py", line 751, in call
return cls.new(cls, value)
│ │ │ └ 1013
│ │ └ <enum 'ErrorCode'>
│ └ <function Enum.new at 0xffffa2bc3380>
└ <enum 'ErrorCode'>
File "/usr/local/lib/python3.12/enum.py", line 1170, in new
raise ve_exc
└ None
ValueError: 1013 is not a valid ErrorCode
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 66, in wrapper
return await func(client, *args, **kwargs)
│ │ │ └ {'prompt': 'hi', 'files': [], 'model': <Model.G_2_5_FLASH: ('gemini-2.5-flash', {'x-goog-ext-525001261-jspb': '[1,null,null,n...
│ │ └ ()
│ └ <app.services.client.GeminiClientWrapper object at 0xffffa04f2ad0>
└ <function GeminiClient.generate_content at 0xffffa09a9300>
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 547, in generate_content
raise APIError(
└ <class 'gemini_webapi.exceptions.APIError'>
gemini_webapi.exceptions.APIError: Failed to generate contents. Invalid response data received. Client will try to re-initialize on next request.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/run.py", line 12, in
uvicorn.run(
│ └ <function run at 0xffffa1d15080>
└ <module 'uvicorn' from '/app/.venv/lib/python3.12/site-packages/uvicorn/init.py'>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/main.py", line 580, in run
server.run()
│ └ <function Server.run at 0xffffa1d17ec0>
└ <uvicorn.server.Server object at 0xffffa0a35b80>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/server.py", line 67, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0xffffa1d17f60>
│ │ └ <uvicorn.server.Server object at 0xffffa0a35b80>
│ └ <function run at 0xffffa21bafc0>
└ <module 'asyncio' from '/usr/local/lib/python3.12/asyncio/init.py'>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
│ │ └ <coroutine object Server.serve at 0xffffa04c10e0>
│ └ <function Runner.run at 0xffffa1f34720>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /app/.venv/lib/python3.12/site-packages/uvicorn/server.py:71> wai...
│ │ └ <cyfunction Loop.run_until_complete at 0xffffa04e36b0>
│ └ <uvloop.Loop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/app/app/server/chat.py", line 158, in create_chat_completion
response = await _send_with_split(session, model_input, files=files)
│ │ │ └ []
│ │ └ 'hi'
│ └ ChatSession(cid='None', rid='None', rcid='None')
└ <function create_chat_completion.._send_with_split at 0xffff9f7f2980>
File "/app/app/server/chat.py", line 124, in _send_with_split
return await session.send_message(text, files=files)
│ │ │ └ []
│ │ └ 'hi'
│ └ <function ChatSession.send_message at 0xffffa09a9580>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 777, in send_message
return await self.geminiclient.generate_content(
│ └ <member 'geminiclient' of 'ChatSession' objects>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 74, in wrapper
return await wrapper(client, *args, retry=retry - 1, **kwargs)
│ │ │ │ └ {'prompt': 'hi', 'files': [], 'model': <Model.G_2_5_FLASH: ('gemini-2.5-flash', {'x-goog-ext-525001261-jspb': '[1,null,null,n...
│ │ │ └ 2
│ │ └ ()
│ └ <app.services.client.GeminiClientWrapper object at 0xffffa04f2ad0>
└ <function GeminiClient.generate_content at 0xffffa09a9260>
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 50, in wrapper
await client.init(
│ └ <function GeminiClientWrapper.init at 0xffffa0795300>
└ <app.services.client.GeminiClientWrapper object at 0xffffa04f2ad0>
File "/app/app/services/client.py", line 29, in init
await super().init(**kwargs)
└ {'timeout': 60, 'auto_close': False, 'close_delay': 300, 'auto_refresh': True, 'refresh_interval': 540, 'verbose': False}
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 190, in init
access_token, valid_cookies = await get_access_token(
└ <function get_access_token at 0xffffa09a84a0>
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/utils/get_access_token.py", line 172, in get_access_token
raise AuthError(
└ <class 'gemini_webapi.exceptions.AuthError'>
gemini_webapi.exceptions.AuthError: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1)
2025-07-10 02:37:01.965 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: GET https://www.google.com "HTTP/2 200 OK"
2025-07-10 02:37:02.490 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: GET https://gemini.google.com/app "HTTP/2 200 OK"
2025-07-10 02:37:02.939 | ERROR | app.server.chat:create_chat_completion:160 - Error generating content from Gemini API: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1)
Traceback (most recent call last):
File "/app/run.py", line 12, in
uvicorn.run(
│ └ <function run at 0xffffa1d15080>
└ <module 'uvicorn' from '/app/.venv/lib/python3.12/site-packages/uvicorn/init.py'>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/main.py", line 580, in run
server.run()
│ └ <function Server.run at 0xffffa1d17ec0>
└ <uvicorn.server.Server object at 0xffffa0a35b80>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/server.py", line 67, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0xffffa1d17f60>
│ │ └ <uvicorn.server.Server object at 0xffffa0a35b80>
│ └ <function run at 0xffffa21bafc0>
└ <module 'asyncio' from '/usr/local/lib/python3.12/asyncio/init.py'>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
│ │ └ <coroutine object Server.serve at 0xffffa04c10e0>
│ └ <function Runner.run at 0xffffa1f34720>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /app/.venv/lib/python3.12/site-packages/uvicorn/server.py:71> wai...
│ │ └ <cyfunction Loop.run_until_complete at 0xffffa04e36b0>
│ └ <uvloop.Loop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
└ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0xffffa0f70ef0>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
│ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <fastapi.applications.FastAPI object at 0xffffa292b6b0>
└ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0xffffa0f70ef0>
File "/app/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
│ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
└ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
File "/app/.venv/lib/python3.12/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <starlette.middleware.errors.ServerErrorMiddleware object at 0xffffa08ef890>
└ <fastapi.applications.FastAPI object at 0xffffa292b6b0>
File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
│ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0xffff9f7f3c40>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <starlette.middleware.cors.CORSMiddleware object at 0xffffa08e74a0>
└ <starlette.middleware.errors.ServerErrorMiddleware object at 0xffffa08ef890>
File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 85, in call
await self.app(scope, receive, send)
│ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0xffff9f7f3c40>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0xffffa0c0ba40>
└ <starlette.middleware.cors.CORSMiddleware object at 0xffffa08e74a0>
File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
│ │ │ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0xffff9f7f3c40>
│ │ │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ │ │ └ <starlette.requests.Request object at 0xffff9f97e960>
│ │ └ <fastapi.routing.APIRouter object at 0xffffa0f5c320>
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0xffffa0c0ba40>
└ <function wrap_app_handling_exceptions at 0xffffa0d209a0>
File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f764c20>
│ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
└ <fastapi.routing.APIRouter object at 0xffffa0f5c320>
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 714, in call
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f764c20>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0xffffa0f5c320>>
└ <fastapi.routing.APIRouter object at 0xffffa0f5c320>
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 734, in app
await route.handle(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f764c20>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <function Route.handle at 0xffffa0d21e40>
└ APIRoute(path='/v1/chat/completions', name='create_chat_completion', methods=['POST'])
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f764c20>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <function request_response..app at 0xffffa04c4040>
└ APIRoute(path='/v1/chat/completions', name='create_chat_completion', methods=['POST'])
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
│ │ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f764c20>
│ │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ │ └ <starlette.requests.Request object at 0xffff9f9635f0>
│ └ <function request_response..app..app at 0xffff9f764d60>
└ <function wrap_app_handling_exceptions at 0xffffa0d209a0>
File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f764f40>
│ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f96f050>>
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
└ <function request_response..app..app at 0xffff9f764d60>
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
│ └ <starlette.requests.Request object at 0xffff9f9635f0>
└ <function get_request_handler..app at 0xffffa04c40e0>
File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
└ <function run_endpoint_function at 0xffffa0d20540>
File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
│ │ └ {'api_key': '7SK6543', 'tmp_dir': PosixPath('/tmp/tmp4yxnbxnn'), 'request': ChatCompletionRequest(model='gemini-2.5-flash', m...
│ └ <function create_chat_completion at 0xffffa07971a0>
└ Dependant(path_params=[], query_params=[], header_params=[], cookie_params=[], body_params=[ModelField(field_info=Body(Pydant...
File "/app/app/server/chat.py", line 124, in _send_with_split
return await session.send_message(text, files=files)
│ │ │ └ []
│ │ └ 'hi'
│ └ <function ChatSession.send_message at 0xffffa09a9580>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 777, in send_message
return await self.geminiclient.generate_content(
│ └ <member 'geminiclient' of 'ChatSession' objects>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 50, in wrapper
await client.init(
│ └ <function GeminiClientWrapper.init at 0xffffa0795300>
└ <app.services.client.GeminiClientWrapper object at 0xffffa04f2ad0>
File "/app/app/services/client.py", line 29, in init
await super().init(**kwargs)
└ {'timeout': 60, 'auto_close': False, 'close_delay': 300, 'auto_refresh': True, 'refresh_interval': 540, 'verbose': False}
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 190, in init
access_token, valid_cookies = await get_access_token(
└ <function get_access_token at 0xffffa09a84a0>
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/utils/get_access_token.py", line 172, in get_access_token
raise AuthError(
└ <class 'gemini_webapi.exceptions.AuthError'>
gemini_webapi.exceptions.AuthError: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1)
2025-07-10 02:37:02.944 | INFO | uvicorn.protocols.http.h11_impl:send:473 - 129.146.113.177:44490 - "POST /v1/chat/completions HTTP/1.1" 500
2025-07-10 02:37:02.945 | ERROR | uvicorn.protocols.http.h11_impl:run_asgi:408 - Exception in ASGI application
Traceback (most recent call last):
File "/app/run.py", line 12, in
uvicorn.run(
│ └ <function run at 0xffffa1d15080>
└ <module 'uvicorn' from '/app/.venv/lib/python3.12/site-packages/uvicorn/init.py'>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/main.py", line 580, in run
server.run()
│ └ <function Server.run at 0xffffa1d17ec0>
└ <uvicorn.server.Server object at 0xffffa0a35b80>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/server.py", line 67, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0xffffa1d17f60>
│ │ └ <uvicorn.server.Server object at 0xffffa0a35b80>
│ └ <function run at 0xffffa21bafc0>
└ <module 'asyncio' from '/usr/local/lib/python3.12/asyncio/init.py'>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
│ │ └ <coroutine object Server.serve at 0xffffa04c10e0>
│ └ <function Runner.run at 0xffffa1f34720>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /app/.venv/lib/python3.12/site-packages/uvicorn/server.py:71> wai...
│ │ └ <cyfunction Loop.run_until_complete at 0xffffa04e36b0>
│ └ <uvloop.Loop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/app/app/server/chat.py", line 158, in create_chat_completion
response = await _send_with_split(session, model_input, files=files)
│ │ │ └ []
│ │ └ 'hi'
│ └ ChatSession(cid='None', rid='None', rcid='None')
└ <function create_chat_completion.._send_with_split at 0xffff9f764e00>
File "/app/app/server/chat.py", line 124, in _send_with_split
return await session.send_message(text, files=files)
│ │ │ └ []
│ │ └ 'hi'
│ └ <function ChatSession.send_message at 0xffffa09a9580>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 777, in send_message
return await self.geminiclient.generate_content(
│ └ <member 'geminiclient' of 'ChatSession' objects>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 50, in wrapper
await client.init(
│ └ <function GeminiClientWrapper.init at 0xffffa0795300>
└ <app.services.client.GeminiClientWrapper object at 0xffffa04f2ad0>
File "/app/app/services/client.py", line 29, in init
await super().init(**kwargs)
└ {'timeout': 60, 'auto_close': False, 'close_delay': 300, 'auto_refresh': True, 'refresh_interval': 540, 'verbose': False}
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 190, in init
access_token, valid_cookies = await get_access_token(
└ <function get_access_token at 0xffffa09a84a0>
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/utils/get_access_token.py", line 172, in get_access_token
raise AuthError(
└ <class 'gemini_webapi.exceptions.AuthError'>
gemini_webapi.exceptions.AuthError: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1)
2025-07-10 02:40:42.039 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: GET https://www.google.com "HTTP/2 200 OK"
2025-07-10 02:40:42.560 | INFO | httpx._client:_send_single_request:1740 - HTTP Request: GET https://gemini.google.com/app "HTTP/2 200 OK"
2025-07-10 02:40:43.003 | ERROR | app.server.chat:create_chat_completion:160 - Error generating content from Gemini API: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1)
Traceback (most recent call last):
File "/app/run.py", line 12, in
uvicorn.run(
│ └ <function run at 0xffffa1d15080>
└ <module 'uvicorn' from '/app/.venv/lib/python3.12/site-packages/uvicorn/init.py'>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/main.py", line 580, in run
server.run()
│ └ <function Server.run at 0xffffa1d17ec0>
└ <uvicorn.server.Server object at 0xffffa0a35b80>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/server.py", line 67, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0xffffa1d17f60>
│ │ └ <uvicorn.server.Server object at 0xffffa0a35b80>
│ └ <function run at 0xffffa21bafc0>
└ <module 'asyncio' from '/usr/local/lib/python3.12/asyncio/init.py'>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
│ │ └ <coroutine object Server.serve at 0xffffa04c10e0>
│ └ <function Runner.run at 0xffffa1f34720>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /app/.venv/lib/python3.12/site-packages/uvicorn/server.py:71> wai...
│ │ └ <cyfunction Loop.run_until_complete at 0xffffa04e36b0>
│ └ <uvloop.Loop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
└ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0xffffa0f70ef0>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
│ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <fastapi.applications.FastAPI object at 0xffffa292b6b0>
└ <uvicorn.middleware.proxy_headers.ProxyHeadersMiddleware object at 0xffffa0f70ef0>
File "/app/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
│ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
└ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
File "/app/.venv/lib/python3.12/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <bound method RequestResponseCycle.send of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <starlette.middleware.errors.ServerErrorMiddleware object at 0xffffa08ef890>
└ <fastapi.applications.FastAPI object at 0xffffa292b6b0>
File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
│ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0xffff9f7653a0>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <starlette.middleware.cors.CORSMiddleware object at 0xffffa08e74a0>
└ <starlette.middleware.errors.ServerErrorMiddleware object at 0xffffa08ef890>
File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 85, in call
await self.app(scope, receive, send)
│ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0xffff9f7653a0>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0xffffa0c0ba40>
└ <starlette.middleware.cors.CORSMiddleware object at 0xffffa08e74a0>
File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
│ │ │ │ │ │ └ <function ServerErrorMiddleware.call.._send at 0xffff9f7653a0>
│ │ │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ │ │ └ <starlette.requests.Request object at 0xffffa0756de0>
│ │ └ <fastapi.routing.APIRouter object at 0xffffa0f5c320>
│ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0xffffa0c0ba40>
└ <function wrap_app_handling_exceptions at 0xffffa0d209a0>
File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7658a0>
│ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
└ <fastapi.routing.APIRouter object at 0xffffa0f5c320>
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 714, in call
await self.middleware_stack(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7658a0>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0xffffa0f5c320>>
└ <fastapi.routing.APIRouter object at 0xffffa0f5c320>
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 734, in app
await route.handle(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7658a0>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <function Route.handle at 0xffffa0d21e40>
└ APIRoute(path='/v1/chat/completions', name='create_chat_completion', methods=['POST'])
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
│ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7658a0>
│ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ └ <function request_response..app at 0xffffa04c4040>
└ APIRoute(path='/v1/chat/completions', name='create_chat_completion', methods=['POST'])
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
│ │ │ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7658a0>
│ │ │ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
│ │ └ <starlette.requests.Request object at 0xffffa0754980>
│ └ <function request_response..app..app at 0xffff9f7656c0>
└ <function wrap_app_handling_exceptions at 0xffffa0d209a0>
File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
│ │ │ └ <function wrap_app_handling_exceptions..wrapped_app..sender at 0xffff9f7659e0>
│ │ └ <bound method RequestResponseCycle.receive of <uvicorn.protocols.http.h11_impl.RequestResponseCycle object at 0xffff9f868920>>
│ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.3'}, 'http_version': '1.1', 'server': ('172.18.0.4', 8000), 'c...
└ <function request_response..app..app at 0xffff9f7656c0>
File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
│ └ <starlette.requests.Request object at 0xffffa0754980>
└ <function get_request_handler..app at 0xffffa04c40e0>
File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
└ <function run_endpoint_function at 0xffffa0d20540>
File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
│ │ └ {'api_key': '7SK6543', 'tmp_dir': PosixPath('/tmp/tmpob43h17s'), 'request': ChatCompletionRequest(model='gemini-2.5-flash', m...
│ └ <function create_chat_completion at 0xffffa07971a0>
└ Dependant(path_params=[], query_params=[], header_params=[], cookie_params=[], body_params=[ModelField(field_info=Body(Pydant...
File "/app/app/server/chat.py", line 124, in _send_with_split
return await session.send_message(text, files=files)
│ │ │ └ []
│ │ └ 'hi'
│ └ <function ChatSession.send_message at 0xffffa09a9580>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 777, in send_message
return await self.geminiclient.generate_content(
│ └ <member 'geminiclient' of 'ChatSession' objects>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 50, in wrapper
await client.init(
│ └ <function GeminiClientWrapper.init at 0xffffa0795300>
└ <app.services.client.GeminiClientWrapper object at 0xffffa04f2ad0>
File "/app/app/services/client.py", line 29, in init
await super().init(**kwargs)
└ {'timeout': 60, 'auto_close': False, 'close_delay': 300, 'auto_refresh': True, 'refresh_interval': 540, 'verbose': False}
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 190, in init
access_token, valid_cookies = await get_access_token(
└ <function get_access_token at 0xffffa09a84a0>
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/utils/get_access_token.py", line 172, in get_access_token
raise AuthError(
└ <class 'gemini_webapi.exceptions.AuthError'>
gemini_webapi.exceptions.AuthError: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1)
2025-07-10 02:40:43.014 | INFO | uvicorn.protocols.http.h11_impl:send:473 - 129.146.113.177:47122 - "POST /v1/chat/completions HTTP/1.1" 500
2025-07-10 02:40:43.015 | ERROR | uvicorn.protocols.http.h11_impl:run_asgi:408 - Exception in ASGI application
Traceback (most recent call last):
File "/app/run.py", line 12, in
uvicorn.run(
│ └ <function run at 0xffffa1d15080>
└ <module 'uvicorn' from '/app/.venv/lib/python3.12/site-packages/uvicorn/init.py'>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/main.py", line 580, in run
server.run()
│ └ <function Server.run at 0xffffa1d17ec0>
└ <uvicorn.server.Server object at 0xffffa0a35b80>
File "/app/.venv/lib/python3.12/site-packages/uvicorn/server.py", line 67, in run
return asyncio.run(self.serve(sockets=sockets))
│ │ │ │ └ None
│ │ │ └ <function Server.serve at 0xffffa1d17f60>
│ │ └ <uvicorn.server.Server object at 0xffffa0a35b80>
│ └ <function run at 0xffffa21bafc0>
└ <module 'asyncio' from '/usr/local/lib/python3.12/asyncio/init.py'>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
│ │ └ <coroutine object Server.serve at 0xffffa04c10e0>
│ └ <function Runner.run at 0xffffa1f34720>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
│ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /app/.venv/lib/python3.12/site-packages/uvicorn/server.py:71> wai...
│ │ └ <cyfunction Loop.run_until_complete at 0xffffa04e36b0>
│ └ <uvloop.Loop running=True closed=False debug=False>
└ <asyncio.runners.Runner object at 0xffffa0f6e120>
File "/app/app/server/chat.py", line 158, in create_chat_completion
response = await _send_with_split(session, model_input, files=files)
│ │ │ └ []
│ │ └ 'hi'
│ └ ChatSession(cid='None', rid='None', rcid='None')
└ <function create_chat_completion.._send_with_split at 0xffff9f764cc0>
File "/app/app/server/chat.py", line 124, in _send_with_split
return await session.send_message(text, files=files)
│ │ │ └ []
│ │ └ 'hi'
│ └ <function ChatSession.send_message at 0xffffa09a9580>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 777, in send_message
return await self.geminiclient.generate_content(
│ └ <member 'geminiclient' of 'ChatSession' objects>
└ ChatSession(cid='None', rid='None', rcid='None')
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 50, in wrapper
await client.init(
│ └ <function GeminiClientWrapper.init at 0xffffa0795300>
└ <app.services.client.GeminiClientWrapper object at 0xffffa04f2ad0>
File "/app/app/services/client.py", line 29, in init
await super().init(**kwargs)
└ {'timeout': 60, 'auto_close': False, 'close_delay': 300, 'auto_refresh': True, 'refresh_interval': 540, 'verbose': False}
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/client.py", line 190, in init
access_token, valid_cookies = await get_access_token(
└ <function get_access_token at 0xffffa09a84a0>
File "/app/.venv/lib/python3.12/site-packages/gemini_webapi/utils/get_access_token.py", line 172, in get_access_token
raise AuthError(
└ <class 'gemini_webapi.exceptions.AuthError'>
gemini_webapi.exceptions.AuthError: Failed to initialize client. SECURE_1PSIDTS could get expired frequently, please make sure cookie values are up to date. (Failed initialization attempts: 1)
`
@HanaokaYuzu commented on GitHub (Jul 10, 2025):
Interesting. You got error code 1013 which is not observed ever before. As you are wrapping
gemini_webapiwith another library, I can't tell if the error was caused bygemini_webapiitself. Maybe you can try creating a new venv and installgemini_webapionly, then use the same cookies to see if the same error happens again.@glaw1984 commented on GitHub (Jul 11, 2025):
如果用你的这个主项目,如何用docker-compose.yml来部署,你的教程里边没有这块内容。另外能否提供一个docker-compose.yml及Dockerfile文件便于push和创建容器,谢谢
If you use your main project, how to deploy it with docker-compose.yml? Your tutorial does not include this content. In addition, can you provide a docker-compose.yml and Dockerfile file to facilitate pushing and creating containers? Thank you
@HanaokaYuzu commented on GitHub (Jul 11, 2025):
This package is not meant to be solely used to build a container. You should create an issue in the wrapper project's repository, and maybe there's someone who shares the same problem with you.
@tianlichunhong commented on GitHub (Jul 14, 2025):
我遇到这个问题,重新获取SECURE_1PSID和SECURE_1PSIDTS就可以。应该是id过期导致的。感觉这个过期很快的样子。
@HanaokaYuzu commented on GitHub (Aug 11, 2025):
Please try
GeminiClient.init(auto_refresh=False). In some misconfigured environments cookie rotation will break the lifecycle.