frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Show HN: Llmswap – Python package to reduce LLM API costs by 50-90% with caching

https://pypi.org/project/llmswap
11•sreenathmenon•2h ago
I built llmswap to solve a problem I kept hitting in hackathons - burning through API credits while testing the same prompts repeatedly during development.

It's a simple Python package that provides a unified interface for OpenAI, Anthropic, Google Gemini, and local models (Ollama), with built-in response caching that can cut API costs by 50-90%.

Key features: - Intelligent caching with TTL and memory limits - Context-aware caching for multi-user apps - Auto-fallback between providers when one fails - Zero configuration - works with environment variables

  from llmswap import LLMClient

  client = LLMClient(cache_enabled=True)
  response = client.query("Explain quantum computing")
  # Second identical query returns from cache instantly (free)
The caching is disabled by default for security. When enabled, it's thread-safe and includes context isolation for multi-user applications.

Built this from components of a hackathon project. Already at 2.2k downloads on PyPI. Hope it helps others save on API costs during development.

GitHub: https://github.com/sreenathmmenon/llmswap PyPI: https://pypi.org/project/llmswap/

Comments

rav•1h ago
How is it "50-90%" savings? If a given application doesn't repeat its queries, surely there's nothing to save by caching the responses?
0points•38m ago
I hate to be that guy, but your AI should have suggested you used one of the off-the-shelf in-memory key-value databases.

The most popular probably being redis.

wasabi991011•31m ago
How does this compare to decorating with @functions.cache?

Jury Holds Meta Accountable in 'Landmark' Privacy Decision

https://www.bankinfosecurity.com/jury-holds-meta-accountable-in-landmark-privacy-decision-a-29115
3•dotcoma•4m ago•0 comments

Tell HN: Hacking AIs is similar to hacking humans

1•dvrp•4m ago•0 comments

Jonathan Edwards and the surrealness of holding a world record for 30 years

https://www.nytimes.com/athletic/6536384/2025/08/07/triple-jump-world-record-jonathan-edwards-1995-world-championships/
1•wslh•7m ago•1 comments

We Need More Databases

https://danthegoodman.substack.com/p/we-need-more-databases
1•dangoodmanUT•7m ago•0 comments

"Junk" Proteins May Fuel Adaptation

https://nautil.us/these-junk-proteins-may-fuel-adaptation-1227370/
1•marojejian•8m ago•1 comments

Speakr: Self-hosted web application designed for transcribing audio recordings

https://github.com/murtaza-nasir/speakr
1•indigodaddy•8m ago•0 comments

Show HN: Mcp-db – session and event store for MCP; & distributed scaling sample

https://github.com/bh-rat/mcp-db
1•bharatgel•12m ago•0 comments

Lawyers Are Earning $30M and Billing Rates Are Soaring

https://www.bloomberg.com/opinion/articles/2025-08-06/lawyers-are-earning-30-million-and-billing-rates-are-soaring
1•gwintrob•13m ago•0 comments

Reflections on Neuralese

https://www.lesswrong.com/posts/qehggwKRMEyWqvjZG/reflections-on-neuralese
1•theptip•13m ago•0 comments

Making reliable distributed systems in the presence of software errors (2003)PDF

https://erlang.org/download/armstrong_thesis_2003.pdf
1•Jtsummers•15m ago•1 comments

ClickHouse MCP

https://github.com/ClickHouse/mcp-clickhouse
1•tosh•17m ago•0 comments

Breakfast with ChatGPT: Three Workers, One Morning, a Different AI Story

https://gizmodo.com/breakfast-with-chatgpt-three-workers-one-morning-a-different-ai-story-2000641190
1•ulrischa•18m ago•0 comments

Nonlinear response of gyroid infills for prediction of effective yield strength

https://dx.doi.org/10.1007/s40964-025-01200-7
1•PaulHoule•19m ago•0 comments

Anti-sunscreen movement sparks concern among dermatologists

https://www.washingtonpost.com/health/2025/08/10/anti-sunscreen-movement-risks/
3•rbanffy•21m ago•1 comments

Image-util: open-source image utilities in the browser

https://github.com/jsscheller/image-util
1•jsscheller•21m ago•1 comments

Lost in the wild? AI could find you

https://www.axios.com/2025/08/10/ai-search-rescue-privacy
1•c420•24m ago•0 comments

A Progressive Complexity Manifesto (Astro and Htmx)

https://www.lorenstew.art/blog/progressive-complexity-manifesto/
2•lorenstewart•24m ago•0 comments

Show HN: Collect Review/Build Feedback Inside Your PR

https://github.com/Schickli/gitlab-feedback-collector
1•maurin•25m ago•1 comments

Fundamentals of Probability

https://ocw.mit.edu/courses/6-436j-fundamentals-of-probability-fall-2018/
1•ibobev•26m ago•0 comments

Usage – a shell completion / manpage / help documentation generator

https://usage.jdx.dev/
1•weaksauce•26m ago•1 comments

Mathematics for Computer Science

https://twitter.com/Riazi_Cafe_en/status/1954135820874486071
1•ibobev•26m ago•0 comments

Information and Entropy

https://ocw.mit.edu/courses/6-050j-information-and-entropy-spring-2008/
2•ibobev•27m ago•0 comments

How do you make sense of complex multi-tab spreadsheets?

2•rahul_k_dev•29m ago•0 comments

The Drone and AI Delusion

https://secretaryrofdefenserock.substack.com/p/the-drone-and-ai-delusion
5•eagleislandsong•29m ago•0 comments

Stanford Sticks with Legacy Admissions

https://techcrunch.com/2025/08/10/stanford-sticks-with-legacy-admissions/
3•rntn•29m ago•0 comments

Think your breakup was bad? Check out the Museum of Broken Relationships

https://expmag.com/2023/02/think-your-breakup-was-bad-check-out-the-museum-of-broken-relationships/
1•twalichiewicz•30m ago•0 comments

Ask HN: What's in your crontab?

4•greyface-•34m ago•2 comments

Yes, a Moon Base

https://www.theatlantic.com/science/archive/2025/08/moon-base-nuclear-reactor/683802/
3•JumpCrisscross•38m ago•0 comments

South Korea's military has shrunk by 20% in six years as male population drops

https://www.channelnewsasia.com/east-asia/south-koreas-military-has-shrunk-20-in-six-years-male-population-drops-5287301
16•eagleislandsong•38m ago•0 comments

The zone zero secret: how ultra-low-stress exercise can change your life

https://www.theguardian.com/lifeandstyle/2025/aug/10/the-zone-zero-secret-how-ultra-low-stress-exercise-can-change-your-life
1•nickcotter•38m ago•1 comments