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.gitPrerequisites
You'll need credentials from Chaos Labs to get started. Contact support@chaoslabs.co to request access.
| Requirement | Description |
|---|---|
| Bun | JavaScript runtime - Install Bun |
| NPM Access Token | For installing @chaoslabs/ai-sdk (private package) |
| Chaos API Key | For authenticating API requests (format: ck-...) |
Setup
1
Clone the quickstart repo
git clone https://github.com/ChaosLabsInc/ai-sdk-quickstart.git
cd ai-sdk-quickstartCopy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
2
Configure environment
cp .env.example .envCopy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Edit .env and add your credentials:
NPM_ACCESS_TOKEN=npm_your-access-token-here
CHAOS_API_KEY=ck-your-api-key-here
WALLET_ADDRESS=0x3e8734ec146c981e3ed1f6b582d447dde701d90cCopy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
3
Install dependencies
source .env
bun installCopy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
4
Run examples
bun run example:01 # Run single example
bun run all # Run all 15 examplesCopy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Examples
| Example | Run Command | What You'll Learn |
|---|---|---|
| basic-query.ts | bun run example:01 | Query portfolio holdings, parse table and chart responses |
| swap-action.ts | bun run example:02 | Request DeFi swaps, parse transaction primitives and risk data |
| multi-turn.ts | bun run example:03 | Maintain conversation context across multiple queries |
| block-parsing.ts | bun run example:04 | Parse all block types: tables, charts, actions, markdown |
| error-handling.ts | bun run example:05 | Handle API errors, timeouts, and network failures gracefully |
| lending-operations.ts | bun run example:06 | Supply to Aave/Compound, check yields, query positions |
| perps-trading.ts | bun run example:07 | Open leveraged long/short positions on GMX |
| prediction-markets.ts | bun run example:08 | Query Polymarket trends, view odds and market data |
| vault-operations.ts | bun run example:09 | Interact with Morpho vaults, Pendle yield tokenization |
| staking.ts | bun run example:10 | Liquid staking with Lido (stETH), compare staking yields |
| restaking.ts | bun run example:11 | EigenLayer, EtherFi, and Renzo restaking protocols |
| leveraged-farming.ts | bun run example:12 | Gearbox credit accounts and leveraged yield strategies |
| stablecoin-operations.ts | bun run example:13 | Ethena USDe minting, redemption, sUSDe staking |
| liquidity-provision.ts | bun run example:14 | Curve AMM pools, add/remove liquidity |
| bridging-transfers.ts | bun run example:15 | Cross-chain bridging and token transfers |
Related Pages
Was this helpful?