frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: SemanticCache – Save 70%+ on LLM API costs with semantic caching (Ruby)

https://github.com/stokry/semantic-cache
1•stokry•1h ago

Comments

stokry•1h ago
I built a Ruby gem that caches LLM responses using semantic similarity. If someone asks "What's the capital of France?" and later "What is France's capital city?" — the second call hits the cache instead of the API.

How it works: - Queries are converted to embeddings (text-embedding-3-small) - Cosine similarity finds matches above a threshold (default 0.85) - Cache hit = instant response, no API call, no cost

Usage is simple:

  cache = SemanticCache.new

  response = cache.fetch("What's the capital of France?") do
    openai.chat(messages: [{ role: "user", content: "..." }])
  end

  # This returns the cached response — no API call
  response = cache.fetch("What is France's capital city?") do
    openai.chat(messages: [{ role: "user", content: "..." }])
  end
Features: - In-memory and Redis stores - TTL expiry and tag-based invalidation - Cost tracking with savings reports - Works with OpenAI, Anthropic, Gemini - Client wrapper that caches all calls automatically - Rails integration (concern + per-user namespacing) - Max cache size with automatic LRU eviction

In my testing, hit rates of 60-80% are typical for apps with repetitive user queries (chatbots, search, FAQ tools).

The math: if you spend $500/mo on OpenAI and get a 70% hit rate, that's $350/mo saved minus ~$2 in embedding costs.

Repo: https://github.com/stokry/semantic-cache Install: gem install semantic-cache

Home Depot cuts 800 jobs, orders corporate staff back to office full time

https://www.foxbusiness.com/lifestyle/home-depot-cuts-800-jobs-orders-corporate-staff-back-office...
1•general_reveal•37s ago•0 comments

Coffee versus Caffeine as Ergogenic Aids

https://www.mdpi.com/2072-6643/18/2/328
1•PaulHoule•2m ago•0 comments

MLX: Why not implement this in PyTorch?

https://github.com/ml-explore/mlx/issues/12
1•tosh•2m ago•0 comments

Families of Boat Strike Victims Sue U.S. for "Manifestly Unlawful" Killings

https://theintercept.com/2026/01/27/boat-strike-victims-lawsuit/
1•Qem•2m ago•0 comments

cool-retro-term v2

https://github.com/Swordfish90/cool-retro-term/releases/tag/2.0.0-beta1
1•hggh•3m ago•0 comments

Show HN: Inspector – Open-Source Google AI Studio Conversation Viewer

https://github.com/TimChinye/Inspector
1•timchinye•4m ago•0 comments

A Step Behind the Bleeding Edge: A Philosophy on AI in Dev

https://somehowmanage.com/2026/01/22/a-step-behind-the-bleeding-edge-monarchs-philosophy-on-ai-in...
2•Ozzie_osman•4m ago•0 comments

Solving Fossil's ASCII art CAPTCHA in 171 characters

https://blog.nns.ee/2026/01/29/fossil-captcha-solver
1•xx_ns•5m ago•0 comments

Show HN: Native-devtools-MCP – MCP server for native desktop app interaction

https://github.com/sh3ll3x3c/native-devtools-mcp
1•sh3ll3x3c•8m ago•1 comments

AI Prompt to Create the Ultimate Reverse Prompt Engineering System

https://tools.eq4c.com/ai-prompts/chatgpt-prompt-to-create-the-ultimate-reverse-prompt-engineerin...
1•eq4c•8m ago•0 comments

The Physics of Ideas: Reality as a Coordination Problem

https://bpe.xyz
2•shoes_for_thee•10m ago•0 comments

The engineering behind GitHub Copilot CLI's animated ASCII banner

https://github.blog/engineering/from-pixels-to-characters-the-engineering-behind-github-copilot-c...
1•sebg•11m ago•0 comments

Poll: Meaningless Work or Boring Colleagues?

1•sam_lowry_•12m ago•3 comments

Compressed Air Gramophone

https://en.wikipedia.org/wiki/Compressed_air_gramophone
1•v9v•13m ago•0 comments

Show HN: 静阅 means "quiet reading" – a calm reading app for bedtime

https://apps.apple.com/us/app/%E9%9D%99%E9%98%85/id6758232981
1•jackhyyy•15m ago•0 comments

Ubiquiti sells its products to Russia despite bans [video]

https://www.youtube.com/watch?v=s6i4uffZvhc
2•ruvie8812•15m ago•0 comments

Compressed Agents.md > Agent Skills

https://vercel.com/blog/agents-md-outperforms-skills-in-our-agent-evals
1•maximedupre•16m ago•0 comments

Penn researchers are helping address group violence in Baltimore (2024)

https://penntoday.upenn.edu/news/criminology-crime-and-justice-policy-lab-baltimore-gvrs
1•orwin•16m ago•0 comments

Potentially habitable planet discovered 146 light-years away, may be -70C

https://www.theguardian.com/science/2026/jan/29/a-potentially-habitable-new-planet-has-been-disco...
2•tosh•17m ago•0 comments

Hard-stopping AI agent pipelines with prompt-level kill switches

https://blog.lukaszolejnik.com/hard-stopping-ai-agent-pipelines-with-prompt-level-kill-switches/
1•speckx•18m ago•0 comments

Angry Norfolk residents lose lawsuit to stop Flock license plate scanners

https://arstechnica.com/tech-policy/2026/01/angry-norfolk-residents-lose-lawsuit-to-stop-flock-li...
2•627467•18m ago•0 comments

Nathan Barry Grew ConvertKit to $43M by Ignoring Traditional SaaS Marketing

https://marketingcrafted.com/case-studies/convertkit
1•mellisacodes•19m ago•0 comments

Show HN: 静阅" means 安静阅读 – a quiet reading app designed for bedtime

https://apps.apple.com/us/app/transdo/id6746675000
1•jackhyyy•19m ago•0 comments

Show HN: Telegram-Archive – Own your chat history

https://github.com/GeiserX/Telegram-Archive
1•geiser•19m ago•0 comments

Scientists achieve pancreatic tumour regression in breakthrough study

https://www.euronews.com/health/2026/01/28/scientists-achieve-pancreatic-tumour-regression-in-bre...
1•akyuu•20m ago•0 comments

YC Startup school credits pack

1•shafimaahe•20m ago•0 comments

Show HN: SoundLocate – Find your city match based on music taste

https://soundlocate.com
1•akhow•22m ago•0 comments

Should You Resign?

https://marginalrevolution.com/marginalrevolution/2026/01/should-you-resign.html
2•speckx•24m ago•1 comments

Meta guides FY26 capex to $115-135B, up from $72B in FY25

https://www.marvin-labs.com/blog/meta-ai-strategy-infrastructure-investment-analysis/
1•alexdoesstuff•24m ago•1 comments

Tesla lurches into the Musk robotics era

https://www.ft.com/content/6a6cfa00-6f51-4abc-bd68-1738580bd2c5
1•nutjob2•26m ago•0 comments