>>>
Focused Tool · Apache 2.0 · Single Binary

See what your APIs actually cost, by route.

Reverse proxy that records what each API endpoint costs. Daily spend breakdowns, per-route analysis, anomaly detection, and spend alerts. Works with Twilio, Stripe, OpenAI, or any HTTP API.

Running in under 60 seconds.

Install
curl -fsSL https://stockyard.dev/trough/install.sh | sh
Run
TROUGH_ADMIN_KEY=secret trough

  Proxy:   http://localhost:8790/proxy/{upstream_id}/...
  Spend:   http://localhost:8790/api/spend
  Export:  http://localhost:8790/api/export.csv
Register a service and add a cost rule
curl -s -X POST http://localhost:8790/api/upstreams \
  -H 'Authorization: Bearer secret' \
  -d '{"name":"twilio","base_url":"https://api.twilio.com"}'

curl -s -X POST http://localhost:8790/api/upstreams/{id}/rules \
  -d '{"path_pattern":"/2010-04-01/Accounts/*/Messages","cost_cents":79}'

# Route your app through Trough instead of calling Twilio directly
# http://localhost:8790/proxy/{id}/2010-04-01/...
Trough dashboard showing API spend by day, by endpoint, and anomaly detection
Trough spend summary output in the terminal

Trough shows you exactly which API routes are driving cost — before the invoice arrives.

Three things developers use this for.

Track Twilio / SendGrid spend
Sending SMS or email in bulk with no idea what it costs until the invoice. Set a per-request price in Trough and get daily cost breakdowns before the bill arrives.
Monitor internal service usage
Multiple apps hit one internal API. Trough tells you which app calls which endpoints most, what the latency looks like, and flags unusual spikes.
Set spend alerts before the billing cycle
Trough fires a webhook when daily or monthly spend crosses a threshold. Catch runaway usage before it shows up on an invoice.

Teams outgrow spreadsheet-based upstreams tracking around the same time they realize SaaS alternatives want $15 to $50 per seat per month. Trough is a single binary that handles the same job without the recurring bill.

Deploy Trough as a systemd service, a Docker container, or a bare process. It reads PORT and DATA_DIR. The /api/health endpoint returns status for monitoring.

A consultant keeps Trough running on a home server. Client upstreams stay on local disk, simplifying privacy in every contract.

Free to run. Pro when you need more.

Free
$0
forever, self-hosted
Best for: solo devs tracking one API
  • 1 monitored service
  • 10,000 requests / month
  • Daily cost summary
  • Provider and route breakdown
  • 7-day history
  • CSV export
  • Simple per-endpoint cost rules
Get started →
Pro
$2.99
per month
Best for: teams running multiple APIs
  • Unlimited services
  • Unlimited requests (fair use)
  • 90-day history
  • Anomaly detection on spend and volume
  • Hourly and daily spend trends
  • Per-route and per-provider drilldowns
  • Alert thresholds (daily / monthly)
  • Spend summary exports
  • Custom pricing rules per route
  • Read-only dashboard sharing

When Trough is the right tool.

Trough answers one question: which API endpoints are driving my spend? Free covers 1 service and 10,000 requests/month with 7-day history. Pro ($2.99/mo) unlocks unlimited services, 90-day history, anomaly detection, and spend alerts.

API cost monitor overview  ·  OpenAI spend tracking  ·  Find expensive routes

When you need the full LLM control plane.

Stockyard Platform
Trough is a standalone cost monitor from the Stockyard family. If you're building LLM applications and need per-request cost tracking across 16 providers, with model routing, prompt caching, and full request tracing built in — Stockyard is the full platform.
Learn about Stockyard →

How Pro gets activated.

When your payment goes through, you'll receive an email at the address you used at checkout. The email contains your license key — a string that starts with stockyard_.

Set it as an environment variable before starting Trough:

TROUGH_LICENSE_KEY=stockyard_your_key_here trough

  License:   Pro (your-email@example.com)
  Dashboard: http://localhost:8790/ui

That's it. Pro features unlock immediately on startup — no restart required after the first run, no account to log into, no phone-home check. The key is verified locally.

Didn't get the email?
Check your spam folder first. If it's not there after 5 minutes, email hello@stockyard.dev with your payment confirmation and we'll send the key manually.
Does Trough modify my requests?
No. It proxies requests unchanged and records metadata on the way through. The upstream never knows Trough is in the path.
How do cost rules work?
You define rules per service: HTTP method, path pattern (wildcards supported), and cost in cents. Trough matches each request to the first matching rule and records the cost.
What happens at the free request limit?
Trough logs a warning in the API response and startup banner when you're near the limit. Existing requests are never dropped. Upgrade to Pro to remove the cap.
Can I export cost data?
Yes. GET /api/export.csv returns a full request log as CSV. Pro adds spend summary exports and scheduled exports.
What's the license?
Apache 2.0. Free to use, modify, and deploy.

Know what your APIs cost before the invoice.

Single binary. Runs anywhere. Free to start.

Part of Stockyard Complete — all 150 tools for $29/mo