[GH-ISSUE #91] JSONDecodeError: Expecting value: line 5 column 1 (char 4) #77

Closed
opened 2026-10-26 21:13:11 +00:00 by bsakaguchi · 41 comments
Owner

Originally created by @jrohsc on GitHub (Jan 27, 2025).
Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/91

I'm getting a JSONDecodeError: Expecting value: line 5 column 1 (char 4) error by running the exact same code posted on the API documentation. Is there a way to fix this error?

from openai import OpenAI
client = OpenAI(api_key="", base_url="https://api.deepseek.com")

Round 1

messages = [{"role": "user", "content": "9.11 and 9.8, which is greater?"}]
response = client.chat.completions.create(
model="deepseek-reasoner",
messages=messages
)

reasoning_content = response.choices[0].message.reasoning_content
content = response.choices[0].message.content

Originally created by @jrohsc on GitHub (Jan 27, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/91 I'm getting a `JSONDecodeError: Expecting value: line 5 column 1 (char 4)` error by running the exact same code posted on the API documentation. Is there a way to fix this error? from openai import OpenAI client = OpenAI(api_key="<DeepSeek API Key>", base_url="https://api.deepseek.com") # Round 1 messages = [{"role": "user", "content": "9.11 and 9.8, which is greater?"}] response = client.chat.completions.create( model="deepseek-reasoner", messages=messages ) reasoning_content = response.choices[0].message.reasoning_content content = response.choices[0].message.content
bsakaguchi 2026-10-26 21:13:11 +00:00
Author
Owner

@jrohsc commented on GitHub (Jan 27, 2025):

Is there a way to get the reasoning tokens from the huggingface version on DeepSeek-R1-Distill-Qwen-7B?

<!-- gh-comment-id:2616446222 --> @jrohsc commented on GitHub (Jan 27, 2025): Is there a way to get the reasoning tokens from the huggingface version on DeepSeek-R1-Distill-Qwen-7B?
Author
Owner

@zhuofengli commented on GitHub (Jan 28, 2025):

I hit the same issue and adding max_token helped

<!-- gh-comment-id:2618135787 --> @zhuofengli commented on GitHub (Jan 28, 2025): I hit the same issue and adding `max_token` helped
Author
Owner

@globalcargo commented on GitHub (Jan 28, 2025):

We already use max_token as part of our api submit - makes no difference we get the " Expecting value: line 5 column 1 (char 4)" error on api calls both to V3 and R1. That said, platform api for both models worked perfectly fine until Sunday night (before media hysteria started), so hoping this is a ddos related issue and will resolve.

<!-- gh-comment-id:2618983730 --> @globalcargo commented on GitHub (Jan 28, 2025): We already use `max_token` as part of our api submit - makes no difference we get the " Expecting value: line 5 column 1 (char 4)" error on api calls both to V3 and R1. That said, platform api for both models worked perfectly fine until Sunday night (before media hysteria started), so hoping this is a ddos related issue and will resolve.
Author
Owner

@pedayako commented on GitHub (Jan 28, 2025):

I think it's an issue involving the deepseek-reasoner because I'm experiencing the same problem, and before the hysteria, the model and API calls were working fine. I believe things will normalize soon

<!-- gh-comment-id:2619302638 --> @pedayako commented on GitHub (Jan 28, 2025): I think it's an issue involving the deepseek-reasoner because I'm experiencing the same problem, and before the hysteria, the model and API calls were working fine. I believe things will normalize soon
Author
Owner

@jrohsc commented on GitHub (Jan 28, 2025):

I recommend everyone to try the fireworks ai API. You still might have to pay for the api but I think it is the only API that works.

<!-- gh-comment-id:2619318707 --> @jrohsc commented on GitHub (Jan 28, 2025): I recommend everyone to try the fireworks ai API. You still might have to pay for the api but I think it is the only API that works.
Author
Owner

@globalcargo commented on GitHub (Jan 28, 2025):

We've used deepseek's hosted API on their platform since they launched and it has worked reliably for all previous models, I don't see a need to pay a third party extra.

<!-- gh-comment-id:2619404763 --> @globalcargo commented on GitHub (Jan 28, 2025): We've used deepseek's hosted API on their platform since they launched and it has worked reliably for all previous models, I don't see a need to pay a third party extra.
Author
Owner

@pedayako commented on GitHub (Jan 28, 2025):

I'm pretty sure. I think the best solution is to just wait until the services are working well again.

<!-- gh-comment-id:2619420097 --> @pedayako commented on GitHub (Jan 28, 2025): I'm pretty sure. I think the best solution is to just wait until the services are working well again.
Author
Owner

@zhuofengli commented on GitHub (Jan 28, 2025):

We already use max_token as part of our api submit - makes no difference we get the " Expecting value: line 5 column 1 (char 4)" error on api calls both to V3 and R1. That said, platform api for both models worked perfectly fine until Sunday night (before media hysteria started), so hoping this is a ddos related issue and will resolve.

When I set max_token to a low number like 300, it works, but not for a high number like 4000

<!-- gh-comment-id:2620195424 --> @zhuofengli commented on GitHub (Jan 28, 2025): > We already use `max_token` as part of our api submit - makes no difference we get the " Expecting value: line 5 column 1 (char 4)" error on api calls both to V3 and R1. That said, platform api for both models worked perfectly fine until Sunday night (before media hysteria started), so hoping this is a ddos related issue and will resolve. When I set max_token to a low number like 300, it works, but not for a high number like 4000
Author
Owner

@devanshg03 commented on GitHub (Jan 29, 2025):

I seem to have the same issue regardless of my setting for max_tokens or even if I exclude it. Even using their official python example below. I wonder if there isn't proper error handling on the server side, and thus, it doesn't decode properly when there is an error?

from dotenv import load_dotenv
import os

from openai import OpenAI
load_dotenv()

client = OpenAI(api_key=os.getenv("DEEPSEEK_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": "Hello"},
    ],
    stream=False,
    max_token=300
)

print(response.choices[0].message.content)
<!-- gh-comment-id:2620383808 --> @devanshg03 commented on GitHub (Jan 29, 2025): I seem to have the same issue regardless of my setting for `max_tokens` or even if I exclude it. Even using their official python example below. I wonder if there isn't proper error handling on the server side, and thus, it doesn't decode properly when there is an error? ``` from dotenv import load_dotenv import os from openai import OpenAI load_dotenv() client = OpenAI(api_key=os.getenv("DEEPSEEK_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": "Hello"}, ], stream=False, max_token=300 ) print(response.choices[0].message.content) ```
Author
Owner

@pedayako commented on GitHub (Jan 29, 2025):

I think there's nothing wrong with your code. The model's reasoning seems to have an issue since the attacks. If you try with the chat model, it will probably work well.

<!-- gh-comment-id:2622527669 --> @pedayako commented on GitHub (Jan 29, 2025): I think there's nothing wrong with your code. The model's reasoning seems to have an issue since the attacks. If you try with the chat model, it will probably work well.
Author
Owner

@globalcargo commented on GitHub (Jan 30, 2025):

As of right now both models (V3 and R-1) seems to be back online again and working via the platform API. No more JSONDecodeError. We did not modify our code. So this seems to confirm what others have posited, that this was an issue related to the attacks. Feel free to close this issue for now.

<!-- gh-comment-id:2623343488 --> @globalcargo commented on GitHub (Jan 30, 2025): As of right now both models (V3 and R-1) seems to be back online again and working via the platform API. No more JSONDecodeError. We did not modify our code. So this seems to confirm what others have posited, that this was an issue related to the attacks. Feel free to close this issue for now.
Author
Owner

@zhangzx-uiuc commented on GitHub (Jan 30, 2025):

I still get JSONDecodeError occasionally..

<!-- gh-comment-id:2625359340 --> @zhangzx-uiuc commented on GitHub (Jan 30, 2025): I still get JSONDecodeError occasionally..
Author
Owner

@lsjlsj5846 commented on GitHub (Jan 31, 2025):

I also get JSONDecodeError now; setting max_tokens does not help fixing this issue.

<!-- gh-comment-id:2626624324 --> @lsjlsj5846 commented on GitHub (Jan 31, 2025): I also get JSONDecodeError now; setting `max_tokens` does not help fixing this issue.
Author
Owner

@kenshiro-o commented on GitHub (Feb 4, 2025):

Same issue here. It may be due to the unexpected high load their servers have been under for a while...
Worth checking again in a few days

<!-- gh-comment-id:2632907690 --> @kenshiro-o commented on GitHub (Feb 4, 2025): Same issue here. It may be due to the unexpected high load their servers have been under for a while... Worth checking again in a few days
Author
Owner

@reyynaldi commented on GitHub (Feb 5, 2025):

its kinda weird to say but im glad everyone got the same problem too 😭 i thought its just me. Ya i hope everythings going to work like they used to be again. Anyway, ive tried using openrouter api for deepseek (both reasoner and chat model), while it works, its annoyingly slow, like one simple prompt could take like 40s second. crazy.

<!-- gh-comment-id:2636317894 --> @reyynaldi commented on GitHub (Feb 5, 2025): its kinda weird to say but im glad everyone got the same problem too 😭 i thought its just me. Ya i hope everythings going to work like they used to be again. Anyway, ive tried using openrouter api for deepseek (both reasoner and chat model), while it works, its annoyingly slow, like one simple prompt could take like 40s second. crazy.
Author
Owner

@liuhanzuo commented on GitHub (Feb 6, 2025):

I think that the problem is basically caused by the api platform. However, add a max_tokens indeed helps, but can not prevent the problem of connection error. Since the connection error is not that frequently, I think retry for several times would help

<!-- gh-comment-id:2638937544 --> @liuhanzuo commented on GitHub (Feb 6, 2025): I think that the problem is basically caused by the api platform. However, add a max_tokens indeed helps, but can not prevent the problem of connection error. Since the connection error is not that frequently, I think retry for several times would help
Author
Owner

@mc-brgb commented on GitHub (Feb 6, 2025):

Same issue here, first query would usually work then consistently get the JSON decoder error with both chat and reasoner model. It was working fine before the media attention.

<!-- gh-comment-id:2640275059 --> @mc-brgb commented on GitHub (Feb 6, 2025): Same issue here, first query would usually work then consistently get the JSON decoder error with both chat and reasoner model. It was working fine before the media attention.
Author
Owner

@globalcargo commented on GitHub (Feb 6, 2025):

We are observing the same thing whereby as the conversation history increases and thus input tokens increase, eventually after two or three turns the model will fail with the JSON decoder error. This happens for both the regular V3 as well as the R1 model.

<!-- gh-comment-id:2641220576 --> @globalcargo commented on GitHub (Feb 6, 2025): We are observing the same thing whereby as the conversation history increases and thus input tokens increase, eventually after two or three turns the model will fail with the JSON decoder error. This happens for both the regular V3 as well as the R1 model.
Author
Owner

@Junjie-Chu commented on GitHub (Feb 7, 2025):

Same problems here. I guess this is something due to high workload of their servers.

<!-- gh-comment-id:2641502652 --> @Junjie-Chu commented on GitHub (Feb 7, 2025): Same problems here. I guess this is something due to high workload of their servers.
Author
Owner

@pranavmalikk commented on GitHub (Feb 7, 2025):

Same problems here

<!-- gh-comment-id:2641756758 --> @pranavmalikk commented on GitHub (Feb 7, 2025): Same problems here
Author
Owner

@agoyang commented on GitHub (Feb 7, 2025):

I have encountered this problem for several consecutive days. It seems that the first few requests every day are fine, and then this error is reported all the time.

<!-- gh-comment-id:2641789876 --> @agoyang commented on GitHub (Feb 7, 2025): I have encountered this problem for several consecutive days. It seems that the first few requests every day are fine, and then this error is reported all the time.
Author
Owner

@zyuanat commented on GitHub (Feb 7, 2025):

response = client.chat.completions.create(
model="deepseek-chat",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hello"},
],
stream=False
)

