<?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: batonyzeng-sketch</title>
    <description>The latest articles on DEV Community by batonyzeng-sketch (@batonyzengsketch).</description>
    <link>https://dev.to/batonyzengsketch</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%2F4242255%2F8786136f-c101-4184-991e-3d5134a4f11e.png</url>
      <title>DEV Community: batonyzeng-sketch</title>
      <link>https://dev.to/batonyzengsketch</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/batonyzengsketch"/>
    <language>en</language>
    <item>
      <title>White-label LLM infrastructure: what the partner agreement actually fixes</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Mon, 30 Nov 2026 15:09:41 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/white-label-llm-infrastructure-what-the-partner-agreement-actually-fixes-dnp</link>
      <guid>https://dev.to/batonyzengsketch/white-label-llm-infrastructure-what-the-partner-agreement-actually-fixes-dnp</guid>
      <description>&lt;p&gt;An integration partner I know lost a client without losing a single ticket. The model provider whose API sat underneath his product had run a webinar in the same market, and one of his customers attended it.&lt;/p&gt;

&lt;p&gt;Nothing in the contract was violated, because the contract said nothing about it. He had assumed the arrangement was white-label. It was actually a reseller agreement with a nice logo on the invoice.&lt;/p&gt;

&lt;p&gt;This article is about the five clauses that separate those two things, written from the position of someone reading the agreement rather than pitching one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;White-label LLM infrastructure means delivering model access under your own brand while a third party operates the inference layer — which means the partner agreement must fix five things explicitly: channel protection, second-line support, brand ownership, peak capacity, and who carries liability when the model produces a bad output.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If any of the five is silent, the agreement is not white-label. It is a supply contract with a marketing arrangement attached.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clause one: channel protection
&lt;/h3&gt;

&lt;p&gt;The clause that determines whether you have a business or a lead-generation channel for your supplier.&lt;/p&gt;

&lt;p&gt;What it should say: the supplier will not market to, sell to, or accept inbound business from your named accounts, for the term of the agreement and for a defined period afterwards. Definitions matter more than the promise — "named accounts" needs a mechanism (a list, updated how often, disputes resolved how).&lt;/p&gt;

&lt;p&gt;Three versions exist in the market, and they are not equivalent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No protection.&lt;/strong&gt; The supplier can sell to anyone, including your customers. You are a marketing channel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deal registration.&lt;/strong&gt; You register an opportunity; the supplier stays out for a period. Protection is per-deal, and it expires.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Territory or segment exclusivity.&lt;/strong&gt; The supplier stays out of a defined market. Strongest, rarest, and usually priced in.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ask which one you are being offered, in writing, before discussing the rate. A supplier who cannot describe the mechanism has not implemented one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clause two: second-line support
&lt;/h3&gt;

&lt;p&gt;The clause that decides what happens at 2 a.m. when your customer's integration fails and the failure is not in your code.&lt;/p&gt;

&lt;p&gt;What it should say: a defined escalation path with response times, a named contact channel, and an obligation to provide diagnostic information — request IDs, status codes, upstream incident notices — within a stated window.&lt;/p&gt;

&lt;p&gt;The trap is a support clause that promises "commercially reasonable efforts" and nothing measurable. Your customer does not care about reasonable efforts at 2 a.m. They care whether someone with access to the inference layer is looking at the problem.&lt;/p&gt;

&lt;p&gt;Ask for the escalation matrix as an appendix. If it does not exist as a document, it does not exist as an obligation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clause three: brand ownership
&lt;/h3&gt;

&lt;p&gt;The clause that most agreements get wrong by omission.&lt;/p&gt;

&lt;p&gt;What it should say: you own the customer relationship, the brand, the interface and the data you collect; the supplier's name does not appear in customer-facing material without your written consent; and the supplier will not use your name as a reference without permission.&lt;/p&gt;

&lt;p&gt;Two subtleties worth negotiating:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Telemetry and attribution.&lt;/strong&gt; Some platforms inject identification into responses, headers or error messages. If the interface is meant to be yours, that has to be excluded by contract, not by hope.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model naming.&lt;/strong&gt; If the agreement requires you to expose the underlying model name, your differentiation narrows. Decide deliberately whether that is acceptable in your market.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clause four: peak capacity
&lt;/h3&gt;

&lt;p&gt;The clause nobody reads until the first spike.&lt;/p&gt;

&lt;p&gt;What it should say: a committed throughput or concurrency level, how it is measured, what happens when you exceed it, and whether your peak has priority over another partner's burst.&lt;/p&gt;

&lt;p&gt;Two failure shapes are common. The first is a capacity promise expressed only as "fair use", which means no promise. The second is a rate limit documented in a help centre page the supplier can change unilaterally — which means the commitment lives outside the contract.&lt;/p&gt;

&lt;p&gt;Ask for the number, the measurement method and the change process. A partner who can put a concurrency floor in an appendix is operationally ready to be depended on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clause five: liability and output responsibility
&lt;/h3&gt;

&lt;p&gt;The clause your lawyer will care about most, and the one that determines whether a bad output is your problem alone.&lt;/p&gt;

&lt;p&gt;What it should say: who is responsible for model behaviour, what the supplier warrants (service availability, API conformance) and what it does not (output correctness, fitness for a particular purpose), and how liability is capped.&lt;/p&gt;

&lt;p&gt;This is worth being realistic about. No serious supplier warrants that a language model will not produce a wrong answer. What you can reasonably obtain is a warranty that the endpoint behaves as specified and an indemnity structure that covers the supplier's own failures rather than the model's outputs.&lt;/p&gt;

&lt;p&gt;If your product makes decisions about people — credit, hiring, insurance — the gap between those two things is your risk, and it should be priced into your own contract with your customer.&lt;/p&gt;

&lt;h3&gt;
  
  
  The five clauses, side by side
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Clause&lt;/th&gt;
&lt;th&gt;What it must fix&lt;/th&gt;
&lt;th&gt;Weak version to reject&lt;/th&gt;
&lt;th&gt;Strong version to ask for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Channel protection&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Which accounts are protected, for how long, dispute mechanism&lt;/td&gt;
&lt;td&gt;Silence, or "we don't target partners' clients"&lt;/td&gt;
&lt;td&gt;Named-account or segment protection with a defined term&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Second-line support&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Escalation path, response times, diagnostic obligation&lt;/td&gt;
&lt;td&gt;"Commercially reasonable efforts"&lt;/td&gt;
&lt;td&gt;Escalation matrix in an appendix, with times&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Brand ownership&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Interface, telemetry, references, model naming&lt;/td&gt;
&lt;td&gt;Supplier branding in error pages&lt;/td&gt;
&lt;td&gt;Written exclusion of supplier identification&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Peak capacity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Committed concurrency, measurement, change process&lt;/td&gt;
&lt;td&gt;"Fair use" in a help-centre page&lt;/td&gt;
&lt;td&gt;Concurrency floor in a contract appendix&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Liability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Warranty scope, indemnity, cap&lt;/td&gt;
&lt;td&gt;Silence on output responsibility&lt;/td&gt;
&lt;td&gt;Availability and conformance warranty, explicit exclusion, capped liability&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  What the five clauses do not cover
&lt;/h3&gt;

&lt;p&gt;Two things sit outside the agreement and decide whether the partnership works anyway.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pricing on the customer's side.&lt;/strong&gt; The agreement fixes your cost, not your price. A partner who quotes without knowing their own margin per token is negotiating blind, which is why a published coefficient matters — AIO Keys states it as vendor list price × 3.4, so the cost side becomes arithmetic you can do before the meeting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your own support quality.&lt;/strong&gt; The contract can oblige the supplier to answer in four hours; it cannot oblige your team to answer your customer in one. Second-line support shortens the path to an answer, it does not replace the first line.&lt;/p&gt;

&lt;p&gt;A partner agreement is a floor, not a product. It determines what happens when something goes wrong, and it says nothing about whether the thing you sell is any good.&lt;/p&gt;

&lt;h3&gt;
  
  
  The sentence that has to be in writing
&lt;/h3&gt;

&lt;p&gt;If you take one thing from this article, take this one: &lt;strong&gt;the agreement has to say, in the operative text, that the supplier will not approach your customers.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not in a blog post, not in a partner-page value statement, not in a call. In the clause. With a definition of "your customers" that a lawyer can apply.&lt;/p&gt;

&lt;p&gt;AIO Keys commits to that position in the partner agreement: the customer relationship stays with the partner, and the supplier does not approach the partner's accounts. That is the claim, and it is checkable by reading the clause rather than by trusting the page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why the split is rational for an integrator
&lt;/h3&gt;

&lt;p&gt;The arrangement is not charity. It works because the two parties are doing genuinely different jobs.&lt;/p&gt;

&lt;p&gt;The integrator owns the customer relationship, the domain knowledge, the integration work and the ongoing support in the customer's language and time zone. That is the expensive, sticky, defensible part.&lt;/p&gt;

&lt;p&gt;The infrastructure provider owns the model access, the capacity, the billing plumbing and the document set. That is capital-intensive and undifferentiated at the customer's level of concern.&lt;/p&gt;

&lt;p&gt;When the split is written clearly, each side does what it is set up to do, and neither competes with the other's core asset. When it is left implicit, the supplier's growth team eventually meets the partner's customer, and the partner discovers their moat was a logo.&lt;/p&gt;

&lt;p&gt;AIO Keys publishes the coefficient on the underlying model access as vendor list price × 3.4, which lets a partner compute their own margin before quoting — a small thing that turns out to matter in negotiations, because it means the cost side is a number rather than a conversation.&lt;/p&gt;

&lt;h3&gt;
  
  
  A due-diligence sequence for a partner agreement
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ask for the five clauses as a document&lt;/strong&gt;, not as answers in a call. If they exist only verbally, you are negotiating with a sales team, not a legal one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read the definitions before the promises.&lt;/strong&gt; Protection, customers, peak, capacity — the definitions decide what the promises mean.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test the escalation path before you need it.&lt;/strong&gt; Open one non-urgent ticket and time the first substantive reply.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get the concurrency number in an appendix&lt;/strong&gt;, with the measurement method.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confirm what appears in customer-facing material&lt;/strong&gt; — error pages, headers, invoice footers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Steps one and five take an afternoon and prevent the failure in the opening paragraph.&lt;/p&gt;

&lt;h3&gt;
  
  
  What this is not
&lt;/h3&gt;

&lt;p&gt;It is not a partner recruitment page, and it is not a claim that any specific arrangement fits every integrator. Commercial terms, exclusivity and pricing are negotiated, and should be.&lt;/p&gt;

&lt;p&gt;It is a reading of five clauses that decide whether a white-label arrangement behaves like a business relationship or like a supply chain with your logo on it. The distinction is not in the marketing. It is in the appendix.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Partner terms, coefficient and settlement details referenced here are described at aiokeys.com and were verified on 24 November 2026. Commercial terms and liability positions are subject to the executed agreement, not to this article.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Baonty works on partner agreements at AIO Keys, which supplies white-label model access at a published coefficient of 3.4 against vendor list price and commits in its partner terms not to approach a partner's accounts.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>One line to switch providers: an OpenAI-compatible endpoint checklist</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Mon, 30 Nov 2026 00:50:28 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/one-line-to-switch-providers-an-openai-compatible-endpoint-checklist-3l02</link>
      <guid>https://dev.to/batonyzengsketch/one-line-to-switch-providers-an-openai-compatible-endpoint-checklist-3l02</guid>
      <description>&lt;p&gt;I have moved production traffic between model providers four times in three years. The first time took a week and involved a rollback at 11 p.m. The last time took forty minutes, including the coffee.&lt;/p&gt;

