> For the complete documentation index, see [llms.txt](https://cetus-1.gitbook.io/cetus-developer-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cetus-1.gitbook.io/cetus-developer-docs/developer/cetus-aggregator/prerequisites.md).

# Prerequisites

## 1. **NPM install**

```
npm install @cetusprotocol/aggregator-sdk
```

## 2. Setting Up Configuration <a href="#setting-up-configuration" id="setting-up-configuration"></a>

Initialize **mainnet**  `Aggregator client`. There are two ways to initialize the aggregator client. One is straightforward, using the default mainnet client, while the other supports a high level of customization.

{% hint style="success" %}
Aggregator Version v3 is fully backward compatible with v2, so no changes are required when initializing the AggregatorClient, regardless of whether you're using the v2 or v3 version.
{% endhint %}

### Example

1. Fast create mainnet aggregator client default.

```typescript
import { AggregatorClient } from "@cetusprotocol/aggregator-sdk"

const client = new AggregatorClient({})
```

2. (Enhance) Customer create aggregator client by your self rpc node.

<pre class="language-typescript"><code class="lang-typescript">import { AggregatorClient } from "@cetusprotocol/aggregator-sdk"
import { SuiGrpcClient } from "@mysten/sui/grpc"
import dotenv from 'dotenv'

dotenv.config()

// used to do simulate swap and swap
// https://fullnode.mainnet.sui.io:443
const fullNodeURL = process.env.SUI_RPC!

const suiClient = new SuiGrpcClient({
    network: 'mainnet',
    baseUrl: fullNodeURL,                                                                                                                                            
})

// set your wallet address, used to do simulate
const wallet = "0x..."

// import { Env } from "@cetusprotocol/aggregator-sdk"
<strong>// Currently, we provide full support for Mainnet, 
</strong><strong>// while Testnet is only supported for Cetus and DeepBook providers.
</strong>const client = new AggregatorClient({
  // endpoint, // If you do not have a exclusive aggregator api domain，just use cetus default aggregator endpoints.
  signer: wallet,
  client: suiClient,
  env: Env.Mainnet,
  pythUrls?: ["YOUR_PYTH_URL", "ANOTHER_PYTH_URL"], // Optional. Custom Pyth price feed URLs. Defaults to null (uses built-in endpoints).
  partner?: "YOUR_CETUS_CLMM_PARTNER_ID", // Optional. Partner ID for CLMM fee sharing. Set once during initialization instead of per swap. Defaults to null (no fee sharing).
  cetusDlmmPartner?: "YOUR_CETUS_DLMM_PARTNER_ID", // Optional. Partner ID for DLMM fee sharing. Defaults to null (no fee sharing).
  overlayFeeRate?: 0.01, // Optional. Overlay fee rate (0.01 represents 1%). Defaults to 0 (no overlay fee).
  overlayFeeReceiver?: "0x..", // Optional. Address to receive the overlay fees. Defaults to null. Required if overlayFeeRate is set.
})
</code></pre>

**Notes**: Some providers, such as **HaedalHMM,** **Metastable, Steamm Omm, SevenK**, rely on **Pyth oracle** prices when build transactions. Currently, we have a default configuration that connects to Pyth's publicly available node. However, if you frequently build transactions, we recommend setting up a **private Pyth node interface** as an additional backup. This will ensure uninterrupted access to those providers, even if the public node experiences occasional downtime.

3. (**Project integration**) Increase QPS limit through specific domain name and API key

```typescript
import { AggregatorClient } from "@cetusprotocol/aggregator-sdk"
import { SuiClient } from '@mysten/sui/client';
import dotenv from 'dotenv'

dotenv.config()

// used to do simulate swap and swap
// https://fullnode.mainnet.sui.io:443
const fullNodeURL = process.env.SUI_RPC!

const suiClient = new SuiClient({
    url: fullNodeURL,
})

// provider by cetus
const endpoint = "https://<YOUR_DOMAIN>/router_v3"
const apiKey = "<YOUR_API_KEY>"

// set your wallet address, used to do simulate
const wallet = "0x..."

// import { Env } from "@cetusprotocol/aggregator-sdk"
// Currently, we provide full support for Mainnet, 
// while Testnet is only supported for Cetus and DeepBook providers.
const client = new AggregatorClient({
  endpoint,
  apiKey,
  signer: wallet,
  client: suiClient,
  env: Env.Mainnet,
  pythUrls?: ["YOUR_PYTH_URL", "ANOTHER_PYTH_URL"], // Optional. Custom Pyth price feed URLs. Defaults to null (uses built-in endpoints).
  partner?: "YOUR_CETUS_CLMM_PARTNER_ID", // Optional. Partner ID for CLMM fee sharing. Set once during initialization instead of per swap. Defaults to null (no fee sharing).
  cetusDlmmPartner?: "YOUR_CETUS_DLMM_PARTNER_ID", // Optional. Partner ID for DLMM fee sharing. Defaults to null (no fee sharing).
  overlayFeeRate?: 0.01, // Optional. Overlay fee rate (0.01 represents 1%). Defaults to 0 (no overlay fee).
  overlayFeeReceiver?: "0x..", // Optional. Address to receive the overlay fees. Defaults to null. Required if overlayFeeRate is set.
})
```


---

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

```
GET https://cetus-1.gitbook.io/cetus-developer-docs/developer/cetus-aggregator/prerequisites.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