The same problem persisted for days, with even the example request raising "raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)"

Occasionally it's normal, but most of the time it continues to report errors like this. Especially with multiple calls.

<!-- gh-comment-id:2641933626 --> @zyuanat commented on GitHub (Feb 7, 2025): response = client.chat.completions.create( model="deepseek-chat", messages=[ {"role": "system", "content": "You are a helpful assistant"}, {"role": "user", "content": "Hello"}, ], stream=False ) The same problem persisted for days, with even the example request raising "raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)" Occasionally it's normal, but most of the time it continues to report errors like this. Especially with multiple calls.
Author
Owner

@crescentluna commented on GitHub (Feb 7, 2025):

same problems, still don't work

<!-- gh-comment-id:2642034794 --> @crescentluna commented on GitHub (Feb 7, 2025): same problems, still don't work
Author
Owner

@hpclass commented on GitHub (Feb 7, 2025):

我也遇到同样的问题,使用https://api.deepseek.com/v1进行请求的时候间歇性抛出”line 1 column 1 (char 0)“,也有能正常返回结果的时候,使用第三方代理API则正常,怀疑是服务器有问题。。。

<!-- gh-comment-id:2642055892 --> @hpclass commented on GitHub (Feb 7, 2025): 我也遇到同样的问题,使用https://api.deepseek.com/v1进行请求的时候间歇性抛出”line 1 column 1 (char 0)“,也有能正常返回结果的时候,使用第三方代理API则正常,怀疑是服务器有问题。。。
Author
Owner