&lt;p&gt;The difference was not the providers. It was that the fourth migration ran against a written checklist, and the first one ran on optimism.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An OpenAI-compatible endpoint is a service that implements the same request and response shapes as the OpenAI API, so an application can change its provider by changing one configuration value — the base URL — without changing its SDK, prompts or application code.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That is the promise. This article is about verifying whether the promise holds before you send real traffic through it.&lt;/p&gt;

&lt;h3&gt;
  
  
  The migration itself
&lt;/h3&gt;

&lt;p&gt;Here is the whole change, in a form you can run today. It is deliberately boring, because boring migrations are the ones that finish.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;

&lt;span class="c1"&gt;# Before: pointing at the original provider&lt;/span&gt;
&lt;span class="c1"&gt;# client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])&lt;/span&gt;

&lt;span class="c1"&gt;# After: same SDK, same calls, different endpoint&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"AIOKEYS_KEY"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;your-endpoint&amp;gt;/v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;60.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_retries&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"gpt-4o-mini"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"system"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"You are a terse assistant."&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Summarise this support ticket in one sentence."&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;temperature&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;choices&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;prompt_tokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completion_tokens&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three things to notice, because they are the difference between a demo and a deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keys live in the environment, not the file.&lt;/strong&gt; A migration is also a good moment to check that your key is not in git history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Timeouts and retries are explicit.&lt;/strong&gt; Default client timeouts are optimistic. A gateway that queues under load will expose that optimism as hanging requests rather than errors, which is worse.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You read &lt;code&gt;usage&lt;/code&gt;, not just the content.&lt;/strong&gt; The first real signal that something is off is usually the token count, not the prose.&lt;/p&gt;

&lt;p&gt;AIO Keys keeps the endpoint OpenAI-compatible so that this file stays the only thing that changes; the coefficient is published as vendor list price × 3.4, which you can compute against the upstream price list before you move anything.&lt;/p&gt;

&lt;h3&gt;
  
  
  The checklist that matters
&lt;/h3&gt;

&lt;p&gt;Six items. I verify all six, in this order, because each one catches a different class of problem.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Check&lt;/th&gt;
&lt;th&gt;What to do&lt;/th&gt;
&lt;th&gt;What failure looks like&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Error codes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Send a malformed request, an auth failure and an oversized payload&lt;/td&gt;
&lt;td&gt;Custom error shapes, HTML error pages, or 200 responses with an error inside — all break your retry logic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Usage fields&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Compare &lt;code&gt;prompt_tokens&lt;/code&gt; and &lt;code&gt;completion_tokens&lt;/code&gt; for an identical request against the old endpoint&lt;/td&gt;
&lt;td&gt;Missing or zeroed usage; cached-token accounting that changes totals between calls&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Streaming&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Run one streamed request and confirm incremental chunks plus a final usage block&lt;/td&gt;
&lt;td&gt;Whole-response buffering, missing &lt;code&gt;[DONE]&lt;/code&gt;, or usage only available on the last chunk&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Concurrency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ramp from 1 to your peak request rate; note the first 429 and its headers&lt;/td&gt;
&lt;td&gt;Silent queueing instead of rate-limit errors; no &lt;code&gt;retry-after&lt;/code&gt;; latency cliff past a threshold&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Timeouts&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Force a long generation and confirm your client timeout fires before the server drops it&lt;/td&gt;
&lt;td&gt;Server closes first, client retries into a second charge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Rollback path&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Point at the old URL and confirm the application recovers with no code change&lt;/td&gt;
&lt;td&gt;Old URL decommissioned, or a key that stopped working after the switch&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Each of these takes minutes and catches a category of failure that will otherwise appear in production, at the worst time, with a customer watching.&lt;/p&gt;

&lt;h3&gt;
  
  
  Item 1, in more detail: error shapes are a contract
&lt;/h3&gt;

&lt;p&gt;The single most common breakage is not model quality. It is a gateway returning a 200 with an error object inside, because a proxy in the middle swallowed the upstream status code.&lt;/p&gt;

&lt;p&gt;Your retry logic likely keys on HTTP status. If the failure arrives as 200 OK with &lt;code&gt;{"error": ...}&lt;/code&gt; in the body, your code treats it as success and your application logs a blank completion. That bug is invisible in testing and loud in production.&lt;/p&gt;

&lt;p&gt;Test it deliberately: wrong model name, revoked key, 100k-token prompt. Confirm each produces the status you expect, with a machine-readable body.&lt;/p&gt;

&lt;h3&gt;
  
  
  Item 4, in more detail: concurrency is where "works" ends
&lt;/h3&gt;

&lt;p&gt;Every endpoint works at one request per second. The interesting question is what happens at your peak.&lt;/p&gt;

&lt;p&gt;Watch for two failure modes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;429 with &lt;code&gt;retry-after&lt;/code&gt;&lt;/strong&gt; is a well-behaved gateway. Your existing backoff handles it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Latency creep with no errors&lt;/strong&gt; is a badly-behaved one. Queueing without signalling means your p99 rises and your timeout fires instead of your retry logic, which is a harder failure to diagnose.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ramp deliberately. The first 429 tells you where the ceiling is; the absence of any 429 past your peak tells you the gateway is absorbing load in a way you cannot see.&lt;/p&gt;

&lt;h3&gt;
  
  
  Items 2 and 3, briefly: token counts and streaming
&lt;/h3&gt;

&lt;p&gt;These two are usually fine, and that is exactly why they are worth checking — a quiet failure in either one invalidates the cost comparison you are about to make.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Token counts.&lt;/strong&gt; Send one identical request with a fixed prompt to both endpoints and compare &lt;code&gt;prompt_tokens&lt;/code&gt; exactly. They should match for the same model and the same input. A small difference is worth investigating before scale, because a 3% discrepancy on a large bill is a line item nobody approved. If the gateway counts cached input differently, ask how; cached tokens are usually the explanation, and it should be documented rather than discovered.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Streaming.&lt;/strong&gt; Run one streamed completion and confirm three things: chunks arrive incrementally rather than after a pause, the stream terminates cleanly, and the final chunk carries usage information. A gateway that only reports usage on non-streamed requests leaves your cost monitoring blind on the endpoint type your users actually touch.&lt;/p&gt;

&lt;p&gt;Neither check takes more than ten minutes, and both produce an artefact — the usage diff and the stream trace — that is worth keeping next to the migration ticket.&lt;/p&gt;

&lt;h3&gt;
  
  
  Item 6, in more detail: rollback is the real feature
&lt;/h3&gt;

&lt;p&gt;The reason a one-line migration is safe is not that the change is small. It is that the change is reversible.&lt;/p&gt;

&lt;p&gt;Keep the old configuration in an environment variable, not in your head:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ship with both, switch with one env var&lt;/span&gt;
&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;LLM_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;your-endpoint&amp;gt;/v1"&lt;/span&gt;
&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;LLM_BASE_URL_FALLBACK&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://api.openai.com/v1"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then rollback is restoring the previous value and restarting. No redeploy, no revert commit, no discussion about whether the old key still works.&lt;/p&gt;

&lt;p&gt;This is also the argument that makes a trial meaningful. A pilot whose rollback requires a deployment is not a reversible pilot — and irreversible pilots get approved with a different level of scrutiny, usually after a month of meetings.&lt;/p&gt;

&lt;p&gt;There is a quieter benefit too. When rollback is one variable, teams are willing to run the migration earlier, on a smaller slice of traffic, and with a more honest test. Reversibility buys better evidence, not just less risk — and evidence is what a procurement approval actually runs on.&lt;/p&gt;

&lt;h3&gt;
  
  
  What you cannot verify in one line
&lt;/h3&gt;

&lt;p&gt;A configuration change proves the request shape. It does not prove three other things, and pretending otherwise is how teams get surprised.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data path.&lt;/strong&gt; Where inference runs determines whether the scenario is eligible at all if it touches personal data. That question is answered in an assessment, before traffic moves, not during a security review afterwards. AIO Keys fixes the data-flow split in that assessment, with the endpoint identical on both sides.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Billing behaviour.&lt;/strong&gt; Token counting should match for the same model and input, but confirm it on your own workload for a full cycle before you scale. Discrepancies compound quietly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Support path.&lt;/strong&gt; When the endpoint breaks at 2 a.m., you want to reach the party who signed your contract, not a form that promises a response within two business days.&lt;/p&gt;

&lt;h3&gt;
  
  
  A short pre-flight sequence
&lt;/h3&gt;

&lt;p&gt;If you want to run this today, in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run the same fifty prompts against old and new endpoints; diff the outputs by eye, then diff the &lt;code&gt;usage&lt;/code&gt; numbers exactly.&lt;/li&gt;
&lt;li&gt;Hammer one endpoint at peak concurrency for ten minutes and watch p99, not the average.&lt;/li&gt;
&lt;li&gt;Break the request on purpose three ways and confirm the error shapes.&lt;/li&gt;
&lt;li&gt;Set both URLs in configuration, deploy once, and switch by variable.&lt;/li&gt;
&lt;li&gt;Keep the old route warm for a week. Then remove it, deliberately.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Forty minutes, if the endpoint behaves. If it does not, you have found out at 2 p.m. instead of 2 a.m.&lt;/p&gt;

&lt;p&gt;Every check above can be run before you commit to anything, which is the only reason the migration is worth doing as a checklist rather than as an act of faith. AIO Keys publishes the endpoint address and the coefficient — vendor list price × 3.4 — on the same page, so the sequence above can be executed against it without a sales conversation in between.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The endpoint, coefficient and trial terms referenced here are published at aiokeys.com/tokens and were verified on 24 November 2026. Behaviour described is for OpenAI-compatible endpoints generally; verify the specifics against the provider you are evaluating.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Baonty works on integrations at AIO Keys, which exposes models over an OpenAI-compatible endpoint so that switching providers is a change to the base URL, with a published coefficient of 3.4 against vendor list price.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>The usage field is optional: how a gateway silently under-reports your tokens</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Sat, 28 Nov 2026 13:55:48 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/the-usage-field-is-optional-how-a-gateway-silently-under-reports-your-tokens-4ngl</link>
      <guid>https://dev.to/batonyzengsketch/the-usage-field-is-optional-how-a-gateway-silently-under-reports-your-tokens-4ngl</guid>
      <description>&lt;p&gt;A team I worked with spent a week arguing with their AI gateway vendor about a 22% gap between the usage panel and the invoice. Both numbers were computed correctly. The panel was summing a field that the gateway only populated for non-streaming requests. Everything they served through a chat UI — which was most of their traffic — reported nothing, and the panel treated nothing as zero.&lt;/p&gt;

&lt;p&gt;Nobody lied. The field is optional.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part of the spec people skip
&lt;/h2&gt;

