<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
 <channel>
  <title>The Cost as Code blog</title>
  <link>https://costascode.com/blog/</link>
  <description>Weekly posts on Savings as Code, Spend as Code and right-modeling: practical ways to cut and control cloud and AI spend.</description>
  <language>en</language>
  <lastBuildDate>Sat, 07 Nov 2026 08:00:00 +0000</lastBuildDate>
  <atom:link href="https://costascode.com/blog/feed.xml" rel="self" type="application/rss+xml"/>
  <item>
   <title>Implement AWS cost recommendations as pull requests</title>
   <link>https://costascode.com/blog/why-every-cloud-saving-should-be-a-pull-request</link>
   <guid isPermaLink="true">https://costascode.com/blog/why-every-cloud-saving-should-be-a-pull-request</guid>
   <pubDate>Sat, 07 Nov 2026 08:00:00 +0000</pubDate>
   <description>AWS cost recommendations stall between the finding and the change. Turning each saving into a pull request you approve, then measuring it, fixes that.</description>
   <content:encoded><![CDATA[<p>Every AWS account has a list of savings nobody has made: oversized instances, unattached volumes, compute that
would be cheaper on a Savings Plan. The list is accurate. The bill has not moved.</p>
<p>The problem is rarely finding the savings. It is the step after: changing production safely, deciding who
approves it, and proving later that the saving was real.</p>
<h2 id="where-recommendations-stall">Where recommendations stall</h2>
<ol>
<li>A report says a service could run on a smaller instance family and save about $1,100 a month.</li>
<li>Someone agrees it looks right.</li>
<li>Nobody owns the change: the service team is busy, the platform team won't resize someone else's service.</li>
<li>Three months later, the same line is in the next report.</li>
</ol>
<p>The recommendation arrived as a finding, not as a change.</p>
<h2 data-dot="Make it a pull request" id="make-the-saving-a-pull-request">Make the saving a pull request</h2>
<p>A pull request already answers every question that stalled the saving:</p>
<ul>
<li><strong>Who changes it?</strong> The pull request is the change; the team only reviews it.</li>
<li><strong>Is it safe?</strong> The diff shows what moves, CI runs, and the rollback is one revert.</li>
<li><strong>Who approves?</strong> The same people who approve every other change to that service.</li>
<li><strong>Did it work?</strong> The pull request is the unit you measure on the bill.</li>
</ul>
<p>This is <a href="https://costascode.com/savings">Savings as Code</a>: one saving, one pull request, approved by your team, measured after the merge.</p>
<details>
<summary>A savings pull request description, in five lines</summary>
<pre><code class="language-text">What changes   orders service: m5.2xlarge to m7g.xlarge (3 instances)
Why            p95 CPU 18% and memory 31% over the last 30 days
Estimate       about $1,100 a month
Risk           ARM build needed; image already multi-arch; load test attached
Rollback       revert this pull request; previous instance type restored on deploy
</code></pre>
</details>
<h2 id="measure-it-on-the-bill">Measure it on the bill</h2>
<p>The estimate gets the change approved. The bill decides what it was worth. About 30 days after the merge, record the
result next to the pull request:</p>
<table>
<thead>
<tr>
<th>Pull request</th>
<th>Estimate a month</th>
<th>Measured a month</th>
</tr>
</thead>
<tbody>
<tr>
<td data-label="Pull request">orders: smaller Graviton family</td>
<td data-label="Estimate a month">$1,100</td>
<td data-label="Measured a month">$1,040</td>
</tr>
<tr>
<td data-label="Pull request">Delete unattached volumes</td>
<td data-label="Estimate a month">$480</td>
<td data-label="Measured a month">$510</td>
</tr>
<tr>
<td data-label="Pull request">Lifecycle rule for old logs</td>
<td data-label="Estimate a month">$350</td>
<td data-label="Measured a month">$330</td>
</tr>
</tbody>
</table>
<p class="small muted">Illustrative example.</p>

<h2 id="start-this-week">Start this week</h2>
<ol>
<li>Export the current recommendations for one account, for example from
   <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/what-is-compute-optimizer.html">AWS Compute Optimizer</a>.</li>
<li>Pick the five with the largest estimate and the lowest risk.</li>
<li>Write each as a pull request with the five lines above.</li>
<li>Ask the owning team to review them like any change.</li>
<li>Set a reminder 30 days after each merge to record the measured saving.</li>
</ol>
<p>No infrastructure as code? Use a small change-log repo: same review, same measurement.</p>
<p>If you want the list found and the pull requests written for you, that is what we do: a free review of your AWS
bill, then we implement the savings and you approve every change.</p>]]></content:encoded>
  </item>
  <item>
   <title>Five LLM cost levers to check before you switch providers</title>
   <link>https://costascode.com/blog/five-llm-cost-levers</link>
   <guid isPermaLink="true">https://costascode.com/blog/five-llm-cost-levers</guid>
   <pubDate>Sat, 07 Nov 2026 08:00:00 +0000</pubDate>
   <description>Before moving to a cheaper AI provider, check five levers that reduce LLM costs where you are: model routing, caching, batch, output limits and context.</description>
   <content:encoded><![CDATA[<p>When an AI bill grows, the first idea is often to switch providers. A migration costs weeks and new quality risks,
and most of the waste stays behind: it comes from how models are used, not whose models they are. These five levers
reduce LLM costs with the provider you already have. Prices below are from the providers' own pages, checked
November 7, 2026.</p>
<h2 data-dot="Route to the right model" id="1-route-each-task-to-the-right-model">1. Route each task to the right model</h2>
<p>A ticket classifier and a contract review do not need the same model. Per input token, the most expensive model on
Anthropic's price list costs 100 times the cheapest, and OpenAI's list has the same gap
(<a href="https://platform.claude.com/docs/en/about-claude/pricing">Anthropic</a>,
<a href="https://developers.openai.com/api/docs/pricing">OpenAI</a>). Test cheaper models against real examples per task and
keep the cheapest that passes: <a href="https://costascode.com/right-modeling">right-modeling</a>.</p>
<p><strong>Measure:</strong> cost per request on each route.</p>
<h2 data-dot="Cache repeated prompts" id="2-cache-the-parts-of-the-prompt-that-repeat">2. Cache the parts of the prompt that repeat</h2>
<p>System prompts, tool definitions and shared documents are sent on every call. A cached prompt read costs 10% of the
normal input price on most Claude models (<a href="https://platform.claude.com/docs/en/about-claude/pricing">Anthropic</a>).
Put the stable parts first and the variable parts last.</p>
<p><strong>Measure:</strong> the share of input tokens billed as cached.</p>
<h2 data-dot="Batch work that can wait" id="3-move-work-that-can-wait-to-batch">3. Move work that can wait to batch</h2>
<p>Overnight reports, bulk tagging and evaluation runs can wait hours. Batch requests cost half the standard price on
Anthropic, OpenAI and the Gemini API (<a href="https://developers.openai.com/api/docs/guides/batch">OpenAI</a>,
<a href="https://aistudio.google.com/docs/pricing">Google</a>), and Amazon Bedrock offers 50% off on-demand for selected
models (<a href="https://aws.amazon.com/bedrock/pricing/">AWS</a>).</p>
<p><strong>Measure:</strong> the share of tokens processed in batch.</p>
<h2 data-dot="Limit the output" id="4-limit-and-shape-the-output">4. Limit and shape the output</h2>
<p>Output tokens cost five times input tokens on the flagship models of Anthropic, OpenAI and Google (pricing pages
above). If the interface shows two sentences, ask for two sentences, and cap the output per route.</p>
<p><strong>Measure:</strong> average output tokens per request.</p>
<h2 id="5-send-less-context">5. Send less context</h2>
<p>Send the passages that matter, summarize long histories, and check whether quality changes when you halve the
retrieved chunks.</p>
<p><strong>Measure:</strong> average input tokens per request.</p>
<h2 data-dot="Make each lever a change" id="make-each-lever-a-change-you-can-review">Make each lever a change you can review</h2>
<p>Each lever is one small change with an estimate before and a measurement after: the same way we handle cloud
savings in <a href="https://costascode.com/savings">Savings as Code</a>. Then write the chosen model and limits down where they are checked, so the
next feature does not undo them: <a href="https://costascode.com/spend">Spend as Code</a>, coming soon.</p>
<p>If the bill is still too high after that, compare providers. You will be comparing the real workload, not the waste.</p>]]></content:encoded>
  </item>
 </channel>
</rss>
