@unisat/openapi-cli
v1.0.0
Published
UniSat AI Kit CLI capability layer
Maintainers
Readme
@unisat/openapi-cli
This package owns the stable external CLI command surface for direct UniSat OpenAPI HTTPS calls.
Requires Node.js ^22.23.4 || ^24.22.1 || ^26.12.1 and npm. Install globally:
npm install -g @unisat/openapi-cliFirst query (replace the key placeholder locally):
unisat-openapi-cli config bitcoin-key --api-key YOUR_BITCOIN_API_KEY
unisat-openapi-cli config status --env bitcoin --format json
unisat-openapi-cli getBlockchainInfo --env bitcoin --format jsonObtain a key at https://developer.unisat.io/. Read the latest indexed height from response.body.data.blocks. Success requires exit code 0, response.ok: true and business code: 0; HTTP 200 alone is insufficient. No wallet or address is needed.
Supported commands include:
config bitcoin-keyconfig fractal-keyapi callcommands domainsandcommands --domain blockchain- Named API commands such as
getBlockchainInfo <command> --helpand<command> --dry-run
Use built-in discovery and per-command help to choose an API; no Agent Skill or source checkout is required. Domains are business categories, not networks. commands --all can produce very large output. Use text for discovery and JSON for structured results. Top-level --help explains quota lookup and safety limits.
Environments:
bitcoin->https://open-api.unisat.io->UNISAT_BITCOIN_API_KEYfractal->https://open-api-fractal.unisat.io->UNISAT_FRACTAL_API_KEY
Recommended CLI flow:
node bin/unisat-ai.js config bitcoin-key --api-key YOUR_BITCOIN_KEY
node bin/unisat-ai.js api call --env bitcoin --path "/v1/indexer/address/{address}/balance" --path-param address=YOUR_ADDRESS --format jsonFractal example:
node bin/unisat-ai.js config fractal-key --api-key YOUR_FRACTAL_KEY
node bin/unisat-ai.js api call --env fractal --path "/v1/public/fractal/supply" --format jsonUse node bin/unisat-ai.js --help for command usage.
API keys are stored in a user config .env file by the config commands. api call reads keys in this order: --api-key, process environment, user config .env.
Swagger is downloaded on demand and cached locally. Use unisat-openapi-cli swagger status to inspect the cache or swagger refresh to update it. OPENAPI_SWAGGER_DIR supplies a local override.
Website Download Package
The repository can also build single-executable CLI archives for users who do not have Node.js or npm installed:
npm run package:cliEach archive contains:
unisat-openapi-cli.exeon Windows, orunisat-openapi-clion macOS/Linux- bundled CLI code
- remote Swagger download and local cache support
Users configure keys the same way:
unisat-openapi-cli config bitcoin-key --api-key YOUR_BITCOIN_KEY
unisat-openapi-cli config fractal-key --api-key YOUR_FRACTAL_KEY