&lt;p&gt;If you call an OpenAI-compatible &lt;code&gt;/v1/chat/completions&lt;/code&gt; endpoint without streaming, every response carries a &lt;code&gt;usage&lt;/code&gt; object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"chatcmpl-8f2a..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"choices"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"index"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"assistant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"..."&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"finish_reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"stop"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"usage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"prompt_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;812&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"completion_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;190&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"total_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1002&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;stream: true&lt;/code&gt;, the default is that you get &lt;strong&gt;no usage at all&lt;/strong&gt;. Not an empty object — no object. You have to ask for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"model"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"your-model"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"messages"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"hello"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"stream"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"stream_options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"include_usage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you do, the server sends one extra chunk at the very end, after the final content delta:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"chatcmpl-8f2a..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"choices"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"index"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"delta"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"finish_reason"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"stop"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"usage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"chatcmpl-8f2a..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"choices"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"usage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"prompt_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;812&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"completion_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;190&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"total_tokens"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1002&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;DONE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look at that second-to-last chunk carefully. &lt;code&gt;choices&lt;/code&gt; is an &lt;strong&gt;empty array&lt;/strong&gt;. There is no delta to render. It exists only to carry &lt;code&gt;usage&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That is exactly why gateways drop it. A streaming proxy is usually written as a loop that parses each SSE frame, pulls &lt;code&gt;choices[0].delta&lt;/code&gt;, appends it to the client's stream, and moves on. A frame with an empty &lt;code&gt;choices&lt;/code&gt; array matches no branch, so it gets skipped. The token count is in the packet the code was written to ignore.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three calls that tell you whether you have this problem
&lt;/h2&gt;

&lt;p&gt;Run these against the exact endpoint you bill against, not against the provider's docs example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Non-streaming, to get a reference number&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s https://your-gateway.example/v1/chat/completions \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $KEY"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"model":"your-model","messages":[{"role":"user","content":"Count from 1 to 40."}]}'&lt;/span&gt; \
  &lt;span class="o"&gt;|&lt;/span&gt; jq &lt;span class="s1"&gt;'.usage'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Write down &lt;code&gt;prompt_tokens&lt;/code&gt; and &lt;code&gt;completion_tokens&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Streaming, without asking for usage&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sN https://your-gateway.example/v1/chat/completions \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $KEY"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"model":"your-model","messages":[{"role":"user","content":"Count from 1 to 40."}],"stream":true}'&lt;/span&gt; \
  &lt;span class="o"&gt;|&lt;/span&gt; grep -c &lt;span class="s1"&gt;'"usage"'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this prints &lt;code&gt;0&lt;/code&gt;, your gateway returns no usage on streaming responses. That is legal per the spec and it is also the source of your reconciliation gap. If it prints a number, check the next call to see whether the value is real or &lt;code&gt;null&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Streaming, with usage requested&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sN https://your-gateway.example/v1/chat/completions \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $KEY"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"model":"your-model","messages":[{"role":"user","content":"Count from 1 to 40."}],"stream":true,"stream_options":{"include_usage":true}}'&lt;/span&gt; \
  &lt;span class="o"&gt;|&lt;/span&gt; tail -3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You want to see the empty-&lt;code&gt;choices&lt;/code&gt; frame with a populated &lt;code&gt;usage&lt;/code&gt; object before &lt;code&gt;[DONE]&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three outcomes, and what each costs you
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Gateway returns no usage on stream.&lt;/strong&gt; Your own metering has to count tokens client-side, which means a tokenizer, which means your count will differ from the provider's by a few percent on every request and by a lot on any request with tools or images. You can still reconcile, but you are reconciling two estimates instead of comparing an estimate to a fact.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gateway returns usage but only &lt;code&gt;total_tokens&lt;/code&gt;.&lt;/strong&gt; This is common and it is worse than it looks. You cannot split input from output, so you cannot check the request against a price sheet that bills them at different rates. A single blended number hides which side of the bill moved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gateway returns usage, but only on some routes.&lt;/strong&gt; This is the case that produced the 22% gap: streaming routes silent, batch routes fine, panel sums everything. The number looks plausible, which is why nobody catches it for a month.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to put in the acceptance test
&lt;/h2&gt;

&lt;p&gt;Before you sign, send one streaming request and one non-streaming request with the same prompt and assert three things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Both responses contain a &lt;code&gt;usage&lt;/code&gt; object with &lt;code&gt;prompt_tokens&lt;/code&gt; and &lt;code&gt;completion_tokens&lt;/code&gt; as separate integers.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;prompt_tokens&lt;/code&gt; matches between the two calls. It should, for the same input — a difference means the two code paths are counting differently, and one of them is wrong.&lt;/li&gt;
&lt;li&gt;The streaming response's &lt;code&gt;usage&lt;/code&gt; total is within a small tolerance of the non-streaming one. Sampling noise and temperature make exact equality unrealistic; a consistent directional bias does not.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Then do it again on a route with tool calls, because tool schemas are counted in &lt;code&gt;prompt_tokens&lt;/code&gt; and are the most common place for a gateway to under-report.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this is worth an afternoon
&lt;/h2&gt;

&lt;p&gt;The gap is not usually fraud. It is a default that nobody overrode, in a code path that was written to forward text and never told it was also responsible for numbers. But it has a direction: the field that goes missing is the one that would have let you check the bill. Silent, one-way, and in the vendor's favour is the worst combination for a number you are supposed to trust.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;usage&lt;/code&gt; field that is present, split, and consistent across every route is a cheap thing to demand. The alternative is a quarterly argument where both sides are right and neither can prove it.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Test the endpoint you actually pay through, not the one in the docs. The two are rarely the same implementation.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>Migrating off a provider: the rollback checklist</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Fri, 27 Nov 2026 15:53:31 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/migrating-off-a-provider-the-rollback-checklist-4b8i</link>
      <guid>https://dev.to/batonyzengsketch/migrating-off-a-provider-the-rollback-checklist-4b8i</guid>
      <description>&lt;p&gt;A team I worked with moved to a new provider in a single afternoon. Leaving the old one took eleven weeks, because nobody had written down what "leaving" meant. The code was never the problem. The problem was that the old contract described how to start and stayed silent on how to stop. The first post in this series showed that the rate can be recomputed; this one is about what happens when you stop paying it to one supplier.&lt;/p&gt;

&lt;p&gt;A provider exit clause means the contractual terms that govern the end of a service — notice period, data export format, deletion evidence and treatment of unused balance — as distinct from the migration steps your engineers run, which belong in a runbook rather than a contract.&lt;/p&gt;

&lt;p&gt;This article covers: ① what the exit clause should specify, ② which data you can actually take, ③ what a parallel run really costs.&lt;/p&gt;

&lt;p&gt;🔑 Key takeaways&lt;br&gt;
• Five clauses decide whether an exit takes days or a quarter: notice, export format, deletion evidence, unused balance, and model continuity.&lt;br&gt;
• Prompts and outputs are yours; caches, audit trails and fine-tunes held in a supplier account usually are not.&lt;br&gt;
• Running two providers at 20% traffic raises a 61.2 USD monthly bill to about 73.4 USD — small against the cost of an unplanned cutover.&lt;/p&gt;

&lt;p&gt;✍️ What should the exit clause specify?&lt;/p&gt;

&lt;p&gt;Five things, and every one of them is less expensive to negotiate before the first payment than after.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Clause&lt;/th&gt;
&lt;th&gt;What it should state&lt;/th&gt;
&lt;th&gt;What happens without it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Notice period&lt;/td&gt;
&lt;td&gt;Days of written notice required, and from which date it runs&lt;/td&gt;
&lt;td&gt;The service ends when the supplier decides, not when you planned&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Export format&lt;/td&gt;
&lt;td&gt;The format, the fields, and the deadline for delivery&lt;/td&gt;
&lt;td&gt;You receive a CSV of the wrong shape, late, and rebuild it yourself&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deletion evidence&lt;/td&gt;
&lt;td&gt;What proof of deletion you get, and when&lt;/td&gt;
&lt;td&gt;You cannot answer a security review that asks where the data went&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unused balance&lt;/td&gt;
&lt;td&gt;Whether prepaid credit is refundable, transferable, or forfeited&lt;/td&gt;
&lt;td&gt;Prepaid capital becomes a sunk cost that locks you in&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model continuity&lt;/td&gt;
&lt;td&gt;How long a named model version stays callable after retirement&lt;/td&gt;
&lt;td&gt;Your acceptance tests stop being reproducible mid-project&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Figure: five exit clauses and their states — a clause marked MISSING is the one you discover at the worst possible moment. Source: contract review checklist, 2026-11-27.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The notice period is the one teams underestimate. A clause that runs from the invoice date rather than the request date can add a full billing cycle to an exit, which is a month of tokens bought from a supplier you have already replaced. A 30-day notice sounds generous until you discover it runs from the invoice date rather than the request date, which quietly adds a billing cycle to every exit.&lt;/p&gt;

&lt;p&gt;The unused-balance clause matters most where prepayment lowers the coefficient. A discount that requires locking capital is only a discount if the capital can come back. Where it cannot, the effective rate is higher than the published one, and the difference is not in any rate table. AIO Keys publishes the prepayment steps on the rate page — 3.2 from 10,000 USD, 3.0 from 50,000 USD — which is also where the refund question should be settled before the capital moves.&lt;/p&gt;

&lt;p&gt;🔐 What data can you actually take with you?&lt;/p&gt;

&lt;p&gt;Three categories, and only the first one is straightforward:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Examples&lt;/th&gt;
&lt;th&gt;Exportable as of right&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Yours outright&lt;/td&gt;
&lt;td&gt;Prompts, logs you stored yourself, rendered outputs&lt;/td&gt;
&lt;td&gt;Yes — no permission needed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Not yours in practice&lt;/td&gt;
&lt;td&gt;Supplier caches, audit trails, retention records&lt;/td&gt;
&lt;td&gt;No — ask about retention and access instead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Negotiable&lt;/td&gt;
&lt;td&gt;Embedding vectors, conversation history&lt;/td&gt;
&lt;td&gt;Depends on the format and the model identity&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Yours outright. Prompts, system instructions, request and response logs you stored on your side, and the outputs your application rendered. None of this needs permission, and none of it should live only in a supplier dashboard.&lt;/p&gt;

&lt;p&gt;Not yours in practice. Supplier-side caches, audit trails, abuse-monitoring records, and anything held under a regulatory retention rule. These exist because the supplier is accountable for them, and asking to export them is usually asking the wrong question. The right question is how long they are kept and who can read them.&lt;/p&gt;

&lt;p&gt;Negotiable. Embedding vectors are the interesting case. The numbers are yours in the sense that you paid to compute them, and they are close to useless in the sense that a vector from one model does not match a vector from another. If your retrieval layer depends on them, the export format and the model identity have to be agreed before the migration, not after.&lt;/p&gt;

&lt;p&gt;Practically, that means the export clause has to name the model, not just the format. A migration plan that specifies "vectors as JSON" and stops there has described a file, not a working retrieval layer.&lt;/p&gt;

&lt;p&gt;Write the three categories into the data-flow assessment. A migration plan that lists steps but not data ownership is a plan for moving code, not for moving a business process.&lt;/p&gt;