@yulijia commented on GitHub (Feb 7, 2025):

I am an international user, I got the line 1 column 1 (char 0) error every minute today.

<!-- gh-comment-id:2642220027 --> @yulijia commented on GitHub (Feb 7, 2025): I am an international user, I got the line 1 column 1 (char 0) error every minute today.
Author
Owner

@baocai27 commented on GitHub (Feb 8, 2025):

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
same problem QAQ

<!-- gh-comment-id:2644567540 --> @baocai27 commented on GitHub (Feb 8, 2025): JSONDecodeError: Expecting value: line 1 column 1 (char 0) same problem QAQ
Author
Owner

@mc-brgb commented on GitHub (Feb 8, 2025):

It seems to be working way better today, I did not get any error so far

<!-- gh-comment-id:2645896000 --> @mc-brgb commented on GitHub (Feb 8, 2025): It seems to be working way better today, I did not get any error so far
Author
Owner

@yulijia commented on GitHub (Feb 8, 2025):

I run my script using Colab and try to ask Deepseek one question each minute. I received the first 5 answers without error, but after 5 answers, it returned the error.

<!-- gh-comment-id:2645970154 --> @yulijia commented on GitHub (Feb 8, 2025): I run my script using Colab and try to ask Deepseek one question each minute. I received the first 5 answers without error, but after 5 answers, it returned the error.
Author
Owner

