# Earn and spend USDC on inference

> Source: <https://dev.to/cjpoulsen/earn-and-spend-usdc-on-inference-39d7>
> Published: 2026-10-21 02:33:46+00:00

If your app or harness talks to three model providers, you have three accounts, three API keys, three billing dashboards, and three sets of rate limits to babysit. If you want to offer a model, you need your own signup flow, key issuance and billing before anyone can pay you.

We've been building Stellarium, a decentralized network where anyone can host an API and get paid for every call. This post is about the newest piece: running AI inference on it. Models become ordinary resources on the network, callers pay per token in USDC, and nobody needs to set up an account.

**A model is just a resource**

On Stellarium, every API is a resource hosted by a node. A resource has a name, like `com.example.Weather`, and a list of functions programs can call. Nodes advertise their resources to peers, and any node can route a call to whoever hosts the resource.

An AI model fits the same shape. A provider wraps the model in a resource with a function that takes a prompt and returns text. For example, `sh.stellarium.inference.claude.Sonnet` exposes Claude Sonnet through a message function.

That means AI gets everything the network already does: discovery by name, routing between peers, results that carry either a value or an error, and payment with no signup or keys.

**Calling a model**

Requests on Stellarium are written in RequestScript. Calling a model looks like calling a function. The only difference is `maxTokens` is a required parameter. This allows the caller and provider to work out a fair price.

``` js
request AskClaude {
  const sonnet: sh.stellarium.inference.claude.Sonnet

  const reply = sonnet.message(prompt: "Write a haiku about Oslo", maxTokens: 200)
  if (reply.error != null) {
    return reply.error.message
  }

  return reply.value
}
```

The node does the rest: it finds the node hosting the model, gets a price estimate, checks it against your spending limit, and pays for the call. If the model fails, your script gets an error it can handle rather than a dead request.

Since a model is just another resource, one request can mix a model call with anything else on the network (a weather lookup, a Regex validation) and combine the results.

**The hard part: paying per token, fairly**

Most paid functions on Stellarium charge a flat fee per call. That doesn't work for inference, because cost depends on input and output tokens. There's a trust problem in both directions:

Every paid call goes through six steps:

The caller agrees to a ceiling up front and pays only for what was used. The provider knows the call is covered before spending anything.

**Why this matters for agents**

Agents have a great use-case for Stellarium. An agent that wants a second model, a cheaper model for a subtask, or a specialized model someone else fine-tuned shouldn't need a human to sign up, paste an API key and attach a card. On Stellarium it calls the resource by name, its node enforces a hard spending ceiling per call, and the payment is settled automatically. All through USDC on Solana.

Try it

Payments on Stellarium go live this Thursday, October 22nd, 2026. Stellarium is open source and early. Questions, comments and pull requests are all welcome.