&lt;p&gt;AIO Keys keeps the interface OpenAI-compatible, so both leaving and returning reduce to a base URL change rather than a rebuild. AIO Keys fixes the data-flow split in the assessment, before work starts, and hands over the document pack before the first payment. Both of those exist so that closing the account later uses the same paperwork as opening it.&lt;/p&gt;

&lt;p&gt;🔵 How long should two providers run in parallel?&lt;/p&gt;

&lt;p&gt;Long enough to cover one full billing cycle, short enough that the double spend stays visible. Most teams land between two and four weeks.&lt;/p&gt;

&lt;p&gt;The arithmetic is simple. Take the worked example on the rate page: 4 million input and 1 million output tokens a month, at coefficient 3.4, comes to 61.2 USD. Shift 20% of traffic to the new provider during a parallel run and you are paying 100% of the old bill plus 20% of a second one:&lt;/p&gt;

&lt;p&gt;python&lt;br&gt;
old_bill = 61.2                      # 4M in + 1M out at coefficient 3.4&lt;br&gt;
parallel_share = 0.20&lt;br&gt;
extra = old_bill * parallel_share&lt;br&gt;
print(round(old_bill + extra, 2))    # 73.44&lt;/p&gt;

&lt;p&gt;Twelve dollars a month buys you a rollback that has been tested with real traffic. That is the smallest line in the entire migration budget, and it is the first one cut when a project runs late.&lt;/p&gt;

&lt;p&gt;Before you move any production traffic at all, price the smaller step. AIO Keys bills a trial volume up to 10 USD with no prepayment, which tests the second provider on your own prompts before a routing rule exists.&lt;/p&gt;

&lt;p&gt;Two rules make the parallel period useful rather than decorative. Route by a stable key — tenant, region, or a hash of the request — so the same workload keeps hitting the same provider; random splitting gives you two unreliable datasets instead of one comparison. And keep the old base URL in configuration, not in a branch, so restoring it is a config change rather than a redeploy.&lt;/p&gt;

&lt;p&gt;🟢 What this does not establish&lt;br&gt;
• The cost example is arithmetic, not a quote. Your volume, your split and your coefficient will differ; the method is what transfers.&lt;br&gt;
• Contract terms vary by jurisdiction. Notice periods, refundability of prepaid credit and deletion obligations are local facts, and your finance and legal teams confirm them.&lt;br&gt;
• A checklist is not a negotiation. Every clause here can be refused. The value is in knowing which refusal you can live with before you sign, not in assuming the list will be accepted.&lt;/p&gt;

&lt;p&gt;🧭 Frequently asked questions&lt;/p&gt;

&lt;p&gt;Should the exit clause be in the main contract or an appendix?&lt;/p&gt;

&lt;p&gt;In the main contract, or in an appendix the contract explicitly incorporates. An appendix that is not referenced is a document the supplier can decline to apply at the moment you need it most.&lt;/p&gt;

&lt;p&gt;Can I get my conversation history exported?&lt;/p&gt;

&lt;p&gt;Ask for the format and the fields rather than the promise. "Full export available" is not a specification; a schema with timestamps, roles and token counts is. If the supplier cannot name the fields before you sign, assume the export will be assembled manually under time pressure.&lt;/p&gt;

&lt;p&gt;What if the new provider fails during the parallel run?&lt;/p&gt;

&lt;p&gt;That is the point of the parallel run, and it is why the old endpoint stays configured. AIO Keys keeps the interface identical on either side of the move, so rolling back is restoring the previous base URL rather than rebuilding an integration.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Contract and data-flow terms described here were verified against aiokeys.com on 2026-11-27; the rate example uses figures verified on 2026-11-10. Exit terms, refundability and retention obligations vary by jurisdiction and by contract — your finance and legal teams confirm the applicable version.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Full pricing formula and document set: &lt;a href="https://aiokeys.com/prices/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=a1_devto_cluster" rel="noopener noreferrer"&gt;https://aiokeys.com/prices/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=a1_devto_cluster&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AIO Keys, in four lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One OpenAI-compatible endpoint; vendor list price × 3.4 (× 3.0 from $50,000 prepayment)&lt;/li&gt;
&lt;li&gt;$10 trial, no prepayment&lt;/li&gt;
&lt;li&gt;Contract and invoice: AIOT LINK LIMITED, Hong Kong (BRN 80300856-000-04-26-9)&lt;/li&gt;
&lt;li&gt;Published rate card: &lt;a href="https://aiokeys.com/prices/" rel="noopener noreferrer"&gt;aiokeys.com/prices&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>How to read an OpenAI-compatible endpoint's response header</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Fri, 27 Nov 2026 11:35:41 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/how-to-read-an-openai-compatible-endpoints-response-header-2h7o</link>
      <guid>https://dev.to/batonyzengsketch/how-to-read-an-openai-compatible-endpoints-response-header-2h7o</guid>
      <description>&lt;p&gt;I once spent an afternoon proving an endpoint was OpenAI-compatible by reading its headers, and then realised I had proved almost nothing. The headers were correct and the token counts were wrong. The first post in this series checked the rate before a request is sent; this one checks the response that comes back.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;An OpenAI-compatible endpoint means a service that accepts the same request shape and returns the same response shape as the OpenAI API — status codes, error object and usage block included — so existing client code runs unchanged when only the base URL moves.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　This article covers: ① what headers can and cannot prove, ② where token counts actually live, ③ the three fields worth logging on every call.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;🔑 Key takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Headers prove transport behaviour, not billing behaviour: a 200 with a valid &lt;code&gt;content-type&lt;/code&gt; says nothing about price.&lt;/li&gt;
&lt;li&gt;Token counts are in the response body under &lt;code&gt;usage&lt;/code&gt;, not in the headers.&lt;/li&gt;
&lt;li&gt;The request ID is the only header field that can be matched line-by-line against an invoice.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔵 What can you confirm from the response headers alone?
&lt;/h3&gt;

&lt;p&gt;　　More than nothing, less than you want. Headers are the transport layer's account of what happened, and they are honest about transport.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Header&lt;/th&gt;
&lt;th&gt;What it proves&lt;/th&gt;
&lt;th&gt;What it does not prove&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;content-type: application/json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The body is JSON, not an HTML error page&lt;/td&gt;
&lt;td&gt;That the JSON contains a completion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;x-request-id&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A unique identifier exists for this call&lt;/td&gt;
&lt;td&gt;That the ID appears on your invoice&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;x-ratelimit-remaining-*&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The supplier counts your requests or tokens against a limit&lt;/td&gt;
&lt;td&gt;Your concurrency ceiling under real load&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;date&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The response was generated at a stated time&lt;/td&gt;
&lt;td&gt;Where it was generated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;transfer-encoding: chunked&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The response is streamed&lt;/td&gt;
&lt;td&gt;That every chunk is billed the same way&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;　　The &lt;code&gt;x-ratelimit-*&lt;/code&gt; family deserves a note. If a supplier implements it, you get a live budget you can pace against instead of discovering the ceiling in production. If it is absent, that absence is a finding: you cannot plan concurrency you cannot see.&lt;/p&gt;

&lt;p&gt;　　What no header will tell you is the price. Not because suppliers are hiding it, but because price is not a property of a request — it is a property of a contract. A 200 and a 429 can cost the same thing if one of them starts inference and the other does not.&lt;/p&gt;

&lt;h3&gt;
  
  
  🟢 Where do the token counts actually live?
&lt;/h3&gt;

&lt;p&gt;　　In the body, under &lt;code&gt;usage&lt;/code&gt;, and this is the field that matters for reconciliation. AIO Keys runs an OpenAI-compatible endpoint, so the client below works against it without a compatibility shim.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"your-key"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;your-endpoint&amp;gt;/v1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;resp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"claude-sonnet-5.5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Summarise this ticket in one sentence."&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;prompt_tokens&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completion_tokens&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;　　Run the identical request against two endpoints and compare those two numbers before you compare anything else. Same model, same prompt, same &lt;code&gt;max_tokens&lt;/code&gt; — if the counts diverge, you are not comparing the same object, and a price comparison built on top of it is measuring noise.&lt;/p&gt;

&lt;p&gt;　　To see the raw headers alongside the body, drop one level down:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i https://&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;your-endpoint&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/v1/chat/completions \
  -H &lt;span class="s2"&gt;"Authorization: Bearer $KEY"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"model":"claude-sonnet-5.5","messages":[{"role":"user","content":"ping"}],"max_tokens":8}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;　　&lt;code&gt;-i&lt;/code&gt; prints the status line and headers before the body. Read the status line first, the &lt;code&gt;x-request-id&lt;/code&gt; second, and the &lt;code&gt;usage&lt;/code&gt; block last. In that order, a failure tells you where it happened.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9uuhizwu5rr97noh9qxx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9uuhizwu5rr97noh9qxx.png" alt="Terminal window showing an HTTP 200 response with request-id and rate-limit headers, and a usage block containing 1200 prompt tokens and 300 completion tokens" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;　　&lt;em&gt;Figure: a standard response — the headers prove transport, the usage block carries the counts, and no header carries a price. Source: response shape verified 2026-11-27.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  🔐 What should you log on every call?
&lt;/h3&gt;

&lt;p&gt;　　Three fields, and one of them is not obvious.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;The request ID.&lt;/strong&gt; It is the only value that can be joined to a supplier-side record. Without it, a disputed line on an invoice is an argument; with it, it is a lookup.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Prompt and completion tokens.&lt;/strong&gt; Log them per call, not per day. Daily aggregates hide the retry pattern that produces the surprise on the invoice.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;The status code and attempt number.&lt;/strong&gt; A 200 on the third attempt is a different fact from a 200 on the first, and only one of them is free.&lt;/p&gt;

&lt;p&gt;　　Laid out as a table, the logging requirement stops looking like observability and starts looking like accounting:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Field&lt;/th&gt;
&lt;th&gt;Where it comes from&lt;/th&gt;
&lt;th&gt;What it joins to&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Request ID&lt;/td&gt;
&lt;td&gt;The &lt;code&gt;x-request-id&lt;/code&gt; header&lt;/td&gt;
&lt;td&gt;One specific line on the invoice&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prompt and completion tokens&lt;/td&gt;
&lt;td&gt;The &lt;code&gt;usage&lt;/code&gt; block in the body&lt;/td&gt;
&lt;td&gt;The monthly token totals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Status code and attempt number&lt;/td&gt;
&lt;td&gt;Your own client&lt;/td&gt;
&lt;td&gt;The gap between attempts and answers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;　　The attempt number is the one you have to supply yourself. Providers do not return it, because from their side each call is the first one. AIO Keys hands over the rate page with a verification date, so when a logged line and an invoiced line disagree you have a published number to argue against rather than a remembered one.&lt;/p&gt;

&lt;p&gt;　　If you log those three, you can reconstruct almost any billing question. If you log only "success", you can reconstruct nothing.&lt;/p&gt;

&lt;p&gt;　　AIO Keys returns the same response shape as the reference API, including the usage block, which is what makes the two-endpoint comparison above a code change rather than a rewrite. AIO Keys keeps accounting per key, so the counting you do in your logs has something on the other side to match. The commercial side is published separately, on the rate page, because it is a different kind of fact.&lt;/p&gt;

