Skip to main content

Install

Peer dependencies

The SDK depends on viem for EVM wallet operations (x402 payment signing). It’s installed automatically as a dependency. For raw x402 payments (without a Compose Key), you also need @x402/core and @x402/evm:
These are already included as dependencies of @compose-market/sdk, so you only need to install them separately if you’re using x402 outside the SDK.

Requirements

  • Node.js 20.6+ (uses native fetch, ReadableStream, TextDecoder, WebCrypto)
  • TypeScript 5+ (if using TypeScript — the SDK ships with type definitions)

Initialize

Configuration options

Authentication

There are two ways to authenticate:
  1. Compose Key (recommended): A bearer token issued by sdk.keys.create(). No wallet signing needed — just pass userAddress and chainId. The SDK handles token storage and refresh automatically.
  2. Raw x402: Sign each request with an EVM wallet. No Compose Key needed, but every call requires a payment signature. Use this for agent-to-agent calls where no human is in the loop.
See Payments Overview for the full comparison.