@pranavmalikk commented on GitHub (Feb 9, 2025):

This works for a slightly longer time period, but i still received the error several times eventually after running my script for a few hours.

<!-- gh-comment-id:2646036051 --> @pranavmalikk commented on GitHub (Feb 9, 2025): This works for a slightly longer time period, but i still received the error several times eventually after running my script for a few hours.
Author
Owner

@pythonbabaa commented on GitHub (Feb 11, 2025):

Consistently getting the JSON decoder error line 1. Makes me frustrated.

<!-- gh-comment-id:2651825064 --> @pythonbabaa commented on GitHub (Feb 11, 2025): Consistently getting the JSON decoder error line 1. Makes me frustrated.
Author
Owner

@xpfeifei commented on GitHub (Feb 13, 2025):

虽然json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 每次调用时都会报这个问题 ,但是添加了 max_tokens=300后 调用就正常了 没有这个错误出现了

<!-- gh-comment-id:2655627801 --> @xpfeifei commented on GitHub (Feb 13, 2025): 虽然json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 每次调用时都会报这个问题 ,但是添加了 max_tokens=300后 调用就正常了 没有这个错误出现了
Author
Owner

@baocai27 commented on GitHub (Feb 13, 2025):

虽然json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 每次调用时都会报这个问题 ,但是添加了 max_tokens=300后 调用就正常了 没有这个错误出现了

Yep, if you set the max_token a small number, the condition will relax. But once the max_tokens is bigger, this error will appear again

