Settings

Theme

Show HN: Frugon – Find which LLM calls a cheaper model could handle (local, MIT)

github.com

26 points by jarodrh 2 days ago · 12 comments · 2 min read

Reader

I started leaning in on AI heavily this year, as I wanted to get more done autonomously, but then my token usage climbed dramatically to the point where my weekly quota would run out before the end of the week, sometimes a couple of days into the week.

I realised I had to do something about it else I'd have to double my spend. So I decided to start tracking my cost per task type. This revealed that a lot of my spend went to searches/scans or simple things like scouting tasks.

I then decided to turn this into a simple CLI tool that can be used to read your OpenAI-style logs locally, and analyze the cost and compare this spend to other models, then show you how much you could potentially save by switching those calls to a cheaper model.

When you run analyze you get an offline estimate priced against LiteLLM and gated by LMArena tiers. The general savings bands come from the research published by RouteLLM; but you can confirm this yourself using 2 commands --measure (shows the prompt-response output side by side) and --judge (a model chosen to do the comparisons). These send a sample of the prompts from the logs to the candidate models - either the default choice or set by you. This call goes directly to the model provider (never through me) as any normal LLM call would, and the response is shown and judged to either be better or worse or a tie.

It's deliberately small, because I tend to over complicate/think things sometimes: analyze + capture + a few commands, doing three jobs. Cost, quality visibility, routing recommendation.

Nothing is hosted. capture is an optional local proxy on your own machine, and there's no endpoint in the path of your data. You can confirm this by checking the source.

I included a demo so you can check out the output. It has a synthetic 56k call log (a month's worth) showing how costs can drop from $549.46 to $343.91 a month. A 37.4% saving.

Try it:

  uvx frugon analyze --demo
or

  uv tool install frugon
Then point it at your own logs.

All feedback is welcome, especially any on the routing/quality logic, or anything else, good or bad.

isadubois 16 hours ago

This looks super clean. I'm curious about the --judge command. How does it evaluate if the cheaper model's response is a "tie" or acceptable? Is it using a specific LLM-as-a-judge prompt template?

  • jarodrhOP 14 hours ago

    Thanks. Yes, that's exactly right, and aptly named so in the code.

    A few things to note: the prompt is actually deliberately tie-biased; the tie only then breaks on clear material differences: factual error, missing information the prompt requested, or just a complete failure to follow the instruction. The judge is explicitly told that response/output length, wording, style and formatting are not quality differences.

    To ensure there's no favouritism, the judge only sees the outputs (A and B), it never sees whether the output is from the current model or from the candidate; and to ensure no funny business occurs, the outputs for A and B are randomized.

    The default model is chosen automatically from the highest-tier model in the log, but this could invite self-bias (this is cautioned in the report output), so you can override this with --judge-model

    You can check out the prompt for yourself in src/frugon/measure.py - search: JUDGE_PROMPT_TEMPLATE

XUEYANZ 20 hours ago

Haha. somehow i just love the naming. it just makes sense :D

cyanydeez 21 hours ago

this would be more interesting as a local LLM anlysis; throw out all the costs, and figure out primary-subagent model architecture, and maximize token generation and prefill.

I don't see how anyone can operationalize this information.

  • jarodrhOP 16 hours ago

    That's an interesting thought, and one I'll take note of, but that would be a different tool. However, if you look hard enough I'd say we're tackling the same issue. I'm just choosing to look at the problem from a cost perspective as opposed to a raw token generation/prefill perspective. The mindset can be applied to both sides, but Frugon prices the cloud side.

    The end goal is essentially the same and your mind went to that point, "primary-subagent model architecture". This is what the tool helps you figure out. It's not there to hold your hand and explain what your architecture should be, as I wanted it to be a small simple tool that would give the user insight into triggering your exact thought process. The thought process of breaking down their tasks by type, mapping that to individual models regardless of app or dev tool, regardless of cloud or local (the thought process transfers). It shows the user that they could route a portion of their calls to a cheaper model. It's then up to the user to understand the task type and point those calls to different models.

    To directly answer the operationalization statement, it depends on what the call log is from (app/harness).

    If harness, then the direction would be to pin models per role per task type; the routing recommendation maps directly to that, and measure/judge allows you to verify this before switching.

    If app, then this is a similar shape as above, where you would then categorise and pin those calls identified in the recommendation to the model recommended, and as above, measure/judge allows you to verify before switching.

    You're proposing an optimisation for throughput whereas Frugon is for spend. Same issue, just different lens.

    • cyanydeez 3 hours ago

      yes, but $ is operationally useless since $ is model depenedent and as other articles currently on HN show, the model+harness are symbiotic or antagonistic; if you strip out the $ part of it, you can focus on the interdependence of Agent+subagent and you can evaluate that in a stricter sense because I would want to select the model+subagent that improves my outcomes instead of whicheere is cheapest. If you tell me this model has a 99% chance of succeeding at $10 and this one has a 50% chan

      • jarodrhOP 25 minutes ago

        You got cut off at the end, but I hear your point.

        I completely agree that cost-per-successful-outcome is the goal, and "cheapest" is never the entire solution, but only routing to the cheapest isn't what frugon does. If it did that, then it would just pick something like GPT-4.1-Nano (one of the current cheapest models regardless of quality) for everything, and it would be useless.

        The whole pipeline in frugon is predicated on quality tier gating. Frugon doesn't strip out quality. This is based on quality tiers from LMArena leaderboard data (CC-BY licensed). The easy/hard split only recommends routing calls predicted to survive the downgrade.

        > $ is operationally useless since $ is model depenedent

        > model+harness are symbiotic or antagonistic

        To these points, frugon gives you --measure (you can compare the outcomes yourself via prompt sampling from both models - current and candidate/recommended) and --judge (championing a model to determine whether the recommended/candidate model actually successfully holds the quality of the current model from the prompts sampled). The win/tie rate summary outputted by the judge tells you whether the candidates you're comparing preserve the outcome you're currently getting from the current model measured on your own prompts. So, if your model succeeds at the prompt and the candidate ties this (judge's verdict), then you've successfully evaluated that you can swap to a different model at a lower cost. It's measured on your task distribution as a quality confirmation of frugon's initial offline quality tier gating routing recommendation.

        Success rates are task-dependent, as every user prompts a model differently which could either get a successful outcome or a failure-doomed-to-retry outcome. No benchmark/table can tell you what your agent+subagent's odds of success are, unless all you do is pass an unaltered prompt that has been externally benchmarked. Hence why --measure and --judge exist. You must confirm the initial routing recommendation with your own evaluation (human/ai/evals)

        However, you have made me think of combining the initial dollar cost analysis with judge outcome as an "effective cost per judged success" metric...which is a great idea, as they are currently separated.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection