今日已更新 69 条资讯 | 累计 20935 条内容
关于我们

I built a GitHub Action that reviews AI API costs on every PR — here's what it found in our own codebase

/u/Upbeat_Will_3342 2026年06月09日 00:04 3 次阅读 来源:Reddit r/webdev

Been building an AI-heavy app for a few months. No visibility into what our AI API calls were actually costing until the Anthropic bill arrived. So I built a GitHub Action that scans for AI usage on every PR and posts a cost analysis comment automatically. First thing it caught in our own codebase: server/services/divergence-detector.js was using claude-sonnet-4-6 with max_tokens=150 to generate 2-sentence explanations. Sonnet costs $15/M output tokens. Haiku costs $4/M. For a 2-sentence output there is zero quality difference. We were paying 3.75x more on every single call and nobody noticed. What it posts on every PR: 💰 Cost delta vs base branch ( "this PR adds +$44/month" ) ⚠️ Warnings for expensive model misuse with specific fix recommendations 🔁 Duplicate AI call patterns that should share a service layer 🔄 Missing retry/backoff logic that will crash under rate limits 💡 Prompt caching opportunities (up to 90% input cost reduction) Supports: Languages: JS, TS, JSX, TSX Providers: Anthropic · OpenAI · Google Gemini · AWS Bedrock · LangChain Zero dependencies · Free Add it to any repo in 2 minutes: - uses: kavyarani7/ai-arch-scanner@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} threshold: '500' 🔗 GitHub Marketplace 🔗 Repo Happy to answer questions about how it works or what patterns it detects. submitted by /u/Upbeat_Will_3342 [link] [留言]

本文内容来源于互联网,版权归原作者所有
查看原文