<!-- gh-comment-id:2655635578 --> @baocai27 commented on GitHub (Feb 13, 2025): > 虽然json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 每次调用时都会报这个问题 ,但是添加了 max_tokens=300后 调用就正常了 没有这个错误出现了 Yep, if you set the max_token a small number, the condition will relax. But once the max_tokens is bigger, this error will appear again
Author
Owner

@pythonbabaa commented on GitHub (Feb 13, 2025):

虽然json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 每次调用时都会报这个问题 ,但是添加了 max_tokens=300后 调用就正常了 没有这个错误出现了

Yep, if you set the max_token a small number, the condition will relax. But once the max_tokens is bigger, this error will appear again

Getting same (empty) response even after setting max_tokens = 300

<!-- gh-comment-id:2657257416 --> @pythonbabaa commented on GitHub (Feb 13, 2025): > > 虽然json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 每次调用时都会报这个问题 ,但是添加了 max_tokens=300后 调用就正常了 没有这个错误出现了 > > Yep, if you set the max_token a small number, the condition will relax. But once the max_tokens is bigger, this error will appear again Getting same (empty) response even after setting max_tokens = 300
Author
Owner

@link89 commented on GitHub (Feb 14, 2025):

I am pretty sure that there are some gateways in DeepSeek's backend servers have a timeout of 60s . For a request that takes more than 60s , for example, too many tokens to generate, will hit the timeout limit and return with empty content.

2025-02-14 11:45:37,243 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK"
2025-02-14 11:46:37,239 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2025-02-14 11:46:37,614 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK"
2025-02-14 11:47:37,627 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2025-02-14 11:47:37,962 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK"

I think deepseek should increase this timeout to, for example 120s, to reduce the chance of such error.

By the way, add the following prompt can alleviate the issue to some extent. Like solving 90% of the failure cases in my test.

Provide your final answer in a concise manner without showing any internal reasoning or chain-of-thought. Only output the final result.

<!-- gh-comment-id:2658315538 --> @link89 commented on GitHub (Feb 14, 2025): I am pretty sure that there are some gateways in DeepSeek's backend servers have a timeout of 60s . For a request that takes more than 60s , for example, too many tokens to generate, will hit the timeout limit and return with empty content. ``` log 2025-02-14 11:45:37,243 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK" 2025-02-14 11:46:37,239 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 2025-02-14 11:46:37,614 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK" 2025-02-14 11:47:37,627 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) 2025-02-14 11:47:37,962 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK" ``` I think deepseek should increase this timeout to, for example 120s, to reduce the chance of such error. By the way, add the following prompt can alleviate the issue to some extent. Like solving 90% of the failure cases in my test. **Provide your final answer in a concise manner without showing any internal reasoning or chain-of-thought. Only output the final result.**
Author
Owner

@pythonbabaa commented on GitHub (Feb 14, 2025):

I am pretty sure that there are some gateways in DeepSeek's backend servers have a timeout of 60s . For a request that takes more than 60s , for example, too many tokens to generate, will hit the timeout limit and return with empty content.

2025-02-14 11:45:37,243 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK"
2025-02-14 11:46:37,239 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2025-02-14 11:46:37,614 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK"
2025-02-14 11:47:37,627 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2025-02-14 11:47:37,962 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK"

I think deepseek should increase this timeout to, for example 120s, to reduce the chance of such error.

By the way, add the following prompt can alleviate the issue to some extent. Like solving 90% of the failure cases in my test.

Provide your final answer in a concise manner without showing any internal reasoning or chain-of-thought. Only output the final result.

Despite this how can we deploy such system in production if there is even one empty response.

<!-- gh-comment-id:2659497274 --> @pythonbabaa commented on GitHub (Feb 14, 2025): > I am pretty sure that there are some gateways in DeepSeek's backend servers have a timeout of 60s . For a request that takes more than 60s , for example, too many tokens to generate, will hit the timeout limit and return with empty content. > > ``` > 2025-02-14 11:45:37,243 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK" > 2025-02-14 11:46:37,239 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) > 2025-02-14 11:46:37,614 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK" > 2025-02-14 11:47:37,627 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) > 2025-02-14 11:47:37,962 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK" > ``` > > I think deepseek should increase this timeout to, for example 120s, to reduce the chance of such error. > > By the way, add the following prompt can alleviate the issue to some extent. Like solving 90% of the failure cases in my test. > > **Provide your final answer in a concise manner without showing any internal reasoning or chain-of-thought. Only output the final result.** Despite this how can we deploy such system in production if there is even one empty response.
Author
Owner

