Amp client fails with "unexpected EOF" when creating large files, while OpenAI-compatible clients succeed
Environment
- CLIProxyAPI Version: v6.6.25
- Amp Client Version: 0.0.1766031453 (VS Code extension)
- Upstream Provider: Antigravity
- Model: claude-opus-4-5-20251101
Problem Description
When using Amp client to create a single file with large content (240KB+ request body), the request hangs for a while and eventually fails with "unexpected EOF". However, using Roo Code client with the same upstream provider (Antigravity) via OpenAI-compatible interface (/v1/chat/completions) works successfully.
I also tested with my own Claude API key (direct Claude upstream), and encountered the same issue - Amp client fails with EOF while OpenAI-compatible clients work.
Reproduction Steps
- Use Amp client (VS Code) connected to CLIProxyAPI
- Request the AI to create a single file with large content
- Wait for the response stream
- Stream starts successfully, but suddenly terminates with "unexpected EOF"
Request/Response Log
Request Info: URL: /api/provider/anthropic/v1/messages Method: POST Content-Length: 246927 (~241KB) X-Stainless-Timeout: 600 Model: claude-opus-4-5-20251101
Upstream API Calls: 1st attempt: https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:streamGenerateContent → Status: 429 (RESOURCE_EXHAUSTED)
2nd attempt: https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent → Status: 200 OK, streaming starts...
Streaming Response (partial): data: {"response": {"candidates": [{"content": {"parts": [{"text": ""}]}}]...}} data: {"response": {"candidates": [{"content": {"parts": [{"text": ""}]}}]...}} ... (more chunks) data: {"response": {"candidates": [{"content": {"parts": [{"text": " "}]}}]...}} Error: unexpected EOF
Final Response to Amp Client: Status: 500 event: error data: {"type":"error","error":{"type":"api_error","message":"unexpected EOF"}}
Key Observations
Client | API Path | Format | Result Amp | /api/provider/anthropic/v1/messages | Claude SSE | Fails with EOF Roo Code | /v1/chat/completions | OpenAI SSE | Success
Both paths use the same AntigravityExecutor to call Google Cloud Code PA API, and I confirmed this also happens with direct Claude upstream (not just Antigravity).
Possible Causes
The Amp path goes through FallbackHandler which performs io.ReadAll on the entire request body (~241KB) before forwarding. This may introduce additional latency or connection issues compared to the OpenAI path which does not use FallbackHandler.
After troubleshooting, the issue appears to be with amp code itself.
I also encountered this issue. Is there a solution or an official response?