npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@opensea/cli

v0.4.1

Published

OpenSea CLI - Query the OpenSea API from the command line or programmatically

Readme

Version npm Test CI License

opensea-cli

Query the OpenSea API from the command line or programmatically. Designed for both AI agents and developers.

Table of Contents

Install

npm install -g @opensea/cli

Or use without installing:

npx @opensea/cli collections get mfers

Authentication

Set your API key via environment variable or flag:

export OPENSEA_API_KEY=your-api-key
opensea collections get mfers

# or pass inline
opensea --api-key your-api-key collections get mfers

Get an API key at docs.opensea.io.

Quick Start

# Get collection details
opensea collections get mfers

# Get floor price and volume stats
opensea collections stats mfers

# List NFTs in a collection
opensea nfts list-by-collection mfers --limit 5

# Get best listings
opensea listings best mfers --limit 5

# Search across OpenSea
opensea search collections "cool cats"

# Get trending tokens
opensea tokens trending --limit 5

# Human-readable table output
opensea --format table collections stats mfers

Commands

| Command | Description | |---|---| | collections | Get, list, stats, and traits for NFT collections | | nfts | Get, list, refresh metadata, and contract details for NFTs | | listings | Get all, best, or best-for-nft listings | | offers | Get all, collection, best-for-nft, and trait offers | | events | List marketplace events (sales, transfers, mints, etc.) | | search | Search collections, NFTs, tokens, and accounts | | tokens | Get trending tokens, top tokens, and token details | | swaps | Get swap quotes for token trading | | accounts | Get account details |

Global options: --api-key, --chain (default: ethereum), --format (json/table/toon), --base-url

Full command reference with all options and flags: docs/cli-reference.md

Programmatic SDK

import { OpenSeaCLI, OpenSeaAPIError } from "@opensea/cli"

const client = new OpenSeaCLI({ apiKey: process.env.OPENSEA_API_KEY })

const collection = await client.collections.get("mfers")
const { nfts } = await client.nfts.listByCollection("mfers", { limit: 5 })
const { listings } = await client.listings.best("mfers", { limit: 10 })
const { asset_events } = await client.events.byCollection("mfers", {
  eventType: "sale",
})
const { tokens } = await client.tokens.trending({ chains: ["base"], limit: 5 })
const results = await client.search.collections("mfers", { limit: 5 })

// Error handling
try {
  await client.collections.get("nonexistent")
} catch (error) {
  if (error instanceof OpenSeaAPIError) {
    console.error(error.statusCode)   // e.g. 404
    console.error(error.responseBody) // raw API response
    console.error(error.path)         // request path
  }
}

Full SDK reference: docs/sdk.md

Output Formats

JSON (default) - structured output for agents and scripts:

opensea collections get mfers

Table - human-readable output:

opensea --format table collections list --limit 5

TOON - Token-Oriented Object Notation, a compact format that uses ~40% fewer tokens than JSON. Ideal for piping output into LLM / AI agent context windows:

opensea --format toon tokens trending --limit 5

Example TOON output for a list of tokens:

tokens[3]{name,symbol,chain,market_cap,price_usd}:
  Ethereum,ETH,ethereum,250000000000,2100.50
  Bitcoin,BTC,bitcoin,900000000000,48000.00
  Solana,SOL,solana,30000000000,95.25
next: abc123

TOON collapses uniform arrays of objects into CSV-like tables with a single header row, while nested objects use YAML-like indentation. The encoder follows the TOON v3.0 spec and is implemented without external dependencies.

TOON is also available programmatically via the SDK:

import { formatToon } from "@opensea/cli"

const data = await client.tokens.trending({ limit: 5 })
console.log(formatToon(data))

Exit Codes

  • 0 - Success
  • 1 - API error
  • 2 - Authentication error

Requirements

Development

npm install             # Install dependencies
npm run build           # Build CLI + SDK
npm run dev             # Build in watch mode
npm run test            # Run tests
npm run lint            # Lint with Biome
npm run format          # Format with Biome
npm run type-check      # TypeScript type checking

Docs

| Document | Description | |---|---| | CLI Reference | Full command reference with all options and flags | | Examples | Real-world usage examples for every command | | SDK Reference | Full programmatic SDK API with all methods | | Pagination | Cursor-based pagination patterns for CLI and SDK | | Event Types | Event type values and filtering |