<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anders Rasmussen</title>
    <description>The latest articles on DEV Community by Anders Rasmussen (@adrasmussen).</description>
    <link>https://dev.to/adrasmussen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4067961%2F95c580d5-2d5d-457c-982b-072a37ed7c4c.png</url>
      <title>DEV Community: Anders Rasmussen</title>
      <link>https://dev.to/adrasmussen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/adrasmussen"/>
    <language>en</language>
    <item>
      <title>I built a pricing API for LLMs — then realized the real users might not be human</title>
      <dc:creator>Anders Rasmussen</dc:creator>
      <pubDate>Sat, 08 Aug 2026 06:02:20 +0000</pubDate>
      <link>https://dev.to/adrasmussen/i-built-a-pricing-api-for-llms-then-realized-the-real-users-might-not-be-human-4b8j</link>
      <guid>https://dev.to/adrasmussen/i-built-a-pricing-api-for-llms-then-realized-the-real-users-might-not-be-human-4b8j</guid>
      <description>&lt;p&gt;&lt;a href="https://llmpricewatch.com" rel="noopener noreferrer"&gt;Klikk her: LLM Price Watch&lt;/a&gt; started as a simple problem: comparing per-token pricing across Claude, GPT, Gemini, DeepSeek, and Grok meant opening five pricing pages and doing the math by hand every time a new model dropped. So I built a calculator. Then I built an API behind it. Then I noticed something about who was actually going to call that API.&lt;/p&gt;

&lt;h2&gt;
  
  
  The obvious version
&lt;/h2&gt;

&lt;p&gt;The first version of the API was exactly what you'd expect:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;GET /v1/models&lt;/code&gt; — every tracked model with current pricing&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GET /v1/models/:id&lt;/code&gt; — a single model&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GET /v1/calculate?model=X&amp;amp;input_tokens=N&amp;amp;output_tokens=N&lt;/code&gt; — cost for a specific call&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Straightforward. A human developer hits &lt;code&gt;/calculate&lt;/code&gt;, gets a number, builds their cost estimate into a dashboard somewhere. Done.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that changed the design
&lt;/h2&gt;

&lt;p&gt;The actual differentiator turned out to be a fourth endpoint: &lt;code&gt;GET /v1/recommend?use_case=X&lt;/code&gt;. Instead of just returning prices, it returns a &lt;em&gt;recommendation&lt;/em&gt; — which model fits a given use case (long-document summarization, high-volume classification, coding assistance, customer support) based on both price and the editorial analysis already written for the comparison pages on the site.&lt;/p&gt;

&lt;p&gt;Once that endpoint existed, the actual audience for this API stopped being "a developer building a cost dashboard" and started including something else: AI agents doing their own tool selection at runtime. An agent framework deciding which model to route a task to doesn't want to read a blog post — it wants a structured answer to "given this use case, what should I use, and what will it cost me." That's a tool call, not a page view.&lt;/p&gt;

&lt;p&gt;That reframing changed a few concrete decisions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CORS is wide open on purpose.&lt;/strong&gt; This isn't an API with a dashboard in front of it — it's meant to be called directly from wherever the calling code lives, including client-side agent code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No API key required (for now).&lt;/strong&gt; Every bit of friction between "an agent wants this data" and "an agent gets this data" is friction against the actual use case. A paid tier with rate limits is the natural future step once real usage justifies it, but gating from day one would have defeated the point.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;/recommend&lt;/code&gt; returns reasoning, not just a model name.&lt;/strong&gt; An agent — or the person who built it — needs to know &lt;em&gt;why&lt;/em&gt;, not just &lt;em&gt;what&lt;/em&gt;, or the recommendation is a black box nobody trusts enough to actually wire into a decision.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The unglamorous half of this
&lt;/h2&gt;

&lt;p&gt;None of that matters if the numbers are wrong. Pricing data for five providers was verified directly against each provider's own official pricing page, not pulled from a third-party aggregator — aggregators lag, and stale pricing data is worse than no data for something meant to inform actual spend decisions. Updates are still a manual snapshot for now; an auto-refreshing worker is the obvious next step once there's enough usage to justify the engineering time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part I didn't expect
&lt;/h2&gt;

&lt;p&gt;The API ended up feeding the &lt;em&gt;other&lt;/em&gt; site I run, &lt;a href="https://stackindexai.com" rel="noopener noreferrer"&gt;StackIndex AI&lt;/a&gt; — its &lt;a href="https://stackindexai.com/ai-feature-cost-calculator" rel="noopener noreferrer"&gt;cost calculator page&lt;/a&gt; calls this API live, gets a model recommendation plus a cost estimate, and returns it inline. Two separate sites, same backend, CORS'd across domains, tested end-to-end. I didn't plan the API to be reusable infrastructure when I built it — it just turned out that "structured, agent-callable, reasoning-included" is a useful shape for more than one problem.&lt;/p&gt;

&lt;p&gt;If you're building something similar: design the response for a reader who can't ask a follow-up question. That constraint does more for API design than almost anything else.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>llm</category>
      <category>software</category>
    </item>
  </channel>
</rss>
