Quick Start

Updated

Get hands-on experience with the Chaos AI SDK through 15 working examples. This repository demonstrates real-world DeFi operations including portfolio queries, swaps, lending, staking, and more.

ChaosLabsInc/ai-sdk-quickstart

15 working examples demonstrating the full capabilities of the Chaos AI SDK

TypeScript15 Examples
git clone https://github.com/ChaosLabsInc/ai-sdk-quickstart.git

Prerequisites

You'll need credentials from Chaos Labs to get started. Contact support@chaoslabs.co to request access.
RequirementDescription
BunJavaScript runtime - Install Bun
NPM Access TokenFor installing @chaoslabs/ai-sdk (private package)
Chaos API KeyFor authenticating API requests (format: ck-...)

Setup

1

Clone the quickstart repo

git clone https://github.com/ChaosLabsInc/ai-sdk-quickstart.git
cd ai-sdk-quickstart
2

Configure environment

cp .env.example .env

Edit .env and add your credentials:

NPM_ACCESS_TOKEN=npm_your-access-token-here
CHAOS_API_KEY=ck-your-api-key-here
WALLET_ADDRESS=0x3e8734ec146c981e3ed1f6b582d447dde701d90c
3

Install dependencies

source .env
bun install
4

Run examples

bun run example:01  # Run single example
bun run all         # Run all 15 examples

Examples

ExampleRun CommandWhat You'll Learn
basic-query.tsbun run example:01Query portfolio holdings, parse table and chart responses
swap-action.tsbun run example:02Request DeFi swaps, parse transaction primitives and risk data
multi-turn.tsbun run example:03Maintain conversation context across multiple queries
block-parsing.tsbun run example:04Parse all block types: tables, charts, actions, markdown
error-handling.tsbun run example:05Handle API errors, timeouts, and network failures gracefully
lending-operations.tsbun run example:06Supply to Aave/Compound, check yields, query positions
perps-trading.tsbun run example:07Open leveraged long/short positions on GMX
prediction-markets.tsbun run example:08Query Polymarket trends, view odds and market data
vault-operations.tsbun run example:09Interact with Morpho vaults, Pendle yield tokenization
staking.tsbun run example:10Liquid staking with Lido (stETH), compare staking yields
restaking.tsbun run example:11EigenLayer, EtherFi, and Renzo restaking protocols
leveraged-farming.tsbun run example:12Gearbox credit accounts and leveraged yield strategies
stablecoin-operations.tsbun run example:13Ethena USDe minting, redemption, sUSDe staking
liquidity-provision.tsbun run example:14Curve AMM pools, add/remove liquidity
bridging-transfers.tsbun run example:15Cross-chain bridging and token transfers
Was this helpful?