HackerTrans
TopNewTrendsCommentsPastAskShowJobs

gdhaliwal23

no profile record

Submissions

Show HN: Stop over-budget AI API calls per customer/feature (no proxy)

margindash.com
2 points·by gdhaliwal23·4 mesi fa·2 comments

Show HN: MarginDash – See which AI customers are profitable

margindash.com
1 points·by gdhaliwal23·5 mesi fa·1 comments

Show HN: MarginDash – See which AI customers are profitable

margindash.com
1 points·by gdhaliwal23·5 mesi fa·1 comments

comments

gdhaliwal23
·4 mesi fa·discuss
[dead]
gdhaliwal23
·4 mesi fa·discuss
[dead]
gdhaliwal23
·4 mesi fa·discuss
You're right that Langfuse and Helicone are retrospective — they show traces but don't roll up to "feature X costs $0.12/invocation." A middle ground that's worked: tag every API call with a feature ID during prototype runs and compute per-call cost from token counts using current pricing. Within a day or two of testing you have a real cost distribution per feature — enough to decide if the architecture is viable before building it out fully.

We open-sourced the cost calculation part for free: `ai-cost-calc` (PyPI and npm).

If you want to cap the budget you can also wrap your AI calls with a guarded call method, the budgets can be configured for customers and/or features on https://margindash.com
gdhaliwal23
·4 mesi fa·discuss
[dead]
gdhaliwal23
·4 mesi fa·discuss
I built MarginDash so teams can stop over-budget AI requests before they’re sent.

  What it does:
  - Set budgets at company, customer, and feature level
  - SDK checks budget first and blocks requests that exceed limits
  - Your app still calls OpenAI/Anthropic/etc directly (no proxy/gateway)
  - Prompts and outputs go directly between your app and the AI API provider
  - MarginDash only receives usage metadata (token counts)
  - TypeScript and Python SDKs
Flow: Checks limit you set for customer/feature -> sends AI call if within that limit -> records cost

I’d love feedback on any missing enforcement scope you’d need in production

Docs: https://margindash.com/documentation
gdhaliwal23
·5 mesi fa·discuss
Founder here. Gemini actually suggested I build this. I was brainstorming SaaS ideas and it pointed out the gap between AI cost tracking and revenue attribution. I dug into it, agreed, and built it.

The hardest part was the cost simulator. Comparing price-per-million-tokens across models is misleading — different models burn different amounts of tokens for the same task. So we normalize token counts to estimate what a swap would actually look like. When we recommend an alternative, we filter out anything that drops more than 10% on any benchmark or can't handle your context window size. Still improving this.

The SDK never sees your prompts or responses — just model name, token counts, and a customer ID. Limitations: simulator recommends from six vendors only, no custom/fine-tuned models, USD only.

Stack is Rails and Postgres. Happy to answer anything.
gdhaliwal23
·5 mesi fa·discuss
Founder here. Gemini actually suggested I build this. I was brainstorming SaaS ideas and it pointed out the gap between AI cost tracking and revenue attribution. I dug into it, agreed, and built it.

The hardest part was the cost simulator. Comparing price-per-million-tokens across models is misleading — different models burn different amounts of tokens for the same task. So we normalize token counts to estimate what a swap would actually look like. When we recommend an alternative, we filter out anything that drops more than 10% on any benchmark or can't handle your context window size. Still improving this.

The SDK never sees your prompts or responses — just model name, token counts, and a customer ID. Limitations: simulator recommends from six vendors only, no custom/fine-tuned models, USD only.

Stack is Rails and Postgres. Happy to answer anything.