@KhalylDammas commented on GitHub (Feb 19, 2025):

I am pretty sure that there are some gateways in DeepSeek's backend servers have a timeout of 60s . For a request that takes more than 60s , for example, too many tokens to generate, will hit the timeout limit and return with empty content.

2025-02-14 11:45:37,243 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK"
2025-02-14 11:46:37,239 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2025-02-14 11:46:37,614 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK"
2025-02-14 11:47:37,627 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2025-02-14 11:47:37,962 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK"

I think deepseek should increase this timeout to, for example 120s, to reduce the chance of such error.

By the way, add the following prompt can alleviate the issue to some extent. Like solving 90% of the failure cases in my test.

Provide your final answer in a concise manner without showing any internal reasoning or chain-of-thought. Only output the final result.

Absolutely, instead of returning time-out error code, deepseek API returns 200 OK, paired with an empty response,
and since, openai api python package (as per my research) casts the response to a json response.json() while the response is empty, that's where the issue originates.

In the end of the day, we have nothing to do until Deepseek lift their Degraded Performance protective measures from their API...

<!-- gh-comment-id:2668699043 --> @KhalylDammas commented on GitHub (Feb 19, 2025): > I am pretty sure that there are some gateways in DeepSeek's backend servers have a timeout of 60s . For a request that takes more than 60s , for example, too many tokens to generate, will hit the timeout limit and return with empty content. > > ``` > 2025-02-14 11:45:37,243 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK" > 2025-02-14 11:46:37,239 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) > 2025-02-14 11:46:37,614 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK" > 2025-02-14 11:47:37,627 json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) > 2025-02-14 11:47:37,962 httpx: HTTP Request: POST https://api.deepseek.com/chat/completions "HTTP/1.1 200 OK" > ``` > > I think deepseek should increase this timeout to, for example 120s, to reduce the chance of such error. > > By the way, add the following prompt can alleviate the issue to some extent. Like solving 90% of the failure cases in my test. > > **Provide your final answer in a concise manner without showing any internal reasoning or chain-of-thought. Only output the final result.** Absolutely, instead of returning time-out error code, `deepseek API` returns 200 OK, paired with an empty response, and since, openai api python package (as per my research) casts the response to a json `response.json()` while the response is empty, that's where the issue originates. In the end of the day, we have nothing to do until Deepseek lift their `Degraded Performance` protective measures from their API...
Author
Owner

@kirby-jack commented on GitHub (Mar 5, 2025):

Im also getting this issue for a seemingly simple request.

<!-- gh-comment-id:2701208596 --> @kirby-jack commented on GitHub (Mar 5, 2025): Im also getting this issue for a seemingly simple request.
Author
Owner

@github-actions[bot] commented on GitHub (Apr 11, 2025):

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!

<!-- gh-comment-id:2795466070 --> @github-actions[bot] commented on GitHub (Apr 11, 2025): 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!
Author
Owner

@Mor-Li commented on GitHub (Apr 25, 2025):

一样的问题,我最近两天一直遇到,应该就是思考token过多了 然后每隔10min他就会强制给我断掉然后出现json decode error

<!-- gh-comment-id:2829564438 --> @Mor-Li commented on GitHub (Apr 25, 2025): 一样的问题,我最近两天一直遇到,应该就是思考token过多了 然后每隔10min他就会强制给我断掉然后出现json decode error
Author
Owner

@github-actions[bot] commented on GitHub (Jun 14, 2025):

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!

<!-- gh-comment-id:2972009182 --> @github-actions[bot] commented on GitHub (Jun 14, 2025): 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!
Author
Owner

@github-actions[bot] commented on GitHub (Jun 29, 2025):

false

<!-- gh-comment-id:3016175066 --> @github-actions[bot] commented on GitHub (Jun 29, 2025): false
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
deepseek-ai/DeepSeek-R1#77
No description provided.