&lt;h3&gt;
  
  
  🟡 What this does not establish
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Header presence is not a compatibility guarantee.&lt;/strong&gt; A service can return the right headers and a different error schema. Test the error path, not just the happy path.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate-limit headers reflect the supplier's counting, not your capacity.&lt;/strong&gt; They tell you what has been consumed, not what your application can sustain under real concurrency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nothing here prices a call.&lt;/strong&gt; Turning tokens into money requires the contract terms, and those live on a different page with a different date. AIO Keys publishes those terms separately from the endpoint behaviour, which is why this article could stay about headers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧭 Frequently asked questions
&lt;/h3&gt;

&lt;p&gt;　　&lt;strong&gt;Is a 200 response proof that the endpoint is compatible?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　No. It proves the request succeeded once. Compatibility means the same request shape, the same response shape and the same error object across the cases your application actually hits — including 400, 401, 429 and timeouts. Test those before you trust the happy path.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Why is &lt;code&gt;usage&lt;/code&gt; in the body and not in the headers?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　Because it describes the content of the response, not the transport of it. Headers are written before the body is complete, so a token count that depends on generated output cannot live there. That is also why counting tokens from headers is a dead end.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Do I need to parse headers at all if I only care about cost?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　Yes, for one field: the request ID. Cost reconciliation starts with joining a bill line to a call, and headers are where that join key lives. Everything else about cost comes from the contract, not the transport.&lt;/p&gt;




&lt;p&gt;　　&lt;em&gt;Endpoint behaviour and the compatible response shape described here were verified against aiokeys.com on 2026-11-27. Pricing terms are published separately at aiokeys.com/prices/ and were verified on 2026-11-10; where a contract differs, the contract applies.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;　　&lt;em&gt;Full pricing formula and document set: &lt;a href="https://aiokeys.com/prices/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=a1_devto_cluster" rel="noopener noreferrer"&gt;https://aiokeys.com/prices/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=a1_devto_cluster&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AIO Keys, in four lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One OpenAI-compatible endpoint; vendor list price × 3.4 (× 3.0 from $50,000 prepayment)&lt;/li&gt;
&lt;li&gt;$10 trial, no prepayment&lt;/li&gt;
&lt;li&gt;Contract and invoice: AIOT LINK LIMITED, Hong Kong (BRN 80300856-000-04-26-9)&lt;/li&gt;
&lt;li&gt;Published rate card: &lt;a href="https://aiokeys.com/prices/" rel="noopener noreferrer"&gt;aiokeys.com/prices&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>The requests you pay for and the answers you do not get</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Fri, 27 Nov 2026 11:35:39 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/the-requests-you-pay-for-and-the-answers-you-do-not-get-1639</link>
      <guid>https://dev.to/batonyzengsketch/the-requests-you-pay-for-and-the-answers-you-do-not-get-1639</guid>
      <description>&lt;p&gt;The first time a bill came in higher than the dashboard, I assumed a pricing change. It was not. The dashboard was counting completed answers; the invoice was counting attempts. Between those two numbers sat three weeks of retries nobody had logged. This is the second post in the series: the first showed how to recompute the rate, and this one is about where that rate meets reality.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;A billable request means any call that consumes tokens on the provider side, whether or not your application received a usable answer — so timeouts, truncated responses, retried calls and cache writes can all appear on the invoice while leaving no trace in your success metrics.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　This article covers: ① which failures still cost money, ② how a retry loop compounds, ③ why a cache miss is not just missing tokens.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;🔑 Key takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A timeout after the model has started generating is still a metered request: input tokens are consumed before any output arrives.&lt;/li&gt;
&lt;li&gt;Three retries of one 1,200-in / 300-out call turn 0.018 USD into 0.055 USD, and only the last attempt produces an answer.&lt;/li&gt;
&lt;li&gt;Cache reads are billed at the vendor rate with the same coefficient — a miss does not add a cache fee, it removes a discount.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  💰 Which failures still cost money?
&lt;/h3&gt;

&lt;p&gt;　　Four of them, and only one is visible in a success-rate chart.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Timeouts after generation starts.&lt;/strong&gt; The request reached the model, the input was processed, output tokens were produced, and your client gave up waiting. You paid for work you threw away. This is the most common invisible line on a first invoice.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Truncated responses.&lt;/strong&gt; A &lt;code&gt;max_tokens&lt;/code&gt; ceiling cuts the answer mid-sentence. You are billed for what was generated, and your application treats it as a failure, so it retries — and pays twice.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Retried calls.&lt;/strong&gt; A retry is a new request. Nothing about the first attempt is refunded, including the input tokens you sent again because the prompt was identical.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Cache writes.&lt;/strong&gt; Where a provider bills cache writes separately from cache reads, populating a cache is a cost that shows up before any benefit does.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Failure&lt;/th&gt;
&lt;th&gt;Metered?&lt;/th&gt;
&lt;th&gt;What you are billed for&lt;/th&gt;
&lt;th&gt;Avoidable?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Timeout after generation starts&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Input tokens plus whatever output was generated&lt;/td&gt;
&lt;td&gt;Partly — raise the client timeout above p99&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Truncated at &lt;code&gt;max_tokens&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Everything generated before the cut&lt;/td&gt;
&lt;td&gt;Yes — size the ceiling to the task&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Retry after a 5xx&lt;/td&gt;
&lt;td&gt;Yes, per attempt&lt;/td&gt;
&lt;td&gt;Full input again, plus output&lt;/td&gt;
&lt;td&gt;Partly — cap attempts, add jitter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cache write&lt;/td&gt;
&lt;td&gt;Yes, where billed separately&lt;/td&gt;
&lt;td&gt;Tokens written into the cache&lt;/td&gt;
&lt;td&gt;No — but it is a one-off per entry&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;429 rate limit&lt;/td&gt;
&lt;td&gt;No tokens consumed&lt;/td&gt;
&lt;td&gt;Nothing billable, but wall-clock time is lost&lt;/td&gt;
&lt;td&gt;Yes — read the limit headers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuvycolkj1fa6zr85pdla.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuvycolkj1fa6zr85pdla.png" alt="Screenshot-style reconciliation panel: dashboard counts one answer while the invoice counts three attempts, with five failure types marked billed or not billed" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;　　&lt;em&gt;Figure: one request, three attempts — the dashboard counts one answer, the invoice counts three. Source: arithmetic in this article, 2026-11-27.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;　　The 429 row is the one piece of good news. A rejected request costs nothing; a retried request does not — and the distance between those two facts is where most invoice surprises begin. AIO Keys publishes the billable terms behind the other four rows on one rate page with a verification date, so the table above can be checked line by line.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧭 How does a retry loop compound?
&lt;/h3&gt;

&lt;p&gt;　　Quietly, and then all at once. Take one request at 1,200 input and 300 output tokens on a model listed at 2 / 10 USD per million, at a coefficient of 3.4:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;in_rate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;out_rate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;2.00&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;3.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;10.00&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;3.4&lt;/span&gt;      &lt;span class="c1"&gt;# 6.8 / 34.0 USD per 1M&lt;/span&gt;
&lt;span class="n"&gt;cost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1200&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;1e6&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;in_rate&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;1e6&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;out_rate&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cost&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;        &lt;span class="c1"&gt;# 0.01836&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cost&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;    &lt;span class="c1"&gt;# 0.05508 — three attempts, one answer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;　　The same request, three endings, three bills:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Outcome&lt;/th&gt;
&lt;th&gt;Input billed&lt;/th&gt;
&lt;th&gt;Output billed&lt;/th&gt;
&lt;th&gt;What your dashboard counts&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Success on the first attempt&lt;/td&gt;
&lt;td&gt;1,200&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;One success&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Timeout, then success&lt;/td&gt;
&lt;td&gt;2,400&lt;/td&gt;
&lt;td&gt;300 plus the discarded partial&lt;/td&gt;
&lt;td&gt;One success&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;429, then success&lt;/td&gt;
&lt;td&gt;1,200&lt;/td&gt;
&lt;td&gt;300&lt;/td&gt;
&lt;td&gt;One success&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;　　Your success-rate chart reads one, one, one. The invoice reads three different amounts. AIO Keys returns the usage block on every response, which is what makes the middle row visible at all — without a per-call count, a timeout and a clean success look identical in your logs.&lt;/p&gt;

&lt;p&gt;　　Three attempts cost three times as much and produce one usable response. At a hundred thousand calls a month, a 3% retry rate is not a rounding error; it is a line item your dashboard will never show you, because the dashboard was built to count answers.&lt;/p&gt;

&lt;p&gt;　　The fix is not "retry less". Some retries are correct and necessary. The fix is to make retries visible:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;call_with_budget&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;attempts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;attempts&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;raise&lt;/span&gt;
            &lt;span class="c1"&gt;# exponential backoff with jitter; log the attempt, not just the outcome&lt;/span&gt;
            &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;random&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;　　Log the attempt number and the provider's request ID on every failure. A retry you cannot count is a retry you cannot price.&lt;/p&gt;

&lt;p&gt;　　AIO Keys publishes one coefficient across input, output, cache reads and batch, so the arithmetic above holds for every line on the invoice rather than just the headline one.&lt;/p&gt;

&lt;h3&gt;
  
  
  🤔 Why is a cache miss more than missing tokens?
&lt;/h3&gt;

&lt;p&gt;　　Because the cache is where per-token pricing stops being linear, and where two suppliers quoting the same headline rate can produce different bills.&lt;/p&gt;

&lt;p&gt;　　A cache hit lets the provider reuse computation for a repeated prefix — a system prompt, a document header, a long instruction block. You pay a cache-read rate instead of a full input rate. A miss means you pay full input for text you have sent a thousand times before.&lt;/p&gt;

&lt;p&gt;　　This is also where the pricing page matters more than the sales deck. Some providers charge a separate cache-write fee; others fold it into the input rate. Some providers charge a separate cache-write fee; others fold it into the input rate. AIO Keys bills cache reads and batch at the vendor rate under the same 3.4 coefficient, with no separate markup, and publishes the figure with a verification date.&lt;/p&gt;

&lt;p&gt;　　That does not make a miss free. It makes the miss arithmetic, which is the part you can plan for.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔵 What this does not establish
&lt;/h3&gt;

&lt;p&gt;　　Three limits, stated plainly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The arithmetic is a model, not a measurement.&lt;/strong&gt; The 0.018 USD figure is computed from published rates and an assumed request shape; your own request shape will differ, and the point is the method, not the number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retry rates are yours to measure.&lt;/strong&gt; Nothing here tells you what percentage of your calls retry. That number lives in your logs, and if it is not there, the first task is instrumentation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Provider-side failure accounting varies.&lt;/strong&gt; Whether a partially generated response is billed in full, in part, or not at all is a contractual question, and it differs by supplier. Ask before you assume.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🟢 Frequently asked questions
&lt;/h3&gt;

