SShortSingh.
Back to feed

Developer Cuts LLM API Bill 70% by Fixing Call Patterns, Not Code

0
·2 views

A developer running several side projects, including a Slack summarizer and a document search tool, was spending about $200 a month on LLM APIs. Switching models and compressing prompts barely reduced costs, so they focused instead on how requests were structured. They found that a large static system prompt was resent on every call, and that a three-step flow was needlessly repeating that input. Merging the draft and polish stages into a single call cut costs by roughly 30%. Adding a Redis cache that reuses recent summaries for unchanged Slack threads reduced costs further, bringing the monthly bill to about $60.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer Builds Web App That Turns Scripts Into Multi-Voice MP3s Using One TTS Request

A developer has built a small web app that lets users paste a screenplay-style script and download a single MP3 with several distinct voices. Unlike typical text-to-speech tools that generate one voice per clip, the app uses a multi-speaker model that performs an entire scene in one request, including inline acting directions. The system runs on a Cloudflare Worker with D1 for user data and R2 for audio storage, calling Fish Audio's Drama 3 model over its API. A key challenge was converting loosely written text into a strict payload, so unnamed lines default to a narrator and control-tag injection is stripped from user input.

0
ProgrammingDEV Community ·

A valid webhook signature doesn't rule out a duplicate event

An AI seller at Earn2Exist tested the free sample of its Stripe Digital Seller Kit, a PHP webhook signature checker and a signed download-link helper, on PHP 8.5.4. The local tests showed that a correctly signed event is accepted, while altered bodies and expired timestamps are rejected. However, the signature checker keeps no memory of past events, so it cannot detect whether an event was already processed. The author argues that payment handlers need a durable record of fulfilled events, protected by mechanisms such as a database transaction with a unique constraint or a file lock. The full kit's duplicate-handling code was not tested, and the link-helper results do not cover refunds, download counts, email delivery, or hosting.

0
ProgrammingDEV Community ·

Why Axonius Complements Tenable and CrowdStrike in Enterprise Cybersecurity Stacks

A DEV Community article uses a mock SOC analyst interview to highlight a common gap: candidates struggling to explain why an organization would adopt Axonius alongside Tenable and CrowdStrike. The piece explains that Tenable and CrowdStrike focus on vulnerability assessment and endpoint detection, producing fragmented asset inventories that can conflict across tools. Axonius, by contrast, aggregates data from these and other sources such as Active Directory and cloud environments to deduplicate assets, surface coverage gaps, and provide a unified asset view. The author argues that in large enterprises, uncorrelated data leads to blind spots where unmanaged assets can become entry points for attackers. The article cites a hypothetical breach involving a misclassified cloud instance that neither scanner flagged.

0
ProgrammingDEV Community ·

Unicast vs. Anycast for Webhook Ingress: Reducing Handshake Latency

Webhook senders such as Stripe, GitHub, Shopify and Slack deliver events to endpoints worldwide, and each delivery requires DNS, TCP, TLS and HTTP round trips before payload arrives. For distant receivers these handshakes dominate network cost, and publishers enforce tight response windows ranging from one to ten seconds. The article estimates that a TLS 1.3 setup adds roughly 150 ms and TLS 1.2 about 225 ms for a Dublin-to-Virginia path. It argues that handshake delay rarely causes timeouts, which are more often driven by slow application handlers, though it matters for tight limits and cold-connection bursts. The piece contrasts unicast, which routes all senders to one location, with anycast, where BGP steers senders toward a topologically nearby point of presence.