# openspender

> CLI and JavaScript client for OpenSpender — the self-custodial wallet that lets AI agents pay for models, search, and compute as they go.

Latest version **0.6.2** (published 2026-09-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install openspender
pnpm add openspender
yarn add openspender
bun add openspender
```

Provides the command `openspender`.

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.6.2 |
| Published | 2026-09-17 |
| First published | 2026-08-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 36.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Krishna Madala |
| Maintainers | imkrishnamadala |
| Keywords | openspender, wallet, payments, ai-agents, x402, mpp, claude |

## Links

- npm: https://www.npmjs.com/package/openspender
- Repository: https://github.com/openspender/openspender
- Homepage: https://openspender.com
- Issues: https://github.com/openspender/openspender/issues
- npm.io page: https://npm.io/package/openspender

## Recent versions

- 0.6.2 (latest) — 2026-09-17
- 0.6.1 — 2026-08-28
- 0.6.0 — 2026-08-27
- 0.5.1 — 2026-08-26
- 0.5.0 — 2026-08-25
- 0.4.2 — 2026-08-24
- 0.4.1 — 2026-08-23
- 0.4.0 — 2026-08-22
- 0.3.0 — 2026-08-22
- 0.2.0 — 2026-08-20

## README

# openspender

CLI and JavaScript client for [OpenSpender](https://openspender.com) — the self-custodial
wallet that lets AI agents like Claude Code pay for models, search, video, and compute
as they go. Load once, then your agent buys what it needs, billed per call with no
markup and no subscriptions.

OpenSpender routes requests to 15,000+ machine-payable endpoints across the
[x402](https://openspender.com/services) and [MPP](https://openspender.com/mpp)
payment standards.

## Connect every AI tool at once

```sh
npx openspender connect
```

Detects Claude Code, Codex, opencode, Gemini CLI, and Cursor, opens one browser
approval, and wires every detected tool to OpenSpender's MCP server — each with
its own freshly minted card at caps chosen on the consent screen. Tools are
authenticated the moment the command finishes. Caps, activity, and revocation
live at [openspender.com/wallet](https://openspender.com/wallet).

Connect also installs the OpenSpender agent skill for each connected tool —
fetched from [openspender.com/SKILL.md](https://openspender.com/SKILL.md) at run
time, so a rerun always installs the current version. Harnesses with a skills
directory get the full file; harnesses that read a global memory file get a
compact block between `openspender:skill` markers, and reruns replace only what
sits between those markers — the rest of your files is never touched.

Flags: `--dry-run` previews without writing, `--force` rewrites existing
entries, `--no-auth` skips the browser approval (each tool then authenticates
itself on first use), `--no-skill` skips the skill install, and
`--card openspender_…` uses one existing card for everything (headless
machines, CI).

## Getting started

```sh
npx openspender init
```

This sets up your local config, checks connectivity, and walks you through the two
steps that happen in your browser and shell:

1. **Fund a wallet and mint an allowance token** at
   [openspender.com/wallet](https://openspender.com/wallet). OpenSpender is
   self-custodial — your keys, your money.
2. **Export the token** so your tools can spend against the allowance:

   ```sh
   export OPENSPENDER_ALLOWANCE_TOKEN="<your token>"
   ```

Existing SDKs work unchanged by pointing them at the router. For Claude:

```sh
export ANTHROPIC_BASE_URL="https://openspender.com/v1/anthropic"
export ANTHROPIC_AUTH_TOKEN="$OPENSPENDER_ALLOWANCE_TOKEN"
```

Check your setup any time with:

```sh
npx openspender status
```

## Library usage

Requires Node.js 18 or later.

```js
import { OpenSpender } from "openspender";

const client = new OpenSpender(); // reads OPENSPENDER_ALLOWANCE_TOKEN

// Call any machine-payable endpoint: POST https://openspender.com/v1/{provider}/{endpoint}
const result = await client.request("exa", "search", {
  query: "latest x402 ecosystem news",
});

// Public network stats (no token required)
const stats = await client.stats();
console.log(stats.totalServices);
```

When a provider responds with `402 Payment Required`, the OpenSpender router reads the
challenge, checks it against your allowance, pays, and replays the request — your code
just sees the result.

## Status

Early release under active development — the API surface may change before 1.0.
Feedback and issues are welcome at
[github.com/openspender/openspender](https://github.com/openspender/openspender/issues).

## Documentation

Full docs live at [openspender.com/docs](https://openspender.com/docs).

## Security

OpenSpender handles payments, so we take security seriously. Please report
vulnerabilities privately — see [SECURITY.md](SECURITY.md).

## License

MIT

---
_Source: https://npm.io/package/openspender · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
