<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged tokens</title>
<link>https://coderlegion.com/tag/tokens</link>
<description>Powered by Question2Answer</description>
<item>
<title>I turned strings into letter arrays and started rebuilding URLs with index ranges</title>
<link>https://coderlegion.com/30523/i-turned-strings-into-letter-arrays-and-started-rebuilding-urls-with-index-ranges</link>
<description>&lt;p&gt;I was just playing with a tiny idea:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;What if every string was just an array of single characters… and I could pull pieces out by index ranges to form words, paths, or API links?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That experiment became &lt;strong&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.npmjs.com/package/string-range-tokens&quot;&gt;string-range-tokens&lt;/a&gt;&lt;/strong&gt; — a zero-dependency ESM package that does exactly that.&lt;/p&gt;
&lt;h3 id=&quot;the-core-idea&quot;&gt;The core idea&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;import { toTokens, sub, build } from 'string-range-tokens';

const t = toTokens('https://api.example.com/v1/users');

sub(t, 0, 4);                 // &quot;https&quot;
sub(t, 23, 25, [26, 31]);     // &quot;/v1/users&quot;
sub(t, -5, -1);               // &quot;users&quot;   ← negative indexes work
build(t, [0, 4], [23, 25]);   // &quot;https/v1&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;toTokens&lt;/code&gt; turns any string into a proper array of characters (Unicode-safe).&lt;br&gt;
&lt;code&gt;sub&lt;/code&gt; and &lt;code&gt;build&lt;/code&gt; let you reassemble any combination of inclusive ranges.&lt;/p&gt;
&lt;h3 id=&quot;why-bother-&quot;&gt;Why bother?&lt;/h3&gt;
&lt;p&gt;Sometimes you want to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Assemble API paths or query fragments from a shared token pool&lt;/li&gt;
&lt;li&gt;Avoid writing the full string literal in one place&lt;/li&gt;
&lt;li&gt;Pick substrings by position without regex&lt;/li&gt;
&lt;li&gt;Build tiny string “templates” from a fixed alphabet&lt;/li&gt;
&lt;li&gt;Teach indexing, ranges, and a bit of recursion in a playful way&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It’s not encryption (never hide real secrets with it). It’s just a clean, lightweight way to work with strings as letter arrays.&lt;/p&gt;
&lt;h3 id=&quot;extra-powers&quot;&gt;Extra powers&lt;/h3&gt;
&lt;h4 id=&quot;plan-find-the-ranges-that-rebuild-a-target&quot;&gt;&lt;code&gt;plan&lt;/code&gt; – find the ranges that rebuild a target&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;const pool = toTokens('the quick brown fox');
const ranges = plan(pool, 'brew');
build(pool, ...ranges); // &quot;brew&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;scatter-gather-seeded-shuffle-reconstruct&quot;&gt;&lt;code&gt;scatter&lt;/code&gt; / &lt;code&gt;gather&lt;/code&gt; – seeded shuffle + reconstruct&lt;/h4&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;const { pool, key } = scatter('/api/orders', 7);
gather(pool, key); // &quot;/api/orders&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Useful for deterministic scrambling when you want both the shuffled tokens and a way to put them back together.&lt;/p&gt;
&lt;h3 id=&quot;install&quot;&gt;Install&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;npm i string-range-tokens
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or just copy the source — it’s a single file with no dependencies.&lt;/p&gt;
&lt;p&gt;Works in Node 18+, Deno, Bun, and the browser.&lt;br&gt;
Both JavaScript and TypeScript implementations are included.&lt;/p&gt;
&lt;p&gt;CDN:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;import { toTokens, sub, build, plan, scatter, gather } 
  from 'https://cdn.jsdelivr.net/npm/string-range-tokens@1.0.0/src/index.js';
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;links&quot;&gt;Links&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;npm: &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.npmjs.com/package/string-range-tokens&quot;&gt;string-range-tokens&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;GitHub: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/Figsh/srTokens&quot;&gt;Figsh/srTokens&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;If you end up using it for something fun (or weird), I’d love to hear about it.&lt;/p&gt;
</description>
<category>Discussions</category>
<guid isPermaLink="true">https://coderlegion.com/30523/i-turned-strings-into-letter-arrays-and-started-rebuilding-urls-with-index-ranges</guid>
<pubDate>Fri, 09 Oct 2026 22:09:28 +0000</pubDate>
</item>
<item>
<title>The Hidden Economics of AI: What It Actually Costs to Run LLMs in Production (With Real Data)</title>
<link>https://coderlegion.com/20569/the-hidden-economics-of-ai-what-it-actually-costs-to-run-llms-in-production-with-real-data</link>
<description>&lt;p&gt;There is an inconvenient truth the artificial intelligence industry prefers to whisper rather than proclaim: &lt;strong&gt;the real cost of putting an LLM into production almost never matches the API invoice&lt;/strong&gt;. It's like buying a car and discovering that the dealership price didn't include the wheels, the insurance, or the fuel. The label says &quot;$0.15 per million input tokens.&quot; What it doesn't say is how many millions of tokens your agent will burn in a delegation loop that spirals out of control at 3 AM.&lt;/p&gt;
&lt;p&gt;I know this because it happened to me. Over the past six months I've operated autonomous agent systems in real production: the &lt;a rel=&quot;nofollow&quot; href=&quot;https://datalaria.com/en/posts/ai_agents_part1/&quot;&gt;Autopilot Project&lt;/a&gt; (9 installments) to automate content distribution across social media, and the &lt;a rel=&quot;nofollow&quot; href=&quot;https://datalaria.com/en/posts/obs_part1_intro/&quot;&gt;Obsolescence Engineering&lt;/a&gt; series (7 installments) with a 24/7 agentic radar to monitor supply chain risks. This article is not a theoretical exercise: it is an X-ray of my real invoices, my mistakes, and my lessons learned.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://datalaria.com/en/posts/hidden_economics_ai/iceberg_hidden_costs.png&quot; alt=&quot;The hidden costs iceberg of AI&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;the-iceberg-what-the-api-invoice-doesn-t-tell-you&quot;&gt;The Iceberg: What the API Invoice Doesn't Tell You&lt;/h4&gt;
&lt;p&gt;The most dangerous mistake when budgeting a generative AI project is &lt;strong&gt;confusing the API cost with the total system cost&lt;/strong&gt;. It's like measuring the cost of a restaurant only by the price of the ingredients. In my experience operating these systems, the API represents roughly &lt;strong&gt;15-25% of the real cost&lt;/strong&gt;. The rest is the submerged iceberg:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th align=&quot;left&quot;&gt;Cost Layer &lt;/th&gt;&lt;th align=&quot;left&quot;&gt;What It Includes &lt;/th&gt;&lt;th align=&quot;center&quot;&gt;Typical %&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;LLM API&lt;/strong&gt; &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;Input/output tokens, context caching &lt;/td&gt;&lt;td align=&quot;center&quot;&gt;15-25%&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Infrastructure&lt;/strong&gt; &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;GitHub Actions (minutes), Netlify Functions, Supabase &lt;/td&gt;&lt;td align=&quot;center&quot;&gt;25-35%&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Engineer Time&lt;/strong&gt; &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;Agent debugging, prompt tuning, defensive programming &lt;/td&gt;&lt;td align=&quot;center&quot;&gt;30-40%&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Silent Costs&lt;/strong&gt; &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;Retries on failures, infinite loops, token overconsumption &lt;/td&gt;&lt;td align=&quot;center&quot;&gt;10-15%&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The third block — engineer time — is where most projects die. As I documented in the &lt;a rel=&quot;nofollow&quot; href=&quot;https://datalaria.com/en/posts/ai_agents_part9/&quot;&gt;Autopilot post-mortem&lt;/a&gt;, models are stochastic: you run the same pipeline ten times and get ten different results. This means &lt;strong&gt;you can't test an AI agent the way you test a conventional microservice&lt;/strong&gt;. You need defensive programming, output validation with JSON Schemas, and retries with exponential backoff. Every hour invested in that engineering has a cost.&lt;/p&gt;
&lt;h4 id=&quot;the-comparison-no-one-makes-gemini-vs-gpt-4o-vs-claude-in-real-production&quot;&gt;The Comparison No One Makes: Gemini vs GPT-4o vs Claude in Real Production&lt;/h4&gt;
&lt;p&gt;The LLM comparisons flooding the internet typically measure academic benchmarks: MMLU, HumanEval, logical reasoning. That's fine for research papers, but in production what matters is the &lt;strong&gt;cost-quality-reliability equation per specific task&lt;/strong&gt;. Here is my operational experience with the three main models:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th align=&quot;left&quot;&gt;Criterion &lt;/th&gt;&lt;th align=&quot;left&quot;&gt;Gemini 2.5 Flash &lt;/th&gt;&lt;th align=&quot;left&quot;&gt;GPT-4o &lt;/th&gt;&lt;th align=&quot;left&quot;&gt;Claude Sonnet 4&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Input Cost&lt;/strong&gt; (per 1M tokens) &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;$0.15 &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;$2.50 &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;$3.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Output Cost&lt;/strong&gt; (per 1M tokens) &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;$0.60 &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;$10.00 &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;$15.00&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Average latency&lt;/strong&gt; (complete response) &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;~2.1s &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;~3.8s &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;~4.5s&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;JSON reliability&lt;/strong&gt; (structured output) &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;⭐⭐⭐⭐ &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;⭐⭐⭐⭐⭐ &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;⭐⭐⭐⭐⭐&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;System prompt adherence&lt;/strong&gt; &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;⭐⭐⭐⭐ &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;⭐⭐⭐⭐ &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;⭐⭐⭐⭐⭐&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Creativity / &quot;personality&quot;&lt;/strong&gt; &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;⭐⭐⭐ &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;⭐⭐⭐⭐ &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;⭐⭐⭐⭐⭐&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The price difference between Gemini Flash and its competitors is not a percentage: it's an &lt;strong&gt;order of magnitude&lt;/strong&gt;. For high-volume, low-creativity tasks — classification, structured data extraction, email parsing — Gemini Flash is unbeatable. That's exactly why I chose it as the engine for the &lt;a rel=&quot;nofollow&quot; href=&quot;https://datalaria.com/en/posts/obs_part5_radar_agent/&quot;&gt;obsolescence agentic radar&lt;/a&gt;: I needed to run hundreds of analyses per month without the bill spiraling out of control.&lt;/p&gt;
&lt;p&gt;However, when the task demands nuance, personality, or complex reasoning, the quality difference justifies the price. In the Autopilot Project, the agent writing LinkedIn posts with a &quot;corporate&quot; tone and the one writing tweets with a &quot;cynical&quot; tone (&lt;a rel=&quot;nofollow&quot; href=&quot;https://datalaria.com/en/posts/ai_agents_part3/&quot;&gt;Part 3&lt;/a&gt;) performed significantly better with premium-tier models. &lt;strong&gt;The lesson: there is no &quot;best model,&quot; there is the right model for each task in your pipeline.&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&quot;anatomy-of-a-real-invoice-the-autopilot-project&quot;&gt;Anatomy of a Real Invoice: The Autopilot Project&lt;/h4&gt;
&lt;p&gt;Let's break down the actual costs of operating the Autopilot Project during a typical month. This system analyzes each new blog post, generates optimized content for Twitter and LinkedIn in two languages (ES/EN), runs a quality audit, and publishes automatically with human approval.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th align=&quot;left&quot;&gt;Item &lt;/th&gt;&lt;th align=&quot;left&quot;&gt;Monthly Cost &lt;/th&gt;&lt;th align=&quot;left&quot;&gt;Notes&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Gemini API&lt;/strong&gt; (Flash + Pro) &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;~€1.20 &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;~4 executions/month, ~50K tokens per execution&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;GitHub Actions&lt;/strong&gt; (CI/CD minutes) &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;€0.00 &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;Free tier: 2,000 min/month (more than enough)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Brevo&lt;/strong&gt; (Newsletter) &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;€0.00 &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;Free tier: 300 emails/day&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Netlify&lt;/strong&gt; (Functions + Hosting) &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;€0.00 &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;Free tier: 125K invocations/month&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Supabase&lt;/strong&gt; (PostgreSQL) &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;€0.00 &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;Free tier: 500MB, 2 projects&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Domain&lt;/strong&gt; (datalaria.com) &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;~€1.50 &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;Monthly prorated&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Engineer time&lt;/strong&gt; &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;¿? &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;The real hidden cost&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;Total infrastructure&lt;/strong&gt; &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;&lt;strong&gt;~€2.70/month&lt;/strong&gt; &lt;/td&gt;&lt;td align=&quot;left&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Yes, you read that right: &lt;strong&gt;less than 3 euros per month&lt;/strong&gt; to operate a complete AI agent system with automated social media publishing, newsletter, and CI/CD. The key lies in three deliberate architectural decisions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Gemini Flash as the main engine&lt;/strong&gt;: At $0.15/M input tokens, the cost per execution is cents, not euros.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Aggressive free tiers&lt;/strong&gt;: GitHub Actions, Netlify, Supabase, and Brevo offer generous free plans that comfortably cover an individual project or early-stage startup.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;On-demand execution&lt;/strong&gt;: The pipeline doesn't run 24/7 — it only triggers on each new post (event-driven), avoiding the cost of always-on servers.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id=&quot;the-loop-trap-when-your-agent-burns-money-on-its-own&quot;&gt;The Loop Trap: When Your Agent Burns Money on Its Own&lt;/h4&gt;
&lt;p&gt;But the invoice isn't always that friendly. In the Autopilot post-mortem I documented a critical failure every engineer should know about: CrewAI's &lt;strong&gt;infinite delegation loops&lt;/strong&gt;. When an agent can't find the expected answer, it can re-delegate the task to itself in a loop that consumes tokens exponentially until GitHub Actions kills the process on timeout (&lt;strong&gt;SIGTERM&lt;/strong&gt; at 60 minutes).&lt;/p&gt;
&lt;p&gt;In a single failed execution, that loop can consume &lt;strong&gt;more tokens than an entire month of normal operation&lt;/strong&gt;. It's the digital equivalent of leaving a tap running overnight. The solution is brutally simple, yet nobody implements it by default:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;max_iter&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;max_execution_time&lt;/code&gt;&lt;/strong&gt; on every CrewAI agent&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Output validation&lt;/strong&gt; with Pydantic before passing to the next agent&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cost alerts&lt;/strong&gt; configured in the Google Cloud console&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Circuit breakers&lt;/strong&gt; that kill execution if consumption exceeds a threshold&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.youtube.com/watch?v=7zbuEULTHIs&quot;&gt;&lt;img src=&quot;https://img.youtube.com/vi/7zbuEULTHIs/0.jpg&quot; alt=&quot;YouTube Video&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4 id=&quot;the-10x-rule-when-it-s-worth-paying-more&quot;&gt;The 10x Rule: When It's Worth Paying More&lt;/h4&gt;
&lt;p&gt;After six months operating these systems, I've distilled a pragmatic rule I call the &lt;strong&gt;10x Rule&lt;/strong&gt;: a more expensive model is only justified if it produces a result at least &lt;strong&gt;10 times better&lt;/strong&gt; on the metric that matters for your use case. What does &quot;10 times better&quot; mean?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;In classification&lt;/strong&gt;: 10x fewer classification errors&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;In content generation&lt;/strong&gt;: 10x fewer human correction iterations&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;In data extraction&lt;/strong&gt;: 10x fewer verifiable hallucinations&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;In latency&lt;/strong&gt;: 10x faster on the user's critical path&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the improvement is 20-30%, stick with the cheap model. If it's 2x-3x, evaluate. If it's 10x, don't think twice. This rule led me to use Gemini Flash for 90% of tasks and reserve premium models only for creative content generation.&lt;/p&gt;
&lt;h4 id=&quot;looking-ahead-the-deflation-of-intelligence&quot;&gt;Looking Ahead: The Deflation of Intelligence&lt;/h4&gt;
&lt;p&gt;There is a macro trend every engineer needs to have on their radar: &lt;strong&gt;the cost per token is falling at a brutal pace&lt;/strong&gt;. Gemini Flash in June 2025 cost $0.35/M input tokens. One year later, it costs $0.15 — a &lt;strong&gt;57% drop in 12 months&lt;/strong&gt;. If this trend holds (and everything suggests it will accelerate with competition from open-source models like Llama and Mistral), in two years we'll be talking about API costs that are &lt;strong&gt;essentially free&lt;/strong&gt; for most use cases.&lt;/p&gt;
&lt;p&gt;That doesn't mean AI will be free. It means &lt;strong&gt;the cost will definitively shift from the API to the engineer&lt;/strong&gt;: the ability to design robust systems, implement defensive programming, and orchestrate complex pipelines will be the true competitive differentiator. The model will be a commodity; the architecture will be the moat.&lt;/p&gt;
&lt;p&gt;As W. Edwards Deming — to whom I dedicated a &lt;a rel=&quot;nofollow&quot; href=&quot;https://datalaria.com/en/posts/deming/&quot;&gt;full article&lt;/a&gt; — put it: &lt;em&gt;&quot;It is not enough to do your best; you must first know what to do.&quot;&lt;/em&gt; In the hidden economics of AI, knowing which model to use, when to use it, and when &lt;strong&gt;not&lt;/strong&gt; to use it is the most valuable skill you can develop.&lt;/p&gt;
&lt;hr&gt;
&lt;h5 id=&quot;sources-of-interest-&quot;&gt;Sources of Interest:&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://ai.google.dev/pricing&quot;&gt;&lt;strong&gt;Google AI&lt;/strong&gt;: Gemini API Pricing — Updated Models and Prices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://openai.com/api/pricing/&quot;&gt;&lt;strong&gt;OpenAI&lt;/strong&gt;: API Pricing — GPT-4o, GPT-4o mini Models&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.anthropic.com/pricing&quot;&gt;&lt;strong&gt;Anthropic&lt;/strong&gt;: Claude API Pricing — Claude 4 and Sonnet Models&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://datalaria.com/en/posts/ai_agents_part9/&quot;&gt;&lt;strong&gt;Datalaria&lt;/strong&gt;: Autopilot Project Post-Mortem — Lessons Learned&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://datalaria.com/en/posts/obs_part5_radar_agent/&quot;&gt;&lt;strong&gt;Datalaria&lt;/strong&gt;: The Agentic Radar — Tool Calling vs RAG in Production&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://a16z.com/navigating-the-high-cost-of-ai-compute/&quot;&gt;&lt;strong&gt;Andreessen Horowitz&lt;/strong&gt;: The Cost of AI — Who Pays and How Much? (Andreessen Horowitz Report)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions&quot;&gt;&lt;strong&gt;GitHub&lt;/strong&gt;: GitHub Actions Billing — Free Tier and Pricing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/20569/the-hidden-economics-of-ai-what-it-actually-costs-to-run-llms-in-production-with-real-data</guid>
<pubDate>Sun, 14 Jun 2026 08:17:49 +0000</pubDate>
</item>
</channel>
</rss>