> ## 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.

# Claude Sonnet

> Claude Sonnet 5.5 functions in sh.stellarium.inference.claude.Sonnet.

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

Calls are served by Claude Sonnet 5.5 (`claude-sonnet-5-5`) through the Anthropic API.

## message

Sends a single user message to the model and returns its text reply. This is a paid [inference function](/concepts/ai).

**prompt** `string` *required*

The prompt to generate text from.

**maxTokens** `int32` *required*

The maximum number of tokens to generate. Also sets the output side of the price ceiling your node signs for.

**value** `string`

The model's reply. If the reply has several text blocks, they're joined together.

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

  const response = sonnet.message(prompt: "Hello, what is your name?", maxTokens: 2000)

  if (response.error != null) {
    return response.error.message
  }

  return response.value
}
```

```json Response theme={null}
{ "returnValue": "Hi! I'm Claude, an AI assistant made by Anthropic." }
```

### Pricing

| | Price per million tokens | Micro-USDC per million tokens |
| - | - | - |
| Input | \$2.50 | `2,500,000` |
| Output | \$10.50 | `10,500,000` |

Input tokens are estimated before the call with Anthropic's token-counting API, and the final charge uses the token counts Anthropic reports for the call. For a 1,000-token prompt with `maxTokens: 400`:

| | Input | Output | Charge |
| - | - | - | - |
| Signed ceiling | 1,000 × 2.5 | 400 × 10.5 | 6,700 micro-USDC (\$0.0067) |
| Actual call, 250 output tokens | 1,000 × 2.5 | 250 × 10.5 | 5,125 micro-USDC (\$0.005125) |

See [What a call costs](/concepts/ai#what-a-call-costs) for how charges are calculated.

> [!NOTE]
>
> Each call is a single-turn conversation with no system prompt. To carry context between calls, include it in `prompt`.


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