Docs menu

Money

Selling your API and tools

Charge per call for your app's API or MCP tools, get listed in the directory, and withdraw what you earn.

Explain it

Any app you deploy on CLI can charge for its API or its AI tools without writing payment code. CLI takes the payment before the request reaches your app. What you earn collects in the project, and the owner can withdraw it in USDC.

How to do it: open the app's Payments tab, set a price per call (or a subscription or a prepaid plan), and publish it to the directory so buyers and agents can find it.

"Charge 1 cent per call to my /forecast endpoint."

CLI takes a 2.5% fee. Earnings can also pay the app's own hosting first (see /docs/self-funding).

Any app you deploy on CLI can charge for its API or its MCP tools without writing payment code. CLI sits in front of the app, takes the payment, and only then lets the request through. What you earn collects in the project, and the owner can withdraw it in USDC.

CLI takes a 2.5% fee on what you sell. Staking CLI tokens can lower it (see /docs/cli-token).

Charge per request

Put a price on any route. Prices are per request, in micro-USDC in the API.

In the dashboard: open the service and go to its Payments tab. An app that isn't selling yet shows three steps there: set the paid paths and a price (1¢, 5¢, 25¢ or $1 a call, or your own), list it in the directory, and try it. The project page's Paid APIs section shows what each app sells and earns, with a Start selling button for every app that doesn't sell yet.

With the API:

API
PUT /v1/services/:id/paywall
JSON
{
  "rules": [
    { "path": "/v1/forecast", "price": 20000 },
    { "path": "/api/*", "price": 10000, "method": "POST" }
  ]
}

That makes /v1/forecast cost $0.02 a call and every POST under /api/ cost $0.01. Routes without a rule stay free. GET /v1/services/:id/paywall shows the rules and what they've earned.

What a caller sees

  1. A caller requests GET https://weather-ab12.clicloud.app/v1/forecast with no payment.
  2. CLI answers 402 with accepts[]: the price, on Base and Solana, also in the PAYMENT-REQUIRED header.
  3. The caller signs a USDC payment, the same way as adding credit (see /docs/billing), and repeats the request with PAYMENT-SIGNATURE.
  4. CLI settles the payment and lets the request through. Your app receives it with X-CLI-Paid-By set to the payer.
  5. You're credited the price, less the fee and any revenue splits (a payment_received event).

Instead of paying each time, a caller can send a prepaid stream token (X-CLI-Stream) or a subscription token (X-CLI-Subscription).

Prepaid streams

A stream lets a caller pay once and make many calls. It's the better choice for agents calling you often.

  1. The caller opens a stream with at least $0.10, from its own CLI balance or with an x402 payment, and gets a clps_… token:

    API
    POST /v1/services/:id/streams
    JSON
    { "amount": 1000000, "fromProject": "prj_7a2c91e04b5f3d18a6c2" }
  2. It sends X-CLI-Stream: <token> on each request. CLI takes each call's price from the stream.

  3. Every minute, CLI credits you with what was used, less the fee and splits.

  4. When it runs dry the caller gets STREAM_EMPTY and tops it up (POST /v1/streams/:id/topup) or opens another.

  5. Closing it (POST /v1/streams/:id/close) returns what's left: to the caller's project balance, or for x402 deposits back to the paying wallet.

You can see your stream callers under Prepaid callers on the service's Payments tab.

Subscriptions

Once a service has paid routes, you can sell monthly or weekly plans with included requests.

In the dashboard: the service's Payments tab, Subscription plans.

With the API:

API
PUT /v1/services/:id/plans
JSON
{
  "plans": [
    { "id": "pro", "name": "Pro", "price": 9000000, "period": "month", "includedRequests": 10000 }
  ]
}

Customers subscribe with POST /v1/services/:id/subscribe and send X-CLI-Subscription on their requests. Those paying from a CLI project renew automatically; others pay each period over x402. Admitted requests reach your app with X-CLI-Plan, so it can unlock features per plan.

Sell MCP tools

If your app serves MCP over HTTP, you can charge per tool call.

In the dashboard: the service's Payments tab, Sell MCP tools. Set a price per tool and press Sell through CLI.

With the API (admins):

API
PUT /v1/services/:id/mcp
JSON
{ "enabled": true, "path": "/mcp", "prices": { "forecast": 30000 }, "defaultPrice": 0 }

CLI returns a gateway URL such as https://api.clicloud.app/mcp/weather-ab12. Callers connect there, never to your app directly:

  • Free methods such as initialize and tools/list pass straight through, and tools/list shows each tool's price.
  • A paid tools/call gets a 402 with a payment challenge for that tool's price, or is charged to the caller's stream.
  • Once paid, CLI forwards the call to your app with an X-CLI-MCP-Gateway header.

Check the gateway secret

After the next deploy your app has a CLI_MCP_SECRET variable. Your app must reject MCP requests whose X-CLI-MCP-Gateway header doesn't equal it. That's what stops anyone from calling your tools without paying.

JavaScript
if (req.headers["x-cli-mcp-gateway"] !== process.env.CLI_MCP_SECRET) {
  return res.status(403).end();
}

CLI's edge also refuses anything else on your app's MCP path.

What to charge

