DeepSeek-V3 icon indicating copy to clipboard operation
DeepSeek-V3 copied to clipboard

[BUG]json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0).

Open zentery opened this issue 1 year ago • 11 comments

from openai import OpenAI client = OpenAI(api_key="", base_url="https://api.deepseek.com") response = client.chat.completions.create( model="deepseek-reasoner", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": "1+1=?"}, ], temperature=0 ) print(response) print(response.choices[0].message) print(response.choices[0].message.content) When I use the official code to call the API, I get: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0). Why is this? It works when I first use the code, but it only works once and then it stops working. Can anyone solve this?

zentery avatar Feb 26 '25 09:02 zentery

I also encounter the same error when using model deepseek-chat.

Python Dependency:

openai==1.58.0

JonahWhaler avatar Feb 26 '25 10:02 JonahWhaler

+1

Python Dependency:openai==1.64.0

Strke avatar Feb 28 '25 09:02 Strke

+1 Python Dependency: openai==1.65.1

M1kyxx avatar Mar 02 '25 14:03 M1kyxx

If you don't mind, I'm gonna take this issue and open PR until this weekend(KST).

AnneMayor avatar Mar 03 '25 15:03 AnneMayor

I am currently investigating this issue and need more time to figure it out. If anyone can resolve this issue right away, please let me know. Otherwise, I will continue working on it.

AnneMayor avatar Mar 08 '25 13:03 AnneMayor

I am currently investigating this issue and need more time to figure it out. If anyone can resolve this issue right away, please let me know. Otherwise, I will continue working on it.

Based on my experience, it is a on and off issue. I suspect it has more to do with DeepSeek's server than our code.

JonahWhaler avatar Mar 08 '25 14:03 JonahWhaler

Based on my experience, it is a on and off issue. I suspect it has more to do with DeepSeek's server than our code.

Oh, for real? If then I think this issue should be handled by Deepseek's engineers. Thanks for your comment. I am going to look for other issue that I can handle by myself.

AnneMayor avatar Mar 08 '25 14:03 AnneMayor

For now, I suspect openai library. I think there might be an issue on a synchronous API requests.

AnneMayor avatar Mar 08 '25 14:03 AnneMayor

I think it should be a problem on the server side. Using the same program, there is no problem calling the chatgpt API, but this error occurs when calling the deepseek API

Strke avatar Mar 08 '25 14:03 Strke

I think it should be a problem on the server side. Using the same program, there is no problem calling the chatgpt API, but this error occurs when calling the deepseek API

I see. Thanks. I hope our engineers would handle this issue for us 🙏

AnneMayor avatar Mar 08 '25 14:03 AnneMayor

+1 Python Dependency: openai==1.65.4 And I agree that it's more like an issue caused by high using demands. It works so well and smoothly during midnight (discount periods) but reports this problem everytime after 8:30 am CST in the past week.

uupengleo avatar Mar 12 '25 02:03 uupengleo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this issue is still relevant, please leave a comment to keep it open. Thank you for your contributions!

github-actions[bot] avatar Apr 14 '25 00:04 github-actions[bot]

false

github-actions[bot] avatar Apr 28 '25 00:04 github-actions[bot]