AshwinPathi / claude-api-py

Unofficial Python API for Anthropic's Claude LLM
https://pypi.org/project/claude-api-py/
MIT License
108 stars 11 forks source link

An error was reported during start_new_conversation() #19

Closed xiewenqian closed 9 months ago

xiewenqian commented 10 months ago

[16-Aug-23 09:36:26:root:WARNING][claude_client.py:93 - send_message() ] Response from sending message is None. Traceback (most recent call last): File "C:/Users//Desktop/claude-api-py/example.py", line 114, in main() File "C:/Users//Desktop/claude-api-py/example.py", line 43, in main assert new_convo_response is not None AssertionError HTTP Error 403: Forbidden

Lxb921006 commented 10 months ago

same error,Maybe Claude found out,hahaha

AshwinPathi commented 10 months ago

Yea it seems like they either have some protections or im missing header fields. Let me experiment

AshwinPathi commented 10 months ago

Welp turns out they also rate limit conversations on accounts now lol

winie-hy commented 10 months ago

Is there a way to fix them? Author boss

sdimantsd commented 10 months ago

Same in here :-(

1024bit commented 10 months ago

Me too :-(

sdimantsd commented 10 months ago

Yea it seems like they either have some protections or im missing header fields. Let me experiment

Is that help you? https://github.com/KoushikNavuluri/Claude-API/issues/42

sdimantsd commented 10 months ago

Here a fix in another repo https://github.com/KoushikNavuluri/Claude-API/commit/184f52cb57f31882fb3e529a0a876b1d6b5bf363

winie-hy commented 10 months ago

I think the repair above is temporary, and the function of uploading files is also invalid. It seems that the issus processing above is to get, organize and extract the entire page content, which is not feasible for me to try

sdimantsd commented 10 months ago

I realised. Thank you So don't wait for a fix for the current project?

AshwinPathi commented 10 months ago

I'll try and fix it as well.

winie-hy commented 10 months ago

https://github.com/KoushikNavuluri/Claude-API I found this can be used, you see if it has inspiration for you

AshwinPathi commented 10 months ago

The thing is, using the requests library on my machine doesn't work correctly, which is why I implemented my own home made requests library with urllib. I need to test out some more to figure out the dicrepancy. My guess is requests sends some "invisible" headers that urllib doesnt.

winie-hy commented 10 months ago

from curl_cffi import requests ,Maybe it's because you need to ask for it? Looks like web information to get this @AshwinPathi

st1vms commented 10 months ago

Hello, I recently improved the existing solutions, by fixing header consistency, adding auto session gathering using Firefox login and selenium, and auto user agent retrieval along with timezone.

My unofficial version of the API does currently work like a charm, it supports chat creation/deletion/retrieval and messages with attachments (with all the supported file types). It also let you handle a MessageRateLimit exception that provides you with the amount of seconds to sleep before next rateReset.

Come have a try! Leave a :star: if you can : )

https://github.com/st1vms/unofficial-claude2-api