> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stellarium.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Inference

> Paid AI model resources under sh.stellarium.inference, priced per token in USDC.

The Stellarium inference resources are AI models published under the `sh.stellarium.inference` path. You call them from RequestScript like any other resource and pay per token in USDC, with no provider account or API key.

The resources are hosted by Stellarium. Each function is an [inference function](/concepts/ai): it takes a `maxTokens` argument and is billed for the tokens it actually uses. More models are coming soon.

> [!WARNING]
>
> Payments are under active development and have only been exercised on a local Solana validator. Don't use real funds.

## Resources

> **[Claude Sonnet](/inference/claude-sonnet)**
>
> `sh.stellarium.inference.claude.Sonnet`

| Resource | Function | Parameters | Returns | Input / output price |
| - | - | - | - | - |
| `claude.Sonnet` | [`message`](/inference/claude-sonnet#message) | `prompt: string`, `maxTokens: int32` | `string` | \$2.50 / \$10.50 per million tokens |

## Calling a model

Bind a resource with its fully qualified name, then call its functions with named arguments:

```requestscript theme={null}
request AskClaude {
  const sonnet: sh.stellarium.inference.claude.Sonnet

  const reply = sonnet.message(prompt: "Hello, what is your name?", maxTokens: 2000)
  if (reply.error != null) {
    return reply.error.message
  }

  return reply.value
}
```

Like every resource call, each call evaluates to a result object with either `value` or `error` set. Check `error` before you use `value`. See [Requests](/concepts/network#requests).

Before the call runs, your node signs a voucher for a ceiling: the estimated input tokens plus `maxTokens` output tokens, at the model's rates. You're then charged for the tokens actually used. Your node refuses any call whose ceiling is over its inference spending limit, and it needs a funded escrow. See [What a call costs](/concepts/ai#what-a-call-costs) and [Raising your spending limit](/concepts/ai#raising-your-spending-limit).

> [!NOTE]
>
> Your node can only call these models if it knows about the node that hosts them. If your node joined through a [starting peer](/concepts/network#joining-a-network) that already knows the `sh.stellarium.inference` resources, it copies them on startup. Run `GET /v1/resources` on your node to check.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.