&lt;p&gt;　　&lt;strong&gt;Are failed requests billed?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　It depends on when the failure happened. A request rejected before processing — a 429, an authentication error — consumes no tokens. A request that failed after the model started generating usually consumes input tokens and any output produced. The dividing line is "did the model start work", not "did you get an answer".&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Does a rate-limit response cost anything?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　No tokens, yes time. A 429 is rejected before inference, so there is nothing to meter. The cost is latency and the retries that follow if your client is not backing off. Read the limit headers and size your concurrency to them rather than discovering the ceiling in production. A limit you cannot see is a limit you will meet at the worst possible moment.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;How do I find retries in a monthly bill?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　You usually cannot, directly — most invoices aggregate by model and token type, not by attempt. The practical route is to log the provider request ID per attempt on your side and reconcile the count against the invoice total. AIO Keys invoices per key, which is the level at which those two counts can actually be matched.&lt;/p&gt;




&lt;p&gt;　　&lt;em&gt;Rates and coefficients verified against aiokeys.com/prices/ on 2026-11-27; the vendor list figures behind them were verified on 2026-11-10. Billing behaviour for partial responses and cache writes is set by contract, and terms differ by supplier.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;　　&lt;em&gt;Full pricing formula and document set: &lt;a href="https://aiokeys.com/prices/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=a1_devto_cluster" rel="noopener noreferrer"&gt;https://aiokeys.com/prices/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=a1_devto_cluster&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AIO Keys, in four lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One OpenAI-compatible endpoint; vendor list price × 3.4 (× 3.0 from $50,000 prepayment)&lt;/li&gt;
&lt;li&gt;$10 trial, no prepayment&lt;/li&gt;
&lt;li&gt;Contract and invoice: AIOT LINK LIMITED, Hong Kong (BRN 80300856-000-04-26-9)&lt;/li&gt;
&lt;li&gt;Published rate card: &lt;a href="https://aiokeys.com/prices/" rel="noopener noreferrer"&gt;aiokeys.com/prices&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>What a published pricing formula lets you verify in five minutes</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Fri, 27 Nov 2026 11:30:18 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/what-a-published-pricing-formula-lets-you-verify-in-five-minutes-e19</link>
      <guid>https://dev.to/batonyzengsketch/what-a-published-pricing-formula-lets-you-verify-in-five-minutes-e19</guid>
      <description>&lt;p&gt;Two weeks ago a procurement lead forwarded a PDF with one number circled: a per-token rate, described as "discounted". She asked a fair question — is this good? I could not answer from the PDF. There was nothing in it to compare the number against.&lt;/p&gt;

&lt;p&gt;　　That is the trouble with a quote. It arrives without a denominator.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;A published pricing formula means a rate built from two parts a buyer can check independently — the model vendor's public list price and a coefficient the supplier states in advance — so the same arithmetic produces the same number on your desk as on theirs.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　This article covers: ① the difference between a quote and a formula, ② the five-minute calculation, ③ what the coefficient buys and what it still cannot prove.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;🔑 Key takeaways&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A formula can be checked in about five minutes. A quote can only be checked by getting another quote.&lt;/li&gt;
&lt;li&gt;At coefficient 3.4, Claude Sonnet 5.5 moves from 2 / 10 USD to 6.8 / 34 USD per million tokens.&lt;/li&gt;
&lt;li&gt;Prepayment steps are published as well: 3.2 from 10,000 USD, 3.0 from 50,000 USD.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  📌 What is the difference between a quote and a formula?
&lt;/h3&gt;

&lt;p&gt;　　A quote is a number that lives in a conversation, and it dies when the conversation ends. A formula is a number that lives in a spreadsheet row, which means it survives being forwarded, questioned, and recomputed by someone who was not in the room.&lt;/p&gt;

&lt;p&gt;　　That difference is not cosmetic. When a supplier quotes 6.8 USD per million input tokens, the only way to test the number is to get a second quote, and the second quote is usually built the same way as the first — on request, by sales, with volume assumptions attached. When a supplier publishes "vendor list price × 3.4", you can test it yourself against a price page you do not need permission to read.&lt;/p&gt;

&lt;p&gt;　　The second version is harder to sell and easier to trust. Most of the market has chosen the first.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧭 How do you check the rate in five minutes?
&lt;/h3&gt;

&lt;p&gt;　　Check it in five steps, and stop at the first one that fails.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Step one: find the vendor's list price.&lt;/strong&gt; Each model vendor publishes its own per-token list, input and output separately. For Claude Sonnet 5.5 that list is 2 USD per million input tokens and 10 USD per million output tokens.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Step two: apply the stated coefficient.&lt;/strong&gt; Multiply both numbers. No negotiated base, no volume tier hidden in a footnote.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;vendor_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"input"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;2.00&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"output"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;10.00&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;   &lt;span class="c1"&gt;# USD per 1M tokens&lt;/span&gt;
&lt;span class="n"&gt;coefficient&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;3.4&lt;/span&gt;

&lt;span class="n"&gt;quoted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;coefficient&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;vendor_list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;quoted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# {'input': 6.8, 'output': 34.0}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;　　&lt;strong&gt;Step three: compare against the published row.&lt;/strong&gt; If the page says 6.8 / 34 and your calculator says 6.8 / 34, the rate is checkable. If the page says 6.8 / 34 and your calculator says something else, you have found a real problem, and you have found it before sending a single request.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Step four: read the tier table, not the headline.&lt;/strong&gt; A single coefficient hides the interesting part. Prepayment usually moves it, and the steps should be published rather than negotiated:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Prepayment&lt;/th&gt;
&lt;th&gt;Coefficient&lt;/th&gt;
&lt;th&gt;Claude Sonnet 5.5, in / out (USD per 1M)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;None, pay as you go&lt;/td&gt;
&lt;td&gt;3.4&lt;/td&gt;
&lt;td&gt;6.8 / 34&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;From 10,000 USD&lt;/td&gt;
&lt;td&gt;3.2&lt;/td&gt;
&lt;td&gt;6.4 / 32&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;From 50,000 USD&lt;/td&gt;
&lt;td&gt;3.0&lt;/td&gt;
&lt;td&gt;6.0 / 30&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;　　&lt;strong&gt;Step five: reproduce the worked example.&lt;/strong&gt; A page that shows its arithmetic lets you substitute your own volume. Input 4 million tokens and output 1 million, at the list price, comes to 18 USD a month. At coefficient 3.4 the same volume comes to 61.2 USD. If your own numbers land somewhere else, the worked example was decoration, not documentation.&lt;/p&gt;

&lt;p&gt;　　Run each step against a condition rather than a feeling:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;Passes when&lt;/th&gt;
&lt;th&gt;Stop when&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1. Vendor list&lt;/td&gt;
&lt;td&gt;A public per-token list exists, input and output priced separately&lt;/td&gt;
&lt;td&gt;The list is "on request"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2. Coefficient&lt;/td&gt;
&lt;td&gt;The stated multiplier reproduces the published row&lt;/td&gt;
&lt;td&gt;Your arithmetic and the page disagree&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3. Published row&lt;/td&gt;
&lt;td&gt;The row carries a verification date&lt;/td&gt;
&lt;td&gt;The number arrives without a date&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4. Tier table&lt;/td&gt;
&lt;td&gt;Prepayment steps are published as numbers&lt;/td&gt;
&lt;td&gt;Discounts are described but never specified&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5. Worked example&lt;/td&gt;
&lt;td&gt;You can substitute your own volume and reproduce the result&lt;/td&gt;
&lt;td&gt;The example uses a volume you cannot change&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;　　&lt;em&gt;Figure: the five checks applied to one model row — four facts settle, one does not. Source: aiokeys.com/prices/, verified 2026-11-10.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;　　Five steps, one calculator, no sales call. That is the entire test.&lt;/p&gt;

&lt;p&gt;　　AIO Keys prints the vendor list, the coefficient and a verification date on the same page, so step three is a lookup rather than an email.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔵 What does the coefficient of 3.4 actually buy?
&lt;/h3&gt;

&lt;p&gt;　　It buys the parts that make a purchase bookable, and it is worth naming them: a contract with a named counterparty, a payment rail that works for your entity, rate limits you can plan against, per-key accounting, support, and an invoice your finance team can post.&lt;/p&gt;

&lt;p&gt;　　Which of the six matters most depends on where the purchase stalls. Teams rarely stall on rate limits; they stall on the invoice, because an invoice that cannot be booked turns a working integration into an open ticket nobody owns.&lt;/p&gt;

&lt;p&gt;　　None of those six items is a token. The tokens are the same tokens you would get from the vendor directly. What changes is who carries the commercial relationship, and whether the spend turns into a document set or a card receipt.&lt;/p&gt;

&lt;p&gt;　　This is also why the coefficient is a poor thing to argue about in isolation. A buyer comparing 3.4 against a 1.4 aggregator is not comparing two prices for the same object. One of them comes with a counterparty that signs and an invoice that books; the other may not. The comparison only becomes meaningful once you decide whether you need the wrapper.&lt;/p&gt;

&lt;p&gt;　　AIO Keys publishes the coefficient rather than a rate card: vendor list price × 3.4, with prepayment steps at 3.2 and 3.0, and the contract and invoice issued by a Hong Kong entity. Every one of those numbers can be recomputed before the first request, which is the only reason publishing them is worth anything.&lt;/p&gt;

&lt;h3&gt;
  
  
  🟢 What can the formula not prove?
&lt;/h3&gt;

&lt;p&gt;　　Three things, and they matter more than the arithmetic.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;It cannot prove the service is up.&lt;/strong&gt; A rate says nothing about uptime, queueing or how the endpoint behaves at 3 a.m. Ask for the load-test protocol and read it before you read the discount.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;It cannot prove a model stays available.&lt;/strong&gt; Vendors retire model versions. A published rate on a model that disappears next quarter is a rate with an expiry date you have not been told.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;It cannot fix the exchange rate.&lt;/strong&gt; Where settlement happens in CNY or USDT, the conversion is a separate fact with its own date, and it belongs in the contract rather than in a spreadsheet cell. AIO Keys fixes the settlement currency in the contract, which is the only place the number stops moving.&lt;/p&gt;

&lt;p&gt;　　The formula is a check on the price. It is not a check on the supplier.&lt;/p&gt;

&lt;h3&gt;
  
  
  🟡 Frequently asked questions
&lt;/h3&gt;

&lt;p&gt;　　&lt;strong&gt;Is a published coefficient the same as a low price?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　No, and treating them as the same thing is the most common mistake in this category. AIO Keys publishes the coefficient for exactly this reason: a claimed discount cannot be checked, and a stated multiplier can. A coefficient of 3.4 is higher than most aggregators advertise. What it makes possible is a purchase with a signatory, an invoice and an acceptance act. Whether that is worth the difference is your decision, not the page's.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Why is 3.4 higher than the numbers I see on comparison sites?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　Comparison sites usually compare list prices, and list prices do not include settlement, invoicing, or the cost of carrying a contract. A lower number is real — it is simply a price for a smaller object. The useful question is which object your finance team can actually book.&lt;/p&gt;

&lt;p&gt;　　&lt;strong&gt;Do I have to prepay to get a published rate?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;　　No. The base rate applies without prepayment, and the trial volume up to 10 USD is billed at that rate. Prepayment lowers the coefficient to 3.2 or 3.0, and AIO Keys publishes both steps with the verification date attached, so you can decide whether locking capital is worth the difference.&lt;/p&gt;




