KoushikNavuluri / Claude-API

This project provides an unofficial API for Claude AI, allowing users to access and interact with Claude AI .
https://pypi.org/project/claude-api/
MIT License
648 stars 112 forks source link

claude_api.send_message() error #77

Open GhalebAldoboni opened 9 months ago

GhalebAldoboni commented 9 months ago
response = claude_api.send_message(prompt, conversation_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/claude_api.py", line 129, in send_message data = json.loads(json_str) ^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

GhalebAldoboni commented 9 months ago

I tried to use US VPN and changed the cookie but got the same error

Randomboiii03 commented 9 months ago

It works for me though, can you give more detailed info?

GhalebAldoboni commented 9 months ago

image

That's the error that I get, I tried the API on google colab and got the same thing as well :

response = claude_api.send_message(prompt, conversation_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/claude_api.py", line 129, in send_message data = json.loads(json_str) ^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Randomboiii03 commented 9 months ago

image

That's the error that I get, I tried the API on google colab and got the same thing as well :

response = claude_api.send_message(prompt, conversation_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/claude_api.py", line 129, in send_message data = json.loads(json_str) ^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

remove the "<conversation_id>" or , if this answers your problem can you closed this issue thanks 🎉

caicaicaibeiqie commented 5 months ago

Possible causes: 1, this is because the proxy region is not allowed to provide services 2, the transmission of an incorrect parameter, such as "model" in "headers" should be updated to the same version as the web page.