Fix-first incident patcher for AI API issues - diagnose streaming, retries, cost, and traceability problems
npm install ai-patchFix AI API issues in under 60 seconds - diagnose streaming, retries, cost, and traceability problems


AI Patch Doctor is a command-line tool that helps developers diagnose and fix common AI API issues quickly. It provides interactive diagnostics for OpenAI, Anthropic Claude, Google Gemini, and any OpenAI-compatible API.
``bashNo installation needed - use npx
npx ai-patch doctor
✨ Key Features
- 4 Core Diagnostics: Streaming, Retries, Cost, and Traceability checks
- Multi-Provider Support: OpenAI, Anthropic, Gemini, and OpenAI-compatible APIs
- Interactive Mode: Simple 2-question flow to get started
- Auto-Detection: Automatically detects API configuration from environment
- Detailed Reports: JSON and Markdown reports with specific fix recommendations
🔬 What It Checks
1. Streaming Check - SSE stalls, buffering issues, partial output problems
2. Retries Check - Rate limit storms, retry chaos, exponential backoff
3. Cost Check - Token spikes, unbounded requests, cost optimization
4. Traceability Check - Request IDs, correlation tracking, duplicate detection
💻 Usage
`bash
Interactive mode (recommended)
ai-patch doctorRun specific check
ai-patch doctor --target=streamingRun all checks
ai-patch doctor --target=all
`📖 Full Documentation
For complete documentation, examples, and advanced usage, visit:
- GitHub Repository: github.com/michaelbrinkworth/ai-patch-doctor
- Issue Tracker: github.com/michaelbrinkworth/ai-patch-doctor/issues
📦 Publishing to npm
From the
node/ directory:1. Log in to npm (one-time per machine):
`bash
npm login
`
Use your npm username, password, and (if enabled) OTP.2. Bump version (if you want a new release):
`bash
npm version patch # 0.1.4 → 0.1.5
# or: npm version minor # 0.1.4 → 0.2.0
# or: npm version major # 0.1.4 → 1.0.0
`3. Publish:
`bash
npm publish
`
prepublishOnly runs npm run build automatically, so the latest TypeScript is compiled before publish.First time? Ensure the package name
ai-patch is available on npm (or use a scoped name like @your-org/ai-patch and npm publish --access public` for unscoped installs).MIT License - see LICENSE file for details.
---
Run the doctor. Fix your AI API. ⚕️