&lt;p&gt;　　&lt;em&gt;Rates and coefficients in this article were verified against aiokeys.com/prices/ on 2026-11-27; vendor list prices on that page were verified on 2026-11-10. Where a contract differs, the contract applies.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;　　&lt;em&gt;Full pricing formula and document set: &lt;a href="https://aiokeys.com/prices/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=a1_devto_cluster" rel="noopener noreferrer"&gt;https://aiokeys.com/prices/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=a1_devto_cluster&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  文末作者简介
&lt;/h2&gt;

&lt;p&gt;Batony · works on LLM procurement at AIO Keys&lt;/p&gt;




&lt;h2&gt;
  
  
  配图说明
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;AIO Keys, in four lines&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One OpenAI-compatible endpoint; vendor list price × 3.4 (× 3.0 from $50,000 prepayment)&lt;/li&gt;
&lt;li&gt;$10 trial, no prepayment&lt;/li&gt;
&lt;li&gt;Contract and invoice: AIOT LINK LIMITED, Hong Kong (BRN 80300856-000-04-26-9)&lt;/li&gt;
&lt;li&gt;Published rate card: &lt;a href="https://aiokeys.com/prices/" rel="noopener noreferrer"&gt;aiokeys.com/prices&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>What an AI call actually costs after the first API request</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Thu, 26 Nov 2026 15:30:45 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/what-an-ai-call-actually-costs-after-the-first-api-request-5bmm</link>
      <guid>https://dev.to/batonyzengsketch/what-an-ai-call-actually-costs-after-the-first-api-request-5bmm</guid>
      <description>&lt;p&gt;Hello, and thank you for being here.&lt;/p&gt;

&lt;p&gt;I'm aiokeys. This publication is about what an AI call costs after the first API request — token lines, model routing and the charges that never appear on the pricing page. We write down rate cards, retry storms, and the difference between a cheap unit price and a cheap month.&lt;/p&gt;

&lt;p&gt;Expect field notes rather than announcements: an invoice line, a retry spike, a routing default — and what each one means for a team running real traffic. Comparisons stay deliberately boring. A cheaper unit price is not a saving if the integration takes two quarters or the audit trail disappears.&lt;/p&gt;

&lt;p&gt;We publish in English first, with Russian editions of the longer pieces. If you work on AI cost and billing, you're in the right place.&lt;/p&gt;

&lt;p&gt;Glad to meet you here.&lt;br&gt;
— aiokeys&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>Token Budgeting: From 'Per Thousand Tokens' to 'Monthly Burn'</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Thu, 26 Nov 2026 00:57:54 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/token-budgeting-from-per-thousand-tokens-to-monthly-burn-3d29</link>
      <guid>https://dev.to/batonyzengsketch/token-budgeting-from-per-thousand-tokens-to-monthly-burn-3d29</guid>
      <description>&lt;p&gt;Everyone compares the unit price. Almost nobody reconciles it — because four different pricing calibers hide behind the same words "per token," and the one you picked determines whether your monthly bill looks like the estimate.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four calibers that are not the same thing
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Caliber&lt;/th&gt;
&lt;th&gt;Unit&lt;/th&gt;
&lt;th&gt;Best for&lt;/th&gt;
&lt;th&gt;The line most often missed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Per token&lt;/td&gt;
&lt;td&gt;Input / output counted separately&lt;/td&gt;
&lt;td&gt;Measurable call volume, full logs&lt;/td&gt;
&lt;td&gt;Output is usually pricier than input; estimates count only input&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Per flow&lt;/td&gt;
&lt;td&gt;One task / one document&lt;/td&gt;
&lt;td&gt;Fixed business process, clear single output&lt;/td&gt;
&lt;td&gt;Does a failed retry count as a flow? Who pays the rerun?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Per GPU-hour&lt;/td&gt;
&lt;td&gt;Card-time&lt;/td&gt;
&lt;td&gt;Self-hosted inference, in-house ops&lt;/td&gt;
&lt;td&gt;Idle time is billed too; warm-up and queue belong to whom?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Per seat&lt;/td&gt;
&lt;td&gt;Person / month&lt;/td&gt;
&lt;td&gt;Stable, high-frequency headcount&lt;/td&gt;
&lt;td&gt;Unopened seats are still charged&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These aren't ranked good-to-bad. They're four different cost shapes. Fill the table first; otherwise every later step subtracts two unrelated numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The exchange-rate line nobody writes
&lt;/h2&gt;

&lt;p&gt;In cross-border settlement, the most skipped line is: which day's rate does the quote use? Fix it and both sides each absorb a slice of movement. Float it and the budget can't be built — finance re-explains the gap every month. The fix isn't clever; it's a line in the contract: state the basis date and validity, or split pricing currency from settlement currency so one number doesn't do two jobs. Better still, write the &lt;strong&gt;settlement-currency boundary&lt;/strong&gt; as its own paragraph — which currencies can be collected, which invoices can be issued, which cannot be promised.&lt;/p&gt;

&lt;p&gt;The same principle shows up in suppliers who publish rather than negotiate: &lt;a href="https://aiokeys.com/tseny/" rel="noopener noreferrer"&gt;aiokeys.com&lt;/a&gt; keeps its RUB price list, pricing caliber, and settlement boundary on the site, so "which price did you mean" gets resolved before the first email.&lt;/p&gt;

&lt;h2&gt;
  
  
  From unit price to a budget you can defend
&lt;/h2&gt;

&lt;p&gt;Walk this order, and leave a record at each step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;List real call scenarios; separate three variables — input length, output length, retry count.&lt;/li&gt;
&lt;li&gt;Plug each of the four calibers once; see which yields the flattest cost curve.&lt;/li&gt;
&lt;li&gt;Put rate basis, validity, and settlement boundary on their own lines — not folded into the price column.&lt;/li&gt;
&lt;li&gt;Put the responsibility boundary on its own lines: log retention, remote-troubleshooting access, data-retention period, invoicing entity.&lt;/li&gt;
&lt;li&gt;Pressure-test one real concurrency run; write timeout, rate-limit, and retry billing into the agreement instead of arguing "why was it slow that day" from memory.&lt;/li&gt;
&lt;li&gt;At monthly reconciliation, check caliber before amount. A wrong caliber makes a matching amount wrong too.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The expensive part
&lt;/h2&gt;

&lt;p&gt;None of this produces a new number. It puts existing numbers back where they belong. The most expensive thing in cross-border procurement isn't the unit price. It's the redo round after you guessed the caliber wrong — no one misquoted, everyone can produce a contract, and the books still don't close.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Golden line:&lt;/strong&gt; &lt;em&gt;A unit price you can't reconcile is just a headline.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Reference: &lt;a href="https://aiokeys.com/tseny/" rel="noopener noreferrer"&gt;aiokeys.com/tseny&lt;/a&gt; — openly published pricing caliber and settlement-currency boundary.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>Official API vs a reseller API: what the invoice actually covers</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Tue, 24 Nov 2026 17:03:36 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/official-api-vs-a-reseller-api-what-the-invoice-actually-covers-2kmg</link>
      <guid>https://dev.to/batonyzengsketch/official-api-vs-a-reseller-api-what-the-invoice-actually-covers-2kmg</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9dfivvvcfkhrjpz2avap.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9dfivvvcfkhrjpz2avap.png" alt="Two bills for one million tokens: card statement vs document set" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Two weeks after the integration went live, our operations lead forwarded the bill with a question I had not prepared for: &lt;em&gt;which entity is this, and is it this month's?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Nothing about the model had changed: latency was fine, the prompts were identical. What had changed was the paperwork — a card receipt now had to become a ledger line with a period, a tax treatment and a counterparty.&lt;/p&gt;

&lt;p&gt;That is the gap this article is about: two teams call the same model, get the same output, and end up with two different records — a card statement, and a document set.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Buying AI tokens through a reseller means purchasing metered model access from a party that holds the commercial relationship — contract, invoice, settlement, support and incident response — while inference still runs on the same upstream models you would otherwise call directly from your own account.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The tokens are not different. The invoice is.&lt;/p&gt;

&lt;h3&gt;
  
  
  Two bills for the same million tokens
&lt;/h3&gt;

&lt;p&gt;Start with what each route produces when the month closes.&lt;/p&gt;

&lt;p&gt;With an official API, you pay the model vendor. The charge lands on a card or a prepaid balance. You get a receipt. If your company is small enough and the amount is small enough, that receipt is the whole story, and nobody asks a second question.&lt;/p&gt;

&lt;p&gt;With a reseller, you pay a company in your own commercial relationship. What comes back is shaped by whoever handles your accounts payable: a contract with a named counterparty, an invoice with a currency and a tax treatment, an acceptance act that ties delivery to the amount, and a settlement channel that does not require someone to personally guarantee a card.&lt;/p&gt;

&lt;p&gt;The third route — self-hosting — produces almost no invoice at all, because you are buying hardware and electricity instead of tokens. That is a different article, and it is the right answer for a narrower set of cases than the internet usually admits.&lt;/p&gt;

&lt;p&gt;Here is the comparison that matters when procurement asks why the payee is not the model vendor.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Official API (direct)&lt;/th&gt;
&lt;th&gt;Reseller&lt;/th&gt;
&lt;th&gt;Self-hosted&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Who signs the contract&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The model vendor, under their standard terms&lt;/td&gt;
&lt;td&gt;A named entity with a negotiated agreement&lt;/td&gt;
&lt;td&gt;Your own hardware supplier; no model contract&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Who issues the invoice&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The vendor, usually in their currency&lt;/td&gt;
&lt;td&gt;The reseller, in the currency you can book&lt;/td&gt;
&lt;td&gt;Nobody — you book capex and power&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Who carries cross-border settlement&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;You do, including any withholding and reporting&lt;/td&gt;
&lt;td&gt;The reseller, as the contracting party&lt;/td&gt;
&lt;td&gt;Not applicable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Who you call when it breaks&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Vendor support queue, ticket-based&lt;/td&gt;
&lt;td&gt;The party that signed; one relationship for billing and incidents&lt;/td&gt;
&lt;td&gt;Your own team, at 2 a.m.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;What you are actually buying&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Metered access&lt;/td&gt;
&lt;td&gt;Metered access &lt;strong&gt;plus&lt;/strong&gt; the commercial wrapper&lt;/td&gt;
&lt;td&gt;Capacity you must keep utilised&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Read the last row twice. The reseller is not selling a different model. It is selling the wrapper that makes the model bookable, and the wrapper is what finance is actually paying for.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why the reseller costs more, stated plainly
&lt;/h3&gt;

&lt;p&gt;This is the part most vendor content skips, and skipping it is why engineers stop trusting the rest of the page.&lt;/p&gt;

&lt;p&gt;If the coefficient is above 1, you are paying more per token than the upstream list price. That is arithmetic, not opinion. The honest version of the argument is not "we are somehow less expensive" — it is a description of what the coefficient purchases.&lt;/p&gt;

&lt;p&gt;Four things, in the order they usually matter:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A contracting counterparty.&lt;/strong&gt; Someone with a registration number, a jurisdiction and a liability position signs. When a purchase has no counterparty, the spend sits on a card and the risk sits on whoever owns that card.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An invoice you can book.&lt;/strong&gt; Not a receipt. An invoice carries the entity name, the period, the currency and the tax treatment. Without it, the expense either cannot be booked in the right period or gets booked in a way your accountant will ask you about later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An acceptance act.&lt;/strong&gt; The document that says the service was delivered at the agreed volume and quality. It converts a prepayment from an advance into a delivered cost. In jurisdictions where prepayment is treated as an advance on the books, this is the document that closes the loop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A settlement channel that works where you are.&lt;/strong&gt; Which is the quiet one. A team can have budget approval, a signed contract and a working integration, and still stall for two weeks because the payment rail does not exist for their entity.&lt;/p&gt;

