Skip to content

After some time, the work starts to break down. #30

Closed

Description

@wertyBSd

After some time, the work starts to break down.
The proxy really works very well; I’m very satisfied, but after some time, problems start to occur (logs below). At the same time, the client that works with the proxy claims that everything is fine.
I’m using the FreeDeepseekAPI + Hermes agent combination.

[dev-agent/acct:account_1] Reusing session: 2ac6fbcf-932b-4949-857d-257a4ef54dcc (parent: 20, msg#10) [dev-agent] Got 1337 chars (+0 reasoning chars) in 6120ms (msg#11) [parseToolCall] No tool call match in 1337 chars [dev-agent] Streamed openai (tool=false) in 6120ms [dev-agent] Compacted upstream prompt 372213 -> 80000 chars [dev-agent/acct:account_1] Reusing session: 2ac6fbcf-932b-4949-857d-257a4ef54dcc (parent: 22, msg#11) [dev-agent] Got 1324 chars (+0 reasoning chars) in 6672ms (msg#12) [parseToolCall] fenced JSON.parse failed: Unexpected token 'c', "csharp pub"... is not valid JSON [parseToolCall] fenced JSON.parse failed: Unexpected token 'c', "csharp pub"... is not valid JSON [parseToolCall] inline JSON.parse failed: Expected property name or '}' in JSON at position 6 [parseToolCall] inline JSON.parse failed: Expected property name or '}' in JSON at position 6 [parseToolCall] No tool call match in 1324 chars [dev-agent] Streamed openai (tool=false) in 6672ms [dev-agent] Compacted upstream prompt 374159 -> 80000 chars [dev-agent/acct:account_1] Reusing session: 2ac6fbcf-932b-4949-857d-257a4ef54dcc (parent: 24, msg#12) [dev-agent] Got 4191 chars (+0 reasoning chars) in 12473ms (msg#13) [parseToolCall] fenced JSON.parse failed: Unexpected token 'A', "Assets\Scr"... is not valid JSON [parseToolCall] fenced JSON.parse failed: Unexpected token 'c', "csharp usi"... is not valid JSON [parseToolCall] inline JSON.parse failed: Expected property name or '}' in JSON at position 6 [parseToolCall] No tool call match in 4191 chars [dev-agent] Streamed openai (tool=false) in 12473ms

Activity

  1. atharvotech commented on Sep 6, 2026

    @atharvotech

    you may try our https://github.com/atharvotech/FreeDeepseekAPI-EN you may not recieve this error these coz the the token c was not in UTF-8 encoding fixed by me.

  2. wertyBSd commented on Sep 15, 2026

    @wertyBSd
    Author

    Я думаю проблема в другом, при долгой работе с чатом, сам Deepseek сбивается и начинает отвечать не по шаблону. будет время, я это перепроверю. Если это так, надо будет подумать как ему вправить мозги.

    не может же токен работать работать, а потом перестать

  3. wertyBSd commented on Sep 15, 2026

    @wertyBSd
    Author

    да, так и есть:
    {"tool_call":{"name":"read_files","arguments":{"files":[{"path":"c:\git\dsh-local-llm\src\index.ts","start_line":240,"end_line":350},{"path":"c:\git\dsh-local-llm\src\server-manager.ts"},{"path":"c:\git\dsh-local-llm\src\downloader.ts"}]}}

    такой ответ правильный как я понимаю:
    TOOL_CALL: read_files
    arguments: {"files":[{"path":"c:\git\dsh-local-llm\src\downloader.ts","start_line":83,"end_line":120},{"path":"c:\git\dsh-local-llm\src\server-manager.ts","start_line":90,"end_line":245},{"path":"c:\git\dsh-local-llm\src\ui-components\components\ModelManager.tsx"},{"path":"c:\git\dsh-local-llm\src\ui-components\index.tsx"},{"path":"c:\git\dsh-local-llm\README.md","start_line":1,"end_line":60}]}

  4. atharvotech commented on Sep 19, 2026

    @atharvotech

    English please

  5. dekrezz commented on Sep 21, 2026

    @dekrezz

    hey, i fixed this issue in my fork: https://github.com/dekrezz/FreeDeepseekAPI

    the problem was related to long-running sessions and tool-call parsing after prompt compaction. it should now handle this case properly.

    thanks a lot for reporting it and for the detailed logs, they were really helpful.

  6. wertyBSd commented on Sep 25, 2026

    @wertyBSd
    Author

    @dekrezz I’ve also made my fix) now I’m going to test it. ))

    But you’re right, the problem is exactly what you wrote about.

  7. wertyBSd commented on Sep 25, 2026

    @wertyBSd
    Author

    If don’t want to change the version or code of FreeDeepseekAPI, you can switch to another combination: FreeDeepseekAPI + VS Code + Cline — this will work.

  8. wertyBSd commented on Sep 25, 2026

    @wertyBSd
    Author

    @dekrezz In my changes, I also added small delays to avoid receiving messages saying “too many messages, try again.”

  9. dekrezz commented on Oct 1, 2026

    @dekrezz

    @dekrezz In my changes, I also added small delays to avoid receiving messages saying “too many messages, try again.”

    @wertyBSd Funny, I already had this covered. Why make every request wait when a rate-limited account can just step aside? On a 429, a "too many messages" 400, or rate_limit_reached, that login goes on cooldown and the request moves to the next one. It honors Retry-After and keeps one in-flight chat per login. There's a short pause before retries too.

    Check it yourself:

    😉

  10. ForgetMeAI commented on Oct 7, 2026

    @ForgetMeAI
    Owner

    Fixed in main (81374ae). Thanks for the detailed logs, they pointed straight at the cause.

    Root cause. When a DeepSeek chat was reused, the proxy re-sent the whole conversation (compacted to 80 000 chars) into the same chat on every turn. The chat's context grew quadratically, so after a dozen tool steps DeepSeek drifted off the tool-call format and started answering with plain code blocks. That matches your Compacted upstream prompt 372213 -> 80000 lines followed by No tool call match.

    What changed:

    • A reused chat now receives only the new messages (tool results, the next user turn) plus a short tool-format reminder.
    • A chat that grows past DEEPSEEK_MAX_SESSION_CHARS is replaced by a fresh chat with a compacted prompt.
    • The parser repairs raw Windows paths such as "c:\git\dsh-local-llm\src\index.ts" (your example) and raw newlines inside JSON arguments.
    • Code blocks in other languages (```csharp etc.) are never treated as tool calls.

    Verified against live DeepSeek with a 24-step tool session plus a final answer: context is kept, and work continues after a chat rollover. If it still happens on current main, please reopen with the server log.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions