<?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: AwesomeVideo</title>
    <description>The latest articles on DEV Community by AwesomeVideo (@awesomevideo).</description>
    <link>https://dev.to/awesomevideo</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%2F4225218%2Fa8ace42a-cc0b-4712-808f-8a6f8dc8c487.png</url>
      <title>DEV Community: AwesomeVideo</title>
      <link>https://dev.to/awesomevideo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/awesomevideo"/>
    <language>en</language>
    <item>
      <title>How a paid MCP server can charge AI agents safely (what we learned building one)</title>
      <dc:creator>AwesomeVideo</dc:creator>
      <pubDate>Mon, 09 Nov 2026 14:20:05 +0000</pubDate>
      <link>https://dev.to/awesomevideo/how-a-paid-mcp-server-can-charge-ai-agents-safely-what-we-learned-building-one-2c0l</link>
      <guid>https://dev.to/awesomevideo/how-a-paid-mcp-server-can-charge-ai-agents-safely-what-we-learned-building-one-2c0l</guid>
      <description>&lt;p&gt;I'm the maker of AwesomeVideo, a hosted captioning API and MCP server that agents pay for with prepaid credits. This post is about the billing side, not the video side. Everything below is how our server behaves today, including the parts I'm not sure we got right.&lt;/p&gt;

&lt;p&gt;When your tool costs real money per call, the caller isn't a person reading a pricing page. It's a model that will retry on a timeout, misread a number, or chain two calls you hoped it would keep apart. Here's the design we ended up with, in the order a request goes through it.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Make the price its own free call
&lt;/h2&gt;

&lt;p&gt;Our first rule: an agent should never have to spend money to learn what something costs. We have two free endpoints that need no key at all: &lt;code&gt;POST /v1/quote&lt;/code&gt; for a single operation and &lt;code&gt;POST /v1/plan&lt;/code&gt; for a whole pipeline. Over MCP, the same thing is the &lt;code&gt;estimate&lt;/code&gt; tool.&lt;/p&gt;

&lt;p&gt;A real response for an 8-second clip:&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="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"operation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"caption"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"audioSeconds"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"costCents"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"breakdown"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"transcribe"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"burn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"centsPerMinute"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"charged"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;plan&lt;/code&gt; also returns &lt;code&gt;limitViolations&lt;/code&gt; (too long, too big, unknown duration) &lt;em&gt;before&lt;/em&gt; anything runs. Paid tools check the same limits and return &lt;code&gt;422 limit_exceeded&lt;/code&gt; with &lt;code&gt;charged: false&lt;/code&gt; instead of failing halfway.&lt;/p&gt;

&lt;p&gt;We chose a separate tool called &lt;code&gt;estimate&lt;/code&gt; over a &lt;code&gt;dryRun&lt;/code&gt; flag on each paid tool. Our bet: a model follows "call estimate first" more reliably than it remembers an optional flag.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tradeoff:&lt;/strong&gt; each step is rounded up to a whole cent on its own. An 8 s caption costs 2 credits (1 for transcription, 1 for the burn), while a full minute costs 5. Short clips pay a rounding premium. We'd rather be predictable than charge fractions, but it's a real cost to small jobs.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Prepaid credits, and the agent can't top up by itself
&lt;/h2&gt;

&lt;p&gt;1 credit = 1 cent, bought ahead of time. The agent has no way to charge a card. That's the most important safety property we have, and it follows from "agent spends, human funds":&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The worst an agent can do is spend the balance a human already put in.&lt;/li&gt;
&lt;li&gt;More money always needs a human in a browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the balance is short, the paid call fails &lt;em&gt;before&lt;/em&gt; a job starts, with HTTP 402. This is the shape our code builds (trimmed, the checkout link is a placeholder):&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="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"error"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"insufficient_balance"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Captions (transcribe + burn) costs 2 cents. This key has 0 cents. No job was started and nothing was charged. Open &amp;lt;checkoutUrl&amp;gt; to buy 500 credits for $5 for this key (no sign-in needed; 1 credit = 1 cent). …"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"balanceCents"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"requiredCents"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"shortfallCents"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"quote"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"operation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Captions (transcribe + burn)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"requiredCents"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"currency"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"usd"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"credits"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"checkoutUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;checkout link tied to this key&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"checkoutTiedToKey"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"pricingUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://awesomevideoeditor.com/pricing"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Over MCP, the same body comes back as a tool result with &lt;code&gt;isError: true&lt;/code&gt;, plus two fields for the model: &lt;code&gt;hint&lt;/code&gt; ("Nothing was charged. Show checkoutUrl to your human, or call create_checkout; then retry the same call.") and &lt;code&gt;retryable: true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Three details we'd keep:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Say "nothing was charged" out loud.&lt;/strong&gt; Then the model doesn't have to guess whether a retry would pay twice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tie the checkout to the key.&lt;/strong&gt; The human pays, and the credits land on the exact key the agent is already using, with no account linking step.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Give numbers, not just a code.&lt;/strong&gt; &lt;code&gt;requiredCents&lt;/code&gt; and &lt;code&gt;balanceCents&lt;/code&gt; let the model explain the situation in one sentence.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Let the caller cap the job
&lt;/h2&gt;

