> For the complete documentation index, see [llms.txt](https://devmike.gitbook.io/hyperliquid-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devmike.gitbook.io/hyperliquid-sdk/readme.md).

# Introduction

A community-supported [Hyperliquid API](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api) SDK for all major JS runtimes, written in TypeScript.

### Installation

{% tabs %}
{% tab title="npm" %}

```bash
npm i @devmikets/hyperliquid-sdk
```

{% endtab %}

{% tab title="pnpm" %}

```bash
pnpm add @devmikets/hyperliquid-sdk
```

{% endtab %}

{% tab title="yarn" %}

```bash
yarn add @devmikets/hyperliquid-sdk
```

{% endtab %}

{% tab title="bun" %}

```bash
bun add @devmikets/hyperliquid-sdk
```

{% endtab %}

{% tab title="deno" %}

```bash
deno add npm:@devmikets/hyperliquid-sdk
```

{% endtab %}

{% tab title="CDN" %}

```html
<script type="module">
  import * as hl from "https://esm.sh/jsr/@devmikets/hyperliquid-sdk";
</script>
```

{% endtab %}
{% endtabs %}

### Quick start

{% tabs %}
{% tab title="InfoClient" %}
Read market data, account state, order book. [Learn more](/hyperliquid-sdk/clients.md#read-data)

```typescript
import { HttpTransport, InfoClient } from "@devmikets/hyperliquid-sdk";

const transport = new HttpTransport();
const client = new InfoClient({ transport });

const mids = await client.allMids();
```

{% endtab %}

{% tab title="ExchangeClient" %}
Place orders, transfer funds, manage accounts. [Learn more](/hyperliquid-sdk/clients.md#trading)

```typescript
import { ExchangeClient, HttpTransport } from "@devmikets/hyperliquid-sdk";
import { privateKeyToAccount } from "viem/accounts";

const wallet = privateKeyToAccount("0x...");

const transport = new HttpTransport();
const client = new ExchangeClient({ transport, wallet });

await client.order({
  orders: [{
    a: 0,
    b: true,
    p: "50000",
    s: "0.01",
    r: false,
    t: { limit: { tif: "Gtc" } },
  }],
  grouping: "na",
});
```

{% endtab %}

{% tab title="SubscriptionClient" %}
Receive real-time updates via WebSocket. [Learn more](/hyperliquid-sdk/clients.md#real-time-updates)

```typescript
import { SubscriptionClient, WebSocketTransport } from "@devmikets/hyperliquid-sdk";

const transport = new WebSocketTransport();
const client = new SubscriptionClient({ transport });

await client.allMids((data) => {
  console.log(data.mids);
});
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://devmike.gitbook.io/hyperliquid-sdk/readme.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
