[GH-ISSUE #136] API Request failed with invalid json response body #114

Closed
opened 2026-10-26 21:14:31 +00:00 by bsakaguchi · 22 comments
Owner

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

looks like https://github.com/deepseek-ai/DeepSeek-V3/issues/407

      const completion = await this.client.chat.completions.create(
        {
          messages: [{ role: 'user', content: prompt(type, name, comments) }],
          model: this.model, // deepseek-reasoner
        },
        {
          signal: controller.signal,
        },
      )

most time return an error

invalid json response body at https://api.deepseek.com/v1/chat/completions reason: Unexpected end of JSON input

some time works correct

Originally created by @undownding on GitHub (Jan 29, 2025). Original GitHub issue: https://github.com/deepseek-ai/DeepSeek-R1/issues/136 looks like https://github.com/deepseek-ai/DeepSeek-V3/issues/407 ```typescript const completion = await this.client.chat.completions.create( { messages: [{ role: 'user', content: prompt(type, name, comments) }], model: this.model, // deepseek-reasoner }, { signal: controller.signal, }, ) ``` most time return an error ``` invalid json response body at https://api.deepseek.com/v1/chat/completions reason: Unexpected end of JSON input ``` some time works correct
bsakaguchi 2026-10-26 21:14:31 +00:00
Author
Owner

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

Same here!

invalid json response body at https://api.deepseek.com/v1/chat/completions reason: Unexpected end of JSON input

<!-- gh-comment-id:2621692382 --> @robertalers commented on GitHub (Jan 29, 2025): Same here! invalid json response body at https://api.deepseek.com/v1/chat/completions reason: Unexpected end of JSON input
Author
Owner

@Tekholms-LW commented on GitHub (Jan 29, 2025):

Same here and most of the time things just timeout. Sometimes the chat model works but I mostly get the same issue invalid json response body" for both

<!-- gh-comment-id:2621801035 --> @Tekholms-LW commented on GitHub (Jan 29, 2025): Same here and most of the time things just timeout. Sometimes the chat model works but I mostly get the same issue invalid json response body" for both
Author
Owner

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

All free/cheap models are have problems from time to time. Google gemini now:
[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-thinking-exp-01-21:streamGenerateContent?alt=sse: [429 Too Many Requests]

<!-- gh-comment-id:2622271057 --> @saintserge commented on GitHub (Jan 29, 2025): All free/cheap models are have problems from time to time. Google gemini now: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-thinking-exp-01-21:streamGenerateContent?alt=sse: [429 Too Many Requests]
Author
Owner

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

getting the same error

<!-- gh-comment-id:2623330587 --> @yarusl42 commented on GitHub (Jan 30, 2025): getting the same error
Author
Owner

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

It is not supported by the deepseek-reasoner model so far.

<!-- gh-comment-id:2623362549 --> @hanifsajid commented on GitHub (Jan 30, 2025): It is not supported by the `deepseek-reasoner` model so far.
Author
Owner

@jhonathas commented on GitHub (Feb 1, 2025):

The same thing happens here. I'm having to set a waiting time before each use to mitigate the problem a little.

<!-- gh-comment-id:2628940988 --> @jhonathas commented on GitHub (Feb 1, 2025): The same thing happens here. I'm having to set a waiting time before each use to mitigate the problem a little.
Author
Owner

@martasvana commented on GitHub (Feb 2, 2025):

Anyone found a solution? Or is it just a problem on DeepSeek's side, that we have no chance to fix ourselves?
Thanks!

<!-- gh-comment-id:2629379070 --> @martasvana commented on GitHub (Feb 2, 2025): Anyone found a solution? Or is it just a problem on DeepSeek's side, that we have no chance to fix ourselves? Thanks!
Author
Owner

@erdemyunsel commented on GitHub (Feb 3, 2025):

same error.

"invalid json response body at https://api.deepseek.com/chat/completions reason: Unexpected end of JSON input"

<!-- gh-comment-id:2631026801 --> @erdemyunsel commented on GitHub (Feb 3, 2025): same error. "invalid json response body at https://api.deepseek.com/chat/completions reason: Unexpected end of JSON input"
Author
Owner

@Guiguerreiro39 commented on GitHub (Feb 4, 2025):

How am I not seeing more people complaining about this? I'm getting this error pretty much every day. I'm using openai package in nodejs

<!-- gh-comment-id:2632590613 --> @Guiguerreiro39 commented on GitHub (Feb 4, 2025): How am I not seeing more people complaining about this? I'm getting this error pretty much every day. I'm using openai package in nodejs
Author
Owner

@Chasen-Zhang commented on GitHub (Feb 5, 2025):

getting the same error

<!-- gh-comment-id:2636130177 --> @Chasen-Zhang commented on GitHub (Feb 5, 2025): getting the same error
Author
Owner

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

Yes, exactly. I've switched to an OpenAI model in the API for now, and will
wait a couple weeks maybe till the boom around DeepSeek cools down a bit
and they upgrade their servers and implement some basic security features,
haha. And then switch back to DeepSeek in my API.

On Tue, Feb 4, 2025, 03:03 Guilherme Guerreiro @.***>
wrote:

How am I not seeing more people complaining about this? I'm getting this
error pretty much every day. I'm using openai package in nodejs

—
Reply to this email directly, view it on GitHub
https://github.com/deepseek-ai/DeepSeek-R1/issues/136#issuecomment-2632590613,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/BC4SHO4KGYVG6LEZKML3HD32OANVNAVCNFSM6AAAAABWB5Y37SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMZSGU4TANRRGM
.
You are receiving this because you commented.Message ID:
@.***>

<!-- gh-comment-id:2636139263 --> @martasvana commented on GitHub (Feb 5, 2025): Yes, exactly. I've switched to an OpenAI model in the API for now, and will wait a couple weeks maybe till the boom around DeepSeek cools down a bit and they upgrade their servers and implement some basic security features, haha. And then switch back to DeepSeek in my API. On Tue, Feb 4, 2025, 03:03 Guilherme Guerreiro ***@***.***> wrote: > How am I not seeing more people complaining about this? I'm getting this > error pretty much every day. I'm using openai package in nodejs > > — > Reply to this email directly, view it on GitHub > <https://github.com/deepseek-ai/DeepSeek-R1/issues/136#issuecomment-2632590613>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/BC4SHO4KGYVG6LEZKML3HD32OANVNAVCNFSM6AAAAABWB5Y37SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMZSGU4TANRRGM> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

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

invalid json response body at https://api.deepseek.com/v1/chat/completions reason: Unexpected end of JSON input
😓

<!-- gh-comment-id:2649710816 --> @AndiBird commented on GitHub (Feb 11, 2025): invalid json response body at https://api.deepseek.com/v1/chat/completions reason: Unexpected end of JSON input 😓
Author
Owner

@Ritavdas commented on GitHub (Feb 12, 2025):

Facing the same issues, I am pushing 6-10 API requests at once, most of them fail, only works when I send one at a time.
Even the deepseek-coder one is giving the same problem

<!-- gh-comment-id:2654431593 --> @Ritavdas commented on GitHub (Feb 12, 2025): Facing the same issues, I am pushing 6-10 API requests at once, most of them fail, only works when I send one at a time. Even the deepseek-coder one is giving the same problem
Author
Owner

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

Facing the same issue. 😢

<!-- gh-comment-id:2658623123 --> @tolerious commented on GitHub (Feb 14, 2025): Facing the same issue. 😢
Author
Owner

@Joonas12334 commented on GitHub (Feb 16, 2025):

So it seems like a their issue? I have a 80% chance of getting it while using the api. Sometimes it works fine tho.

<!-- gh-comment-id:2661447233 --> @Joonas12334 commented on GitHub (Feb 16, 2025): So it seems like a their issue? I have a 80% chance of getting it while using the api. Sometimes it works fine tho.
Author
Owner

@AndiBird commented on GitHub (Feb 16, 2025):

So it seems like a their issue? I have a 80% chance of getting it while using the api. Sometimes it works fine tho.

Yes, @Joonas12334 , sometimes it works, but it's awful because you never know when it's going to fail. That's why, even though ChatGPT's API is expensive, it offers much more reliability.

<!-- gh-comment-id:2661456739 --> @AndiBird commented on GitHub (Feb 16, 2025): > So it seems like a their issue? I have a 80% chance of getting it while using the api. Sometimes it works fine tho. Yes, @Joonas12334 , sometimes it works, but it's awful because you never know when it's going to fail. That's why, even though ChatGPT's API is expensive, it offers much more reliability.
Author
Owner

@Joonas12334 commented on GitHub (Feb 16, 2025):

I just switched to google gemini. It's also fantastic if guided well. Also damn. It's really fast compared to deepseek. Howerver still eager to try out deepseek more when it becomes actually usable (if that ever happens)

<!-- gh-comment-id:2661459644 --> @Joonas12334 commented on GitHub (Feb 16, 2025): I just switched to google gemini. It's also fantastic if guided well. Also damn. It's really fast compared to deepseek. Howerver still eager to try out deepseek more when it becomes actually usable (if that ever happens)
Author
Owner

@AndiBird commented on GitHub (Feb 16, 2025):

X2, bro

<!-- gh-comment-id:2661460329 --> @AndiBird commented on GitHub (Feb 16, 2025): X2, bro
Author
Owner

@kimkong88 commented on GitHub (Feb 20, 2025):

their service status suggests that api performance has been degraded.... will this ever get better?

<!-- gh-comment-id:2670920189 --> @kimkong88 commented on GitHub (Feb 20, 2025): their service status suggests that api performance has been degraded.... will this ever get better?
Author
Owner

@ltomov commented on GitHub (Feb 25, 2025):

They probably can't handle the load at that super low price.

It would be useful to at least output some better error, like "Server is temporary down", to prevent people from spending time, wondering if they can do something to fix it.

<!-- gh-comment-id:2681216176 --> @ltomov commented on GitHub (Feb 25, 2025): They probably can't handle the load at that super low price. It would be useful to at least output some better error, like "Server is temporary down", to prevent people from spending time, wondering if they can do something to fix it.
Author
Owner

@github-actions[bot] commented on GitHub (Apr 8, 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:2784901593 --> @github-actions[bot] commented on GitHub (Apr 8, 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 (May 9, 2025):

false

<!-- gh-comment-id:2864733530 --> @github-actions[bot] commented on GitHub (May 9, 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#114
No description provided.