&lt;p&gt;Every paid call accepts &lt;code&gt;maxCredits&lt;/code&gt;. If the real price (worked out after we probe the media's duration) is above it, the call returns &lt;code&gt;409 max_credits_exceeded&lt;/code&gt; and charges nothing. The agent sets it from what the user agreed to, so a misread quote can't turn into a bigger bill.&lt;/p&gt;

&lt;p&gt;For keys that belong to an account, the human can also set a &lt;strong&gt;monthly spend cap per key&lt;/strong&gt; when creating it on the account page. Past that cap, calls return a 402 &lt;code&gt;key_spend_cap&lt;/code&gt;. That one lives outside the model's reach.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Make retries free
&lt;/h2&gt;

&lt;p&gt;Agents retry, so a retry must never charge twice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Idempotency:&lt;/strong&gt; REST takes an &lt;code&gt;Idempotency-Key&lt;/code&gt; header and MCP tools take &lt;code&gt;idempotencyKey&lt;/code&gt;. The same key on the same API key returns the original job instead of creating a new one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache:&lt;/strong&gt; results are cached per key and per media hash plus options. A repeat of a finished job returns a copy with &lt;code&gt;cached: true&lt;/code&gt; and &lt;code&gt;costCents: 0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refunds:&lt;/strong&gt; if a job fails after charging, it's refunded automatically to the same balance. &lt;code&gt;resume_job&lt;/code&gt; continues from saved steps instead of paying for everything again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Atomic debit:&lt;/strong&gt; the charge is a single conditional &lt;code&gt;UPDATE&lt;/code&gt; that only succeeds if the balance still covers it, so two parallel calls can't both spend the same cents.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. Free trials without a free-for-all
&lt;/h2&gt;

&lt;p&gt;We wanted an agent to go from zero to a first result with no human. That means giving away credits to anonymous callers, which is how free tiers get drained.&lt;/p&gt;

&lt;p&gt;What we do today:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A new self-serve key can get &lt;strong&gt;10 welcome credits&lt;/strong&gt;, valid for 30 days, and only for transcription/caption jobs up to 2 minutes. They can't be spent on anything else.&lt;/li&gt;
&lt;li&gt;To claim them, the caller solves a small &lt;strong&gt;proof-of-work&lt;/strong&gt;: &lt;code&gt;GET /v1/keys/challenge&lt;/code&gt; returns an HMAC-signed challenge (20 bits right now, valid 10 minutes, single use), and you find a nonce so that &lt;code&gt;SHA-256(challenge + ":" + nonce)&lt;/code&gt; starts with that many zero bits. That's a second or two of CPU for one honest agent and real cost for a farm.&lt;/li&gt;
&lt;li&gt;Grants are rationed per network and per network operator per day, out of daily and monthly budgets, released in slots through the day. When the pool is empty, the response says why (&lt;code&gt;welcomeCreditsReason&lt;/code&gt;, e.g. &lt;code&gt;slot_wait&lt;/code&gt; with &lt;code&gt;nextSlotAt&lt;/code&gt;) instead of silently giving zero.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Tradeoff:&lt;/strong&gt; proof-of-work is friction, and some headless clients will never run a solver. For OAuth &lt;code&gt;client_credentials&lt;/code&gt; clients (registered with &lt;code&gt;client_secret_post&lt;/code&gt;), we skip it and give a smaller automatic grant of 5 credits under its own daily cap. It's a compromise: less abuse-proof, but it doesn't punish machine-to-machine callers.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. What I'd tell someone starting today
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Put prices in a free tool and in every error.&lt;/li&gt;
&lt;li&gt;Make the human the only one who can add money.&lt;/li&gt;
&lt;li&gt;Give the agent a cap parameter and give the human a cap the agent can't touch.&lt;/li&gt;
&lt;li&gt;Make retries free by design (idempotency, cache, refunds) before you need them.&lt;/li&gt;
&lt;li&gt;Assume every free credit will be farmed, and decide up front what you'll ration by.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One open question we still argue about: does a quote count as consent? Within the prepaid balance we let the model decide, and the human decides only at checkout. If your tool is destructive rather than just costly, MCP elicitation (a confirmation the client shows mid-call) may be a better gate, though client support still varies.&lt;/p&gt;

&lt;p&gt;If you want to poke at these responses, the docs for agents are at &lt;a href="https://awesomevideoeditor.com/llms.txt" rel="noopener noreferrer"&gt;https://awesomevideoeditor.com/llms.txt&lt;/a&gt; (MCP endpoint: &lt;code&gt;https://api.awesomevideoeditor.com/mcp&lt;/code&gt;). &lt;code&gt;quote&lt;/code&gt; and &lt;code&gt;plan&lt;/code&gt; are free and need no key. I'm happy to answer billing questions in the comments.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>ai</category>
      <category>api</category>
      <category>payments</category>
    </item>
    <item>
      <title>Caption a video from an MCP client in three tool calls (no sign-up)</title>
      <dc:creator>AwesomeVideo</dc:creator>
      <pubDate>Fri, 06 Nov 2026 14:15:16 +0000</pubDate>
      <link>https://dev.to/awesomevideo/caption-a-video-from-an-mcp-client-in-three-tool-calls-no-sign-up-62e</link>
      <guid>https://dev.to/awesomevideo/caption-a-video-from-an-mcp-client-in-three-tool-calls-no-sign-up-62e</guid>
      <description>&lt;p&gt;I'm the maker of &lt;a href="https://awesomevideoeditor.com" rel="noopener noreferrer"&gt;AwesomeVideo&lt;/a&gt; — a hosted captions MCP + REST API that returns a burned-in MP4 plus SRT/VTT.&lt;/p&gt;

&lt;p&gt;If your agent can call tools, you can caption a sample clip without creating an account first. Point the client at the keyless endpoint and use three tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Connect
&lt;/h2&gt;

&lt;p&gt;Remote MCP URL:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://api.awesomevideoeditor.com/mcp&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Docs / Cursor / Claude recipes: &lt;a href="https://awesomevideoeditor.com/mcp" rel="noopener noreferrer"&gt;awesomevideoeditor.com/mcp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Many clients that only speak JSON on &lt;code&gt;initialize&lt;/code&gt; / &lt;code&gt;tools/list&lt;/code&gt; work against this endpoint (Streamable HTTP + content negotiation).&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Create a free trial key
&lt;/h2&gt;

&lt;p&gt;Call &lt;code&gt;create_key&lt;/code&gt; (or use the anonymous REST path). You get welcome credits once per network — enough to try a short clip. No email wall for the agent path.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Caption
&lt;/h2&gt;

&lt;p&gt;Call &lt;code&gt;caption_video&lt;/code&gt; with a public MP4 URL. Live sample we keep online:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;https://awesomevideoeditor.com/samples/cc0-interview-es.mp4&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You get back job status, then downloadable MP4 (styled burn-in) + SRT/VTT/JSON transcript. Pricing is live at &lt;code&gt;/v1/pricing&lt;/code&gt; (currently 5 credits per audio minute for captions; +2 with translate).&lt;/p&gt;

&lt;h2&gt;
  
  
  n8n
&lt;/h2&gt;

&lt;p&gt;If you automate in n8n instead of an agent, there is an importable workflow (core nodes only, no key baked in):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://awesomevideoeditor.com/integrations/n8n" rel="noopener noreferrer"&gt;Auto captions in n8n&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this exists
&lt;/h2&gt;

&lt;p&gt;Most caption SaaS is UI-first. Agents need: a tool list, a key they can mint, and a real video URL that is not &lt;code&gt;example.com&lt;/code&gt;. Happy to answer MCP / OAuth / billing questions in the comments — I'm the maker.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>video</category>
      <category>api</category>
      <category>mcp</category>
    </item>
  </channel>
</rss>