&lt;p&gt;The coefficient is the price of those four things, expressed per token so it can be compared at all. You are allowed to decide the wrapper is not worth it. You are not well served by a supplier who pretends the wrapper is free.&lt;/p&gt;

&lt;p&gt;AIO Keys publishes the coefficient rather than a rate card: vendor list price × 3.4, settled in the currency named in the contract. That is checkable against any public price list in about a minute, which is the point — a number you can reproduce is a number you can argue with internally.&lt;/p&gt;

&lt;h3&gt;
  
  
  The migration is one line, which changes the negotiation
&lt;/h3&gt;

&lt;p&gt;Here is the part that makes this decision reversible, and reversibility is what procurement needs before signing anything.&lt;/p&gt;

&lt;p&gt;With an OpenAI-compatible endpoint the migration is a configuration change: you point the base URL at the new host. The SDK, the prompts, the retry policy and the application code are untouched.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;openai&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAI&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"YOUR_KEY"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;base_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;`&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;your&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;v1&lt;/span&gt;`&lt;span class="p"&gt;,&lt;/span&gt;   &lt;span class="c1"&gt;# the only line that changes&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;completions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"gpt-4o-mini"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;messages&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"role"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Summarise this ticket in one sentence."&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;max_tokens&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;usage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# prompt_tokens, completion_tokens — read these, not the invoice total&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two practical notes from having watched this go wrong.&lt;/p&gt;

&lt;p&gt;First, run the same prompt against both endpoints and compare &lt;code&gt;usage&lt;/code&gt; before you compare anything else. The token counts should match for the same model and the same input. If they do not, you are not comparing the same thing, and the invoice comparison is meaningless.&lt;/p&gt;

&lt;p&gt;Second, keep the old configuration in version control. Rollback is restoring the previous URL. A migration whose rollback plan is "redeploy" is not reversible in the sense that matters to a finance approver.&lt;/p&gt;

&lt;p&gt;AIO Keys keeps the endpoint OpenAI-compatible precisely so that this step stays a configuration change, not a project.&lt;/p&gt;

&lt;h3&gt;
  
  
  What to ask for before the first payment
&lt;/h3&gt;

&lt;p&gt;Not a deck. Five questions, and a supplier who has done this before will answer them in one reply.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Which entity signs, and what is its registration number?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What does the invoice look like, in which currency, and in which period?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Is there an acceptance act template, and what does it require me to confirm?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Where does inference run, and does anything cross a border?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What is the coefficient or formula, expressed against the upstream list price?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If those five arrive together and consistent, the purchase moves. If they arrive in pieces — entity in one email, invoice template "at contracting stage", formula "after a call" — expect the delay to land weeks later, once the integration is already live.&lt;/p&gt;

&lt;p&gt;Keep the written reply. It becomes the reference document your finance team works from when the first invoice arrives, and it is the difference between a two-day booking and a two-week correspondence. Suppliers who answer in writing on day one tend to answer in writing on day ninety as well; the habit travels with the account.&lt;/p&gt;

&lt;p&gt;There is a sixth question worth asking quietly: &lt;em&gt;who answers when the endpoint breaks at 2 a.m.?&lt;/em&gt; With a direct vendor it is a ticket queue. With a card payment to an overseas platform it is often nobody you can reach. With a contracting reseller it should be the same party who signs the invoice, which is a structural advantage of the model that has nothing to do with price.&lt;/p&gt;

&lt;h3&gt;
  
  
  The decision, restated
&lt;/h3&gt;

&lt;p&gt;If your scenario has no personal data, no procurement requirement and a card that works, the official API is a reasonable default and this article does not apply to you.&lt;/p&gt;

&lt;p&gt;If finance has already asked who the payee is, or if the scenario touches customer records, or if the payment rail does not exist for your entity, then you are not choosing between two token prices. You are choosing whether to buy the wrapper that makes the purchase possible.&lt;/p&gt;

&lt;p&gt;AIO Keys sends the document pack before any money moves, and that is the one claim here you cannot check from the outside. Everything else — the coefficient, the compatibility, the trial terms — is verifiable today.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Coefficient, trial terms and endpoint details referenced here are published at &lt;a href="https://aiokeys.com/prices/?utm_source=devto&amp;amp;utm_medium=article&amp;amp;utm_campaign=e1_official_vs_reseller" rel="noopener noreferrer"&gt;aiokeys.com/prices&lt;/a&gt; and were verified on 24 November 2026. Tax treatment and booking rules vary by jurisdiction; confirm them with your own finance team.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Batony writes about the commercial side of AI infrastructure at AIO Keys, which supplies model access over an OpenAI-compatible endpoint with a published coefficient of 3.4 against vendor list price, and settles in the currency named in the contract.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>llm</category>
      <category>business</category>
    </item>
    <item>
      <title>10 LLM API Providers Compared in 2026: Published Rates, Math Included</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Mon, 23 Nov 2026 13:08:28 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/10-cheapest-llm-api-providers-in-2026-verified-not-vibes-5h30</link>
      <guid>https://dev.to/batonyzengsketch/10-cheapest-llm-api-providers-in-2026-verified-not-vibes-5h30</guid>
      <description>&lt;p&gt;Every provider claims to be the cheapest. This comparison re-checks published rates and shows the math — including where a provider is not the cheapest, and why paying more can still be the right decision.&lt;/p&gt;

&lt;p&gt;A single AI feature can quietly become your largest cloud line item. Push a few million tokens a day through a frontier model at list price and the monthly bill clears four figures before you ship anything. The model is identical wherever you call it, so paying full retail is a choice, not a requirement.&lt;/p&gt;

&lt;p&gt;Here is the honest shortlist for 2026. Prices were read from each provider's own page in November 2026 and can change.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;DeepInfra — cheapest raw open-weight tokens. Near-cost, pay-per-token rates on Llama, Qwen, Mistral and DeepSeek. No routing, no memory, no bundle. Infrastructure, not a product. Best for text-only workloads where you own the benchmarks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;OpenRouter — maximum model choice. 600+ models behind one OpenAI-compatible key with automatic failover. Pass-through token pricing, but a 5.5% fee on card top-ups. Best when breadth matters more than the last few percent.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Requesty — breadth with a smaller fee. 600+ models, OpenAI and Anthropic message formats, roughly 5% markup. A close alternative to OpenRouter for multi-model teams.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Vercel AI Gateway — no markup on tokens. 400+ models, no platform fee on token spend, budgets and provider failover. Best for teams already on the AI SDK.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UplinkSwitch — below list, prepaid from $10. 559 chat models, signed receipts, no fee on top-ups. Publishes a price comparison that includes its own rivals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Together AI — full-stack serving and fine-tuning. Hosts open models on its own clusters. Strong tooling and reliability; priced above the bare-metal budget providers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fireworks AI — low-latency inference. 400+ models, P50 latency under 500 ms, built for production concurrency. Best when latency and throughput are hard requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Groq — speed first. LPU hardware delivers hundreds to thousands of tokens per second on a small model catalog. Best for voice and real-time chat.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SiliconFlow — Chinese-model ecosystem. Fast onboarding of DeepSeek, Qwen and GLM, with local payment and Chinese-language support. Best for domestic-facing applications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AIO Keys — published USD pricing. One OpenAI-compatible API in front of frontier and open models, with a disclosed formula: the vendor's public list price in USD × 3.4 (× 3.0 with prepayment), verified on 10 November 2026. Settlement in USD, CNY or USDT. It is deliberately not the cheapest gateway; the coefficient pays for a contract, invoices and support. Rate card: &lt;a href="https://aiokeys.com/prices/" rel="noopener noreferrer"&gt;https://aiokeys.com/prices/&lt;/a&gt; (November 2026).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;How to read this list. "Cheapest" depends on which models you call and how you pay. Output tokens cost 4–6× input. Gateway top-up fees quietly raise the effective rate. Prompt caching can cut repeat costs by half. Compare a workload you can describe, not a headline number.&lt;/p&gt;

&lt;p&gt;Want a number you can verify before the first request? Use a provider that publishes the formula and lets you start with a no-prepayment trial.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Price note: all AIO Keys figures above follow the published rate card at &lt;a href="https://aiokeys.com/prices/" rel="noopener noreferrer"&gt;https://aiokeys.com/prices/&lt;/a&gt; (November 2026).&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Where these numbers get updated:&lt;/strong&gt; live rates and test keys are posted in the Telegram channel — &lt;a href="https://t.me/aiokeys_api" rel="noopener noreferrer"&gt;t.me/aiokeys_api&lt;/a&gt;. 200K tokens to test, no card required.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>api</category>
    </item>
    <item>
      <title>What an OpenAI-compatible endpoint actually buys you</title>
      <dc:creator>batonyzeng-sketch</dc:creator>
      <pubDate>Mon, 23 Nov 2026 07:58:51 +0000</pubDate>
      <link>https://dev.to/batonyzengsketch/what-an-openai-compatible-endpoint-actually-buys-you-40kn</link>
      <guid>https://dev.to/batonyzengsketch/what-an-openai-compatible-endpoint-actually-buys-you-40kn</guid>
      <description>&lt;p&gt;If you have ever wired up two AI providers, you know the annoying part is not the model. It is the plumbing: two SDKs, two key formats, two request shapes, two billing pages.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one-line idea
&lt;/h2&gt;

&lt;p&gt;An OpenAI-compatible endpoint speaks the same request and response format you already use with the official API. So the migration is usually:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;change &lt;code&gt;base_url&lt;/code&gt;,&lt;/li&gt;
&lt;li&gt;change the key,&lt;/li&gt;
&lt;li&gt;leave the rest of the client code alone.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That is the whole claim. It is a compatibility promise about the interface, not a promise about model quality or uptime.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does not mean
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;It does &lt;strong&gt;not&lt;/strong&gt; mean identical output. Model behaviour still depends on the model.&lt;/li&gt;
&lt;li&gt;It does &lt;strong&gt;not&lt;/strong&gt; mean one model name works everywhere. Keep a mapping table in config.&lt;/li&gt;
&lt;li&gt;It does &lt;strong&gt;not&lt;/strong&gt; mean guaranteed availability. No infrastructure is 100% online; build retries and a fallback.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Who tends to care
&lt;/h2&gt;

&lt;p&gt;Teams serving more than one region, or teams that need both US and Chinese models behind a single interface, plus teams without a foreign-currency card who still need to settle an API bill. Local inference deployment stays an option for sensitive data that should not leave the building.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this fits
&lt;/h2&gt;

&lt;p&gt;One example of this kind of gateway is AIO Keys (&lt;a href="https://aiokeys.com/" rel="noopener noreferrer"&gt;aiokeys.com&lt;/a&gt;), which supplies official keys and supports several settlement methods. I mention it only as a concrete instance of the pattern — model lists and rates change, so check the official site for current facts.&lt;/p&gt;

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