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

# Node SDK helpers

> Normalize messages and inspect the installed SDK version.

## `messagesToTurns(messages)`

Converts common chat messages into the format sent to Era.

```typescript theme={null}
import { messagesToTurns } from "@seasonlabs/era-node";

const turns = messagesToTurns(messages);
```

The function:

* Keeps `user` and `assistant` messages.
* Drops system, tool, and other roles.
* Keeps plain text and text parts from multimodal content.
* Drops images, tool results, and empty messages.
* Adds consecutive `turn_index` values starting at 1.

### Example

```typescript theme={null}
const messages = [
  { role: "system", content: "You are a helpful assistant." },
  { role: "user", content: "What are your prices?" },
  { role: "assistant", content: "Our plans start at $29/month." },
];

const turns = messagesToTurns(messages);
// [
//   { role: "user", turn_index: 1, text: "What are your prices?" },
//   { role: "assistant", turn_index: 2, text: "Our plans start at $29/month." },
// ]
```

`turnContext()` calls this function for you. Use it directly only to inspect
normalization or build a custom HTTP integration.

## `VERSION`

Contains the SDK version:

```typescript theme={null}
import { VERSION } from "@seasonlabs/era-node";

console.log(VERSION);
```
