claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Input latency severely affected by API response times - typing becomes unusable during API slowdowns

Open burakyalti opened this issue 4 weeks ago • 6 comments

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When Anthropic API experiences slowdowns (even minor ones not reported on status page), keyboard input in Claude Code CLI becomes extremely slow. Each keystroke takes approximately 1 second to appear on screen.

This issue is particularly severe when:

  • Working on large codebases with extensive context
  • Using Opus model
  • During peak API usage hours (US business hours)
  • Sessions with long conversation history

The problem appears to be that Claude Code's Node.js event loop gets blocked when API responses are slow. Since keyboard input (stdin) runs on the same event loop, it gets affected even though input handling should be completely local and independent of API communication.

Confirmed this is NOT a system/network issue:

  • System Load: 0.4
  • Memory: 24GB available out of 31GB
  • Network latency: 0.6ms
  • Tested on multiple servers - same issue
  • Tested from different client machines - same issue
  • After exiting Claude Code, typing in same terminal is instant

What Should Happen?

Keyboard input should be processed locally and remain responsive regardless of API latency. The input buffer should be independent of the API communication layer.

User should be able to type messages at normal speed even when API is slow. The slowness should only affect the response generation, not the input experience.

Suggested fixes:

  1. Separate input handling into its own thread/worker
  2. Use non-blocking I/O for API communication
  3. Buffer user input locally, independent of API state

Error Messages/Logs

No error messages - the application continues to function, just with severe input lag.

  Diagnostic output:

  # Inside Claude Code session - typing "hello" takes ~5 seconds
  # Each character appears with ~1 second delay

  # Isolation test (same terminal, after exiting Claude Code):
  $ echo "test"
  # Types instantly - no delay

  # System resources during issue:
  $ uptime
   14:34:00 up 30 days, load average: 0.40, 0.35, 0.32

  $ free -h
                total        used        free      shared  buff/cache   available
  Mem:           31Gi       6.8Gi       4.4Gi        71Mi        20Gi        24Gi

  $ ps aux | grep node
  # Claude Code process running normally, no excessive CPU/memory

Steps to Reproduce

Steps to Reproduce

  1. Open Claude Code CLI: claude
  2. Work on a large project with many files (to build up context)
  3. Have a conversation with multiple back-and-forth messages
  4. Wait for API to experience any slowdown (often during US business hours)
  5. Try typing a new message
  6. Observe: each keystroke takes ~1 second to appear on screen
  7. Exit Claude Code with /quit
  8. Type in same terminal - observe instant response (proving it's not terminal/SSH issue)

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.72

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

No response

burakyalti avatar Dec 18 '25 12:12 burakyalti

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14413
  2. https://github.com/anthropics/claude-code/issues/12161
  3. https://github.com/anthropics/claude-code/issues/12182

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Dec 18 '25 12:12 github-actions[bot]

I'm experiencing the same issue on v2.0.72.

I've tested previous versions and confirmed that v2.0.71 is the last stable version where this bug does not occur.

Environment

  • OS/Platform: Windows 11 + WSL (Ubuntu)
  • Terminal: Cursor IDE terminal / standalone WSL console
  • Setup: Filesystem and installation are entirely within WSL

Symptoms

  • Severe input lag that scales with conversation context
  • Frequent API connection retry messages
  • Running /clear temporarily fixes the lag until the context builds up again

george7979 avatar Dec 18 '25 12:12 george7979

Downgrading to version 2.0.71 resolves the issue.

The input latency problem does not exist in version 2.0.71. This suggests a regression was introduced in a newer version.

Steps to downgrade:

npm install -g @anthropic-ai/[email protected]

To prevent auto-update (keeping the working version):

Add the following to ~/.claude/settings.json:

{
  "env": {
    "DISABLE_AUTOUPDATER": "1"
  }
}

Version comparison:

| Version          | Input Latency               |
|------------------|-----------------------------|
| Latest (current) | ~1 second per keystroke     |
| 2.0.71           | ✅ Normal, instant response |

This confirms the issue is a regression introduced after version 2.0.71, not an API-related problem as initially suspected.

burakyalti avatar Dec 18 '25 13:12 burakyalti

Can confirm same exact behavior. No issues on 2.0.71.

At beginning of session has very little noticeable lag. As the conversation continues the lag becomes increasing worse to the point it is unusable.

dmkenney avatar Dec 18 '25 14:12 dmkenney