The service's Payments tab suggests a price per call. It starts from what a call costs you to serve (from the app's measured cost and request count), takes three times that to cover spikes and CLI's fee, and compares it with similar paid APIs in the directory (same tags, or all of them). It shows its reasoning, so you can pick something else.

The same tab shows cost and margin: what the app cost over 7 or 30 days, its cost per 1,000 requests, what it earned, and, for each paying caller, what they paid against what serving them cost.

Ask your agent:

"What should I charge per call for weather, and who are my most profitable callers?"

With the API:

API
GET /v1/services/:id/price-suggestion
GET /v1/services/:id/unit-economics?days=30

Get found

List in the directory

The directory is where people and agents find paid APIs. Agents search it with cli_find_api, people with cli find or the dashboard's Paid APIs page.

In the dashboard: on the Paid APIs page, Sell your API: pick the app, set the paid routes and price, then list it. Or the service's Payments tab, Directory listing.

With the API:

API
PUT /v1/services/:id/listing
JSON
{
  "title": "Weather forecasts",
  "description": "Hourly forecasts for any coordinates, 7 days ahead.",
  "tags": ["weather", "geo"],
  "docsUrl": "https://example.com/docs",
  "openapiUrl": "https://weather-ab12.clicloud.app/openapi.json"
}

Each listing shows your routes and tools with prices, the cheapest paid call ("from"), your plans, 30-day uptime and paid calls, and how to pay. Results are ranked by relevance, real paid traffic and uptime, never by paid placement.

Listing review

Listings are checked when you create or change them, so the directory stays safe to pay from.

  • Automatic checks look at the title, description, tags and links for promises of returns or free money, requests for seed phrases or private keys, malware and attacks, adult content, illegal goods, and passing yourself off as another company. Links need to be https, and can't be bare IP addresses, URL shorteners or lookalike (punycode) domains.
  • New sellers' first listings wait for a person at CLI to check them, usually within a day. You're a new seller for your account's first week, or until you've paid in.
  • Anyone signed in can report a listing. After three people report it, it's hidden until we've looked.
  • Listings that let callers down are hidden: with at least 20 paid calls in 30 days, more than 25% refunded, or up less than half the time.

A listing that's waiting or hidden doesn't show in the directory, search, its store page or its badge. Your paid routes keep working for anyone who already calls them. The Directory listing panel shows its status and why, and you get a notification (and an email, if you sign in by email) when we approve, hide or remove it, with our note. A removed listing can't be relisted on its own: reply to that email or write to [email protected].

API
GET /v1/services/:id/listing-review
POST /v1/directory/:id/report

Report reasons: scam, impersonation, malware, illegal, adult, broken or other, with an optional detail.

Public store page and badge

Every listing gets a public page at /store/:serviceId, which needs no sign-in: prices, uptime, paid calls and how to pay by x402, stream or MCP. For your README there's a badge at /badge/:serviceId.svg, reading "pay per call · from $0.02 · CLI".

Try-it console

In the directory, anyone signed in can try your API: pick a route or tool and which of their projects pays, then run it. CLI opens the smallest stream that covers the call, sends it, and closes the stream straight away, so only the call is spent. It's a real paid call, and you earn from it.

Sell templates

You can publish a stack as a community template, free or priced per deploy, with POST /v1/projects/:id/templates/published. Buyers see the price before they deploy, and you earn it like any other sale.

Earnings, splits and withdrawals

See your earnings

Earnings collect from paid routes, streams, subscriptions, MCP tools, templates and splits from others.

In the dashboard: Usage and credit, Earnings, with a chart per day by source.

From your terminal:

Terminal
cli earnings

With the API:

API
GET /v1/projects/:id/earnings
GET /v1/projects/:id/earnings/daily?days=30

Revenue splits

Send a share of a service's earnings to collaborators: to other CLI projects (instantly) or to wallets (paid out once it reaches $1). Set them on the service's Payments tab, Revenue splits, or with PUT /v1/services/:id/splits. Each split is a share in basis points, up to 10 splits.

Only the signed-in owner can change splits, with a second factor. Splits to outside wallets may need an identity check first.

Withdraw

Only the project owner can withdraw, never a key or an agent, and a second factor is asked for.

You can withdraw earnings from customers who paid in USDC: over x402, or from a balance they funded with x402 or a USDC deposit. A sale paid from a customer's card credit or free credit (welcome, referral, staking or goodwill) adds to your balance for hosting, but can't be withdrawn. GET /v1/projects/:id/earnings shows available (withdrawable) and credit (spendable only). Card payments can be disputed for months, which is why card credit never leaves CLI as USDC.

In the dashboard: Usage and credit, Earnings.

From your terminal:

Terminal
cli withdraw 250 0x8f3a…c41d --network base
  • Only earnings can be withdrawn, never credit you added.
  • Payouts are USDC on Base or Solana.
  • New accounts and amounts over the review threshold wait for a quick review by the CLI team, usually within a day. Others go out within a few minutes.
  • Past a total set by the server (per person or project), you verify your identity once with Stripe Identity. You'll get IDENTITY_REQUIRED; start the check from the dashboard or POST /v1/me/identity. CLI keeps only the outcome.
  • A transfer that fails puts the money back. Each payout raises a payout event.

Refunds for failed calls

You can promise buyers their money back when a paid call fails. Services that do show it in the directory. See Refunding failed calls.