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

# Lana API - Solana AI Agent

> Call Lana, a Solana AI agent, over HTTP: ask about wallets, tokens, transactions, and prices and stream back the answer. Quickstart, API reference, and pricing.

The Lana API is a Solana AI agent you call over HTTP. You send it a question in plain English, and it looks up wallets, tokens, transactions, and prices for you, then streams back an answer.

Lana runs every lookup on the Helius side, so you don't define or run any tools. It's available on paid Helius plans (Developer and above), at a flat price per request: 2,000 credits for `lana-fast` and 10,000 credits for `lana-thinking`. See [Pricing](#pricing).

The API is shaped like the Anthropic Messages API, but the Anthropic SDKs don't work with it. Call it over plain HTTP, as in the examples below. See [Differences from the Anthropic Messages API](#differences-from-the-anthropic-messages-api).

Lana runs on Anthropic's Claude models. Your questions and conversation are sent to Anthropic to generate answers.

> [!NOTE]
>
> The Lana API is in beta on the [Gatekeeper (Beta)](https://www.helius.dev/docs/gatekeeper/overview.md) endpoint, `beta.helius-rpc.com`. It isn't available on `mainnet.helius-rpc.com` yet. New events and fields can be added during the beta.

## What you can ask Lana

* "Who are the largest holders of this token?"
* "What is the current price of SOL?"
* "How did my wallet do this week?"
* "Which programs did this wallet use most over its last 5,000 transactions?"
* "Export the top holders of this token as a CSV."

## Quickstart

**1. Get an API key**

Copy an API key from the [Helius Dashboard](https://dashboard.helius.dev).

**2. Ask a question**

Replace `YOUR_API_KEY` and run:

```bash cURL theme={"system"}
curl -N https://beta.helius-rpc.com/v1/lana/messages \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d '{
    "model": "lana-fast",
    "stream": true,
    "messages": [
      { "role": "user", "content": "Who are the largest holders of EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v?" }
    ],
    "extensions": { "read_only": true }
  }'
```

`-N` makes curl print each event as soon as it arrives.

**3. Read the answer**

The response is a stream of [events](#streaming-events):

```text theme={"system"}
event: message_start
data: {"type":"message_start","message":{"id":"msg_3f9c...","model":"lana-fast"}}

event: tool_use
data: {"type":"tool_use","tool_use_id":"toolu_01...","name":"...","input":{"mint":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}

event: tool_result
data: {"type":"tool_result","tool_use_id":"toolu_01...","content":"{\"holders\":[..."}

event: content_block_delta
data: {"type":"content_block_delta","delta":{"type":"text_delta","text":"The largest USDC holders are"}}

event: message_end
data: {"type":"message_end","stop_reason":"end_turn","usage":{"input_tokens":91200,"output_tokens":212,"tool_calls":1,"prompt_tokens":46100,"context_window":200000}}
```

The answer is the `text_delta` chunks, in order. With `lana-thinking`, you can also get `thinking_delta` chunks: that's Lana's reasoning, so show it apart from the answer, or skip it.

### Read the stream in code

Both examples check the HTTP status, print the answer as it streams, and stop if the turn fails or the stream ends early.

```typescript TypeScript theme={"system"}
const res = await fetch("https://beta.helius-rpc.com/v1/lana/messages", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Api-Key": process.env.HELIUS_API_KEY!,
  },
  body: JSON.stringify({
    model: "lana-fast",
    stream: true,
    messages: [{ role: "user", content: "What is the current price of SOL?" }],
    extensions: { read_only: true },
  }),
});

// Errors before the stream starts arrive as a normal HTTP response.
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);

const reader = res.body!.getReader();
const decoder = new TextDecoder();
let buffer = "";
let finished = false;

while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  buffer += decoder.decode(value, { stream: true });

  // Events are separated by a blank line.
  const frames = buffer.split("\n\n");
  buffer = frames.pop() ?? "";

  for (const frame of frames) {
    const data = frame.split("\n").find((line) => line.startsWith("data:"));
    if (!data) continue;
    const event = JSON.parse(data.slice(5));

    switch (event.type) {
      case "content_block_delta":
        if (event.delta.type === "text_delta") process.stdout.write(event.delta.text);
        break;
      case "message_end":
        if (event.stop_reason === "error") throw new Error("Lana turn failed");
        finished = true;
        break;
      case "error":
        throw new Error(`${event.error.type}: ${event.error.message}`);
      // Ignore every other event type, including ones added later.
    }
  }
}

// The connection closed without message_end or error.
if (!finished) throw new Error("Lana stream ended early");
```

```python Python theme={"system"}
import json
import os

import requests

res = requests.post(
    "https://beta.helius-rpc.com/v1/lana/messages",
    headers={"X-Api-Key": os.environ["HELIUS_API_KEY"]},
    json={
        "model": "lana-fast",
        "stream": True,
        "messages": [{"role": "user", "content": "What is the current price of SOL?"}],
        "extensions": {"read_only": True},
    },
    stream=True,
    timeout=(10, 330),  # connect, read; a turn can run up to 5 minutes
)

# Errors before the stream starts arrive as a normal HTTP response.
if res.status_code != 200:
    raise RuntimeError(f"{res.status_code}: {res.text}")

finished = False
for line in res.iter_lines(decode_unicode=True):
    if not line or not line.startswith("data:"):
        continue
    event = json.loads(line[5:])

    if event["type"] == "content_block_delta" and event["delta"]["type"] == "text_delta":
        print(event["delta"]["text"], end="", flush=True)
    elif event["type"] == "message_end":
        if event["stop_reason"] == "error":
            raise RuntimeError("Lana turn failed")
        finished = True
    elif event["type"] == "error":
        raise RuntimeError(f'{event["error"]["type"]}: {event["error"]["message"]}')
    # Ignore every other event type, including ones added later.

# The connection closed without message_end or error.
if not finished:
    raise RuntimeError("Lana stream ended early")
```

## Differences from the Anthropic Messages API

* The models are `lana-fast` and `lana-thinking`.
* Lana runs its own tools. `tools`, `tool_choice`, `temperature`, `top_p`, `top_k`, `stop_sequences`, and `metadata` return `400`.
* `system` is added to Lana's instructions.
* `max_tokens` is optional (default and maximum 8,192), and images must be URLs.
* The events are different. There's no `content_block_start`, `content_block_stop`, `message_delta`, or `message_stop`. The stream ends with `message_end` or `error`.
* `usage` adds `tool_calls`, `prompt_tokens`, and `context_window`. `stop_reason` can be `error`.
* `extensions` is Lana-only.

## Endpoint and authentication

```text theme={"system"}
POST https://beta.helius-rpc.com/v1/lana/messages
```

Send your Helius API key in one of these ways:

| Method | Example |
| - | - |
| `X-Api-Key` header (recommended) | `X-Api-Key: YOUR_API_KEY` |
| `api-key` query parameter | `https://beta.helius-rpc.com/v1/lana/messages?api-key=YOUR_API_KEY` |

`Authorization: Bearer` doesn't work on this endpoint and returns `401`.

Send `Content-Type: application/json` on every request.

> [!WARNING]
>
> Your API key spends your plan's credits. Call Lana from your server, not from a browser or an app you ship to users.

## Request body

The body is a JSON object. Unknown fields are rejected with `400`, including unknown fields inside `extensions` and content blocks.

**model** `string` *required*

`lana-fast` or `lana-thinking`. See [Models](#models).

**messages** `object[]` *required*

The conversation, oldest first. It needs at least one message, and the last one must have `role: "user"`. See [Messages](#messages).

**max\_tokens** `integer` (default: 8192)

The most output tokens Lana can write in one model step, from `1` to `8192`. A turn with lookups takes several steps, so the turn's total `output_tokens` can be higher than `max_tokens`. Below 2,048, `lana-thinking` doesn't reason.

**stream** `boolean` (default: false)

`true` streams [events](#streaming-events). `false` returns one [JSON response](#non-streaming-response) when the turn ends.

**system** `string`

Extra instructions, from 1 to 10,000 characters, such as "Answer in three bullet points." They're added to Lana's own instructions, not used in place of them.

**extensions** `object`

Lana-only options. See [Extensions](#extensions).

### Models

| | `lana-fast` | `lana-thinking` |
| - | - | - |
| Best for | Quick lookups and single facts | Multi-step analysis |
| Lookup steps per turn | Up to 4 | Up to 20 |
| Web searches per turn | Up to 2 | Up to 3 |
| Web page fetches per turn | Up to 2 | Up to 2 |
| Streams reasoning | No | Sometimes, as `thinking_delta`. Lana decides when to reason. |

`lana-thinking` only reasons when `max_tokens` is 2048 or higher.

### Messages

Each message has a `role` (`user` or `assistant`) and `content`:

```json theme={"system"}
{ "role": "user", "content": "How many holders does USDC have?" }
```

The API doesn't store conversations. To ask a follow-up, send the whole conversation again with the new question at the end. Lana's answer text is enough for the `assistant` turns:

```json theme={"system"}
{
  "model": "lana-thinking",
  "messages": [
    { "role": "user", "content": "What is the USDC mint on Solana?" },
    { "role": "assistant", "content": "The USDC mint is EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v." },
    { "role": "user", "content": "How many holders does it have?" }
  ]
}
```

Lana only looks up addresses that appear in the conversation, in its own lookup results, or in `extensions.user_context.wallet`.

`content` is a non-empty string or a non-empty array of blocks:

| Block | Allowed in | Shape |
| - | - | - |
| `text` | `user`, `assistant` | `{ "type": "text", "text": "..." }` |
| `image` | `user` | `{ "type": "image", "source": { "type": "url", "url": "https://..." } }` |
| `tool_use` | `assistant` | `{ "type": "tool_use", "id": "...", "name": "...", "input": {} }` |
| `tool_result` | `user` | `{ "type": "tool_result", "tool_use_id": "...", "content": "..." }` |

Images must be URLs. Base64 images aren't supported.

You don't need `tool_use` or `tool_result` blocks. They let you replay the lookups from an earlier turn, as Lana returned them, so Lana can reuse those results. `tool_result` also takes an optional `is_error` boolean.

### Extensions

All extensions are optional.

| Field | Type | Default | What it does |
| - | - | - | - |
| `read_only` | boolean | `true` | Removes the transfer, swap, and token-launch tools. Leave it `true`: this API doesn't document a flow for showing and signing wallet actions. |
| `output_format` | `"markdown"` \| `"plain"` | `"markdown"` | `plain` tells Lana not to use Markdown and removes `{{cite:N}}` markers. `source` events still arrive. |
| `include_ui_schema` | boolean | `false` | Allows UI components, as `ui_block` and `ui_schema` events. |
| `include_followups` | boolean | `false` | Allows up to 3 suggested follow-up questions. |
| `include_documents` | boolean | `false` | Allows downloadable CSV, JSON, or text files, as `document` events. |
| `enable_deep_scan` | boolean | `false` | Lets Lana read up to 10,000 transactions of an address's history (50,000 for counts and totals), up to 3 scans per turn. Mainnet only. Without it, Lana reads up to 100 transactions per lookup. Deep scans are slower but cost the same flat price. They count toward the 5-minute turn limit. |
| `user_context` | object | none | Who's asking. See below. |
| `attachments` | object\[] | none | Up to 8 images added to the last user message. `image` blocks in `messages` don't count toward this limit. Each is `{ "url": "https://...", "kind": "image" }`. |

The `include_*` options make output possible. Lana decides whether to send it.

`extensions` also accepts `progress_context` and `transaction_filter_context`. The [Orb](https://www.helius.dev/docs/orb.md) explorer uses them, and you don't need them.

`user_context` fields:

| Field | Type | What it does |
| - | - | - |
| `wallet` | string, up to 128 characters | The user's address, so "my wallet" and "my balance" work. |
| `address_kind` | string, up to 32 characters | `"wallet"` or `"token"`: what `wallet` is. Needs `wallet`. |
| `time_zone` | string, up to 64 characters | An IANA time zone, such as `"America/New_York"`, so "today" works. |
| `network` | `"mainnet"` \| `"devnet"` | The network to look up. Defaults to mainnet. |

## Streaming events

With `"stream": true`, you get status `200` and `Content-Type: text/event-stream`. Each event looks like this:

```text theme={"system"}
event: <type>
data: <json>

```

`data` is one line of JSON. Its `type` matches the `event` name.

Events arrive in this order:

1. `message_start`, always first.
2. Any mix of `content_block_delta`, `tool_use`, `tool_result`, `source`, `ui_block`, `document`, `progress_update`, and `ping`.
3. `ui_schema`, at most once.
4. `follow_up`, at most once.
5. `message_end` if the turn finished, or `error` if it failed. This is always the last event.

New event types and fields can be added. Ignore any you don't recognize.

| Event | Meaning | Example `data` |
| - | - | - |
| `message_start` | The turn started. | `{"type":"message_start","message":{"id":"msg_3f9c...","model":"lana-thinking"}}` |
| `content_block_delta` (`text_delta`) | A chunk of the answer. | `{"type":"content_block_delta","delta":{"type":"text_delta","text":"SOL is trading at"}}` |
| `content_block_delta` (`thinking_delta`) | A chunk of reasoning. `lana-thinking` only, when Lana reasons. | `{"type":"content_block_delta","delta":{"type":"thinking_delta","thinking":"I should check..."}}` |
| `tool_use` | Lana started a lookup. | `{"type":"tool_use","tool_use_id":"toolu_01...","name":"...","input":{"address":"..."}}` |
| `tool_result` | A lookup finished. `content` is a preview of up to 500 characters. `is_error: true` means it failed; see [Tool errors](#tool-errors). | `{"type":"tool_result","tool_use_id":"toolu_01...","content":"{\"balance\":..."}` |
| `source` | A web page Lana used. `index` matches the `{{cite:N}}` markers in the answer. `snippet` is optional. | `{"type":"source","index":0,"url":"https://...","title":"...","snippet":"..."}` |
| `progress_update` | A short status line during a long turn. Show it apart from the answer. `created_at` is Unix milliseconds. | `{"type":"progress_update","id":"progress_8a1b...","message":"I'll check this wallet's recent swaps.","created_at":1760436000000}` |
| `ui_block` | One UI component. Needs `include_ui_schema`. `tool_use_id` is optional. | `{"type":"ui_block","tool_use_id":"toolu_01...","component":"...","schema":{...}}` |
| `document` | A downloadable file. Needs `include_documents`. `format` is `csv`, `json`, or `txt`. `tool_use_id` and `description` are optional. | `{"type":"document","filename":"usdc-holders","format":"csv","content":"owner,amount\n...","description":"..."}` |
| `ui_schema` | All UI components as one tree. Needs `include_ui_schema`. | `{"type":"ui_schema","schema":{...}}` |
| `follow_up` | Suggested next questions. Needs `include_followups`. | `{"type":"follow_up","suggestions":["Show the top 10 holders' recent transfers"]}` |
| `message_end` | The turn finished. See [Stop reasons](#stop-reasons) and [Usage](#usage). | `{"type":"message_end","stop_reason":"end_turn","usage":{"input_tokens":91200,"output_tokens":212,"tool_calls":1,"prompt_tokens":46100,"context_window":200000}}` |
| `error` | The turn failed. See [Errors](#errors). | `{"type":"error","error":{"type":"overloaded_error","message":"Lana is temporarily overloaded. Retry the request shortly."}}` |
| `ping` | A heartbeat every 10 seconds. Ignore it. | `{"type":"ping"}` |

Tips for showing a stream:

* Use `tool_use` for progress indicators only. Tool names and inputs can change.
* With `"markdown"` output, turn each `{{cite:N}}` into a link to the `source` with that `index`, or remove it.
* `ui_block` and `ui_schema` carry the same components. Lana may send only `ui_schema`, so show `ui_block` events if they arrive and otherwise render `ui_schema`.
* Web searches send a `tool_result` with the text `Web search completed.` or `Web fetch completed.` The pages arrive as `source` events.

### Tool errors

A failed lookup doesn't fail the turn. Lana works around it, and you don't need to retry. The `tool_result` has `is_error: true`, and `content` is JSON with a short message and a `code`:

```json theme={"system"}
{ "error": "the data service failed (502)", "code": "upstream_unavailable" }
```

> [accordion] Tool error codes
>
> | `code` | Meaning |
> | - | - |
> | `invalid_input` | The lookup's arguments were invalid. |
> | `not_found` | There's no data for this lookup. Some lookups report a missing item as a normal result instead, such as `{"found": false}`. |
> | `rejected` | The data service rejected the lookup. |
> | `rate_limited` | The data service is rate limiting. |
> | `upstream_timeout` | The data service timed out. |
> | `upstream_unavailable` | The data service failed. |
> | `upstream_error` | A Helius data tool failed. |
> | `timeout` | The lookup ran out of time. |
> | `tool_failed` | The lookup couldn't answer. `error` says why. |
> | `internal` | Something unexpected failed. |
>
> New codes can be added. Treat an unknown code as `internal`.

### Stop reasons

`stop_reason` is on `message_end` and in the JSON response:

| Value | Meaning |
| - | - |
| `end_turn` | Lana finished its answer. |
| `max_tokens` | The answer hit `max_tokens` and may be cut off. |
| `tool_use` | The turn ended on a lookup step, usually at the step limit. |
| `error` | The turn failed. The answer is incomplete. |

### Usage

| Field | Meaning |
| - | - |
| `input_tokens` | Input tokens for the whole turn. |
| `output_tokens` | Output tokens for the whole turn. |
| `tool_calls` | Lookups run in the turn, including some that never appear as `tool_use`. |
| `prompt_tokens` | Input tokens in the last model step. Use it to see how full the context is. |
| `context_window` | The model's context window, currently `200000`. |

Lana's own instructions and lookup tools take about 45,000 tokens on every model step, so `input_tokens` is high even for a short question. Pricing is per request, so token counts don't change what you pay.

## Non-streaming response

With `"stream": false`, you get one JSON object when the turn ends:

```json theme={"system"}
{
  "id": "msg_3f9c...",
  "type": "message",
  "role": "assistant",
  "model": "lana-thinking",
  "content": [
    { "type": "tool_use", "id": "toolu_01...", "name": "...", "input": { "mint": "So11111111111111111111111111111111111111112" } },
    { "type": "tool_result", "tool_use_id": "toolu_01...", "content": "{\"price\":..." },
    { "type": "text", "text": "SOL is trading at ..." }
  ],
  "stop_reason": "end_turn",
  "usage": { "input_tokens": 90800, "output_tokens": 96, "tool_calls": 1, "prompt_tokens": 45600, "context_window": 200000 }
}
```

The answer is the `text` blocks, joined in order. Reasoning and `progress_update` are streaming only.

These fields appear only when they have a value:

| Field | When |
| - | - |
| `ui_schema` | `include_ui_schema` is on and there's something to show. |
| `documents` | `include_documents` is on and Lana made files. Same fields as a `document` event, without `type`. |
| `follow_up` | `include_followups` is on and Lana suggested questions. An array of strings. |
| `sources` | Lana used web pages. Same fields as a `source` event, without `type`. |
| `error` | `stop_reason` is `"error"`. An object with `type` and `message`. |

## Errors

### Before the stream starts

These return a non-`200` status, even with `"stream": true`. No events are sent, and you aren't charged.

| Status | Cause | What to do |
| - | - | - |
| `400` | The body is invalid, for example an unknown model or a `max_tokens` over 8,192. `message` names each bad field. | Fix the request. |
| `401` | The API key is missing or invalid, or was sent as `Authorization: Bearer`. | Send the key in `X-Api-Key` or `?api-key=`. |
| `403` | Your plan doesn't include Lana (the Free plan), or your key's access settings block it. | Upgrade to Developer or above, or check the key's access settings in the [Helius Dashboard](https://dashboard.helius.dev). |
| `400`, body `Bad Request` | The body is over 10 MB. Gatekeeper rejects it before Lana sees it. | Send a smaller request, for example fewer or shorter messages. |
| `429`, body `Too Many Requests` | You're over your plan's [rate limit](https://www.helius.dev/docs/billing/rate-limits.md). | Wait for the `Retry-After` header (1 second), then retry. |
| `429`, body `max usage reached` | Your project is out of credits. | Add credits or upgrade your plan. There's no `Retry-After`; retrying fails until you do. |
| `429`, `error.type` `rate_limit_error` | Your project already has about 3 Lana requests running. | Wait for the `Retry-After` header (5 seconds), then retry. |
| `503` | Lana is at capacity or restarting. | Wait for the `Retry-After` header (5 seconds at capacity, 30 while restarting), then retry. |

The first two `429`s come from your plan, and the response body says which one you hit. The third comes from Lana and has a JSON body.

Lana's own errors (`400` for an invalid body, `429` with `rate_limit_error`, and `503`) have a JSON body. Errors from Gatekeeper (`401`, `403`, the oversized-body `400`, and the plan `429`s) are plain text. Branch on `error.type`, not on `message`:

```json theme={"system"}
{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "max_tokens: max_tokens must be <= 8192"
  }
}
```

### After the stream starts

The status is already `200`, so a failure ends the stream with an `error` event, or with `message_end` and `stop_reason: "error"`. That `message_end` has no `error` object; treat it like an `api_error`. Any answer text before it is partial. Show it as incomplete, or discard it.

### Without streaming

With `"stream": false`, a failed turn returns either:

* `200` with `stop_reason: "error"` and an `error` object, when the turn produced any content, including lookups. Always check `stop_reason`.
* A JSON error body, when the turn produced nothing. The status matches `error.type`: `400` for `context_overflow`, `500` for `api_error`, `502` for `tool_error`, `504` for `timeout_error`, or `529` for `overloaded_error` (the status Anthropic uses for an overloaded model; some HTTP clients don't recognize it, so handle it like `503`). These aren't charged. Handle them as in [Error types](#error-types).

### Error types

| `error.type` | Meaning | What to do |
| - | - | - |
| `invalid_request_error` | The request is invalid. | Fix the request. |
| `context_overflow` | The conversation and lookup results don't fit in the context window. | Drop older messages or ask a narrower question. |
| `overloaded_error` | The model is overloaded. | Retry with exponential backoff. |
| `timeout_error` | The turn ran out of time. | Ask a narrower question, or use `lana-fast`. |
| `tool_error` | A lookup service Lana depends on failed. | Retry with backoff. |
| `rate_limit_error` | Your project has about 3 requests running. | Retry after the `Retry-After` header. |
| `api_error` | Lana failed on the Helius side, or is at capacity. | Retry with backoff. |

Treat any other type like `api_error`.

## Limits

| Limit | Value |
| - | - |
| `max_tokens` | 1 to 8,192 (default 8,192) |
| `system` | Up to 10,000 characters |
| `extensions.attachments` | Up to 8 images |
| Request body | 10 MB |
| Context window | 200,000 tokens, of which about 80% (after `max_tokens`) is for the conversation and lookup results |
| Turn length | 5 minutes |
| Rate limit | Your plan's DAS & Enhanced APIs rate limit. See [Rate Limits](https://www.helius.dev/docs/billing/rate-limits.md#lana-api). |
| Concurrent requests | About 3 per project. Extra requests can get `429` until one finishes. |

When a turn nears 5 minutes, Lana stops looking things up and answers with what it has. Long turns usually end with a partial answer that says what's missing, not a timeout.

Set your HTTP client's read timeout above 5 minutes. When streaming, a `ping` arrives every 10 seconds, so a much longer gap means the connection dropped.

If you disconnect, Lana stops the turn. A request whose stream has already started is still charged.

When Lana is at capacity, new requests get `503` before anything streams. They aren't charged. Retry after the `Retry-After` header.

## Pricing

Each request costs a flat price that depends on the model:

| Model | Credits per request |
| - | - |
| `lana-fast` | **2,000** |
| `lana-thinking` | **10,000** |

The price is the same for streaming and non-streaming requests and on every paid plan (Developer and above). Lana isn't available on the Free plan.

Credits come from your plan. See [Credits](https://www.helius.dev/docs/billing/credits.md#lana-api-credits).

### What's charged

You're charged for every request that gets HTTP `200`, streaming or not, however the turn ends. Requests that get any other status are free.

* A streaming turn that fails with an `error` event, or that you disconnect from after it starts, is charged: the status was already `200`.
* A non-streaming turn that fails with a `5xx` or `400`, or a request rejected before the turn starts (`400`, `401`, `403`, `429`, `503`), is free.

## More examples

### Set the tone and the user's wallet

```bash cURL theme={"system"}
curl https://beta.helius-rpc.com/v1/lana/messages \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d '{
    "model": "lana-thinking",
    "system": "Answer in at most three bullet points.",
    "messages": [{ "role": "user", "content": "How did my wallet do this week?" }],
    "extensions": {
      "read_only": true,
      "user_context": {
        "wallet": "YOUR_WALLET_ADDRESS",
        "address_kind": "wallet",
        "time_zone": "America/New_York"
      }
    }
  }'
```

### Scan a wallet's full history

```bash cURL theme={"system"}
curl -N https://beta.helius-rpc.com/v1/lana/messages \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d '{
    "model": "lana-thinking",
    "stream": true,
    "messages": [{ "role": "user", "content": "Over the last 5,000 transactions of YOUR_WALLET_ADDRESS, which programs did it use most?" }],
    "extensions": { "read_only": true, "enable_deep_scan": true }
  }'
```

### Get UI components, follow-ups, and a CSV

```bash cURL theme={"system"}
curl https://beta.helius-rpc.com/v1/lana/messages \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -d '{
    "model": "lana-thinking",
    "messages": [{ "role": "user", "content": "Export the top holders of So11111111111111111111111111111111111111112 as a CSV" }],
    "extensions": {
      "read_only": true,
      "include_ui_schema": true,
      "include_followups": true,
      "include_documents": true
    }
  }'
```

## Next steps

> [card] [API Reference](https://www.helius.dev/docs/api-reference/lana/messages.md)
>
> The request and response schema, with a playground.

> [card] [Rate Limits](https://www.helius.dev/docs/billing/rate-limits.md#lana-api)
>
> Lana's per-plan rate limits.

> [card] [Credits](https://www.helius.dev/docs/billing/credits.md#lana-api-credits)
>
> How Lana requests use your plan's credits.

> [card] [Contact Support](https://www.helius.dev/docs/support/contact-support)
>
> Get help through Discord, chat, or email.


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