Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@degenai/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@degenai/cli
AI image generation, upscaling, and editing — paid per call in USDC on Base via x402. No accounts, no API keys, no signups. Just a Base wallet with USDC.
Install
npm install -g @degenai/cliRequires Node.js 18+.
Quick start
# 1. Set a Base wallet (HOT wallet — fund with $5–10 only, never your main wallet)
export DEGENAI_PRIVATE_KEY=0x... # macOS / Linux
$env:DEGENAI_PRIVATE_KEY = "0x..." # Windows PowerShell
# 2. Verify setup, balances, and API reachability
degenai init
# 3. Generate — cheapest first
degenai generate -p "neon cyberpunk cat" --flow -m nano-banana -a 16:9 -o cat.png # $0.005
degenai generate -p "neon cyberpunk cat" -o cat.png # $0.015 (default)That's it — payment, image, save. No further setup.
Two cheap paths
nano-bananaorprovia the Flow path — $0.005 per image (cheapest). Add--flowplus-m nano-bananaor-m pro, plus-a 16:9 / 9:16 / 4:3 / 3:4. Always 1K. The CLI validates these constraints before sending payment, so no USDC is spent on a misconfigured call.gpt-image-2— $0.015 per image (default). Plaindegenai generate -p "…"with no extra flags hitsgpt-image-2. Any aspect ratio, 1K.
Windows PowerShell users
If degenai --version prints UnauthorizedAccess / running scripts is disabled on this system, your PowerShell is blocking unsigned .ps1 shims that npm installs. Two options:
- Use Git Bash / cmd / Windows Terminal with bash — the CLI works there with no changes.
- Or unblock PowerShell once (per-user, safe):
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
This is a Windows-wide policy, not a @degenai/cli issue — it affects all globally-installed npm CLIs the same way.
Hot-wallet warning
DEGENAI_PRIVATE_KEY is read on every command. Use a dedicated wallet with only enough USDC for what you intend to spend (a few dollars). Never paste your main / hardware-wallet private key. If the env var leaks (shell history, CI logs, malicious package), the funds in that wallet are lost.
Commands
degenai init
Setup check: validates DEGENAI_PRIVATE_KEY, derives your address, queries USDC + ETH balances on Base, and confirms the API is reachable.
degenai pricing
Lists current per-service pricing from the live API.
degenai generate
degenai generate -p "<prompt>" [--flow] [-m <model>] [-a <ratio>] [-r <res>] [-i <input>] [-o <out>]--flow— $0.005 path. Requires-m nano-bananaor-m pro, and-a 16:9 / 9:16 / 4:3 / 3:4. Always 1K.-m, --model— defaultgpt-image-2($0.015). Others:nano-banana($0.05) ·seedream($0.10) ·pro($0.15) ·gpt-image($0.15)-a, --aspect—Auto(default),1:1,16:9,9:16,4:3,3:4, …-r, --resolution—1K(default),2K,4K(4K only onpro; ignored on--flow)-i, --image— input image for img2img; repeat flag for multiple inputs
degenai upscale
degenai upscale -i in.png -s 4 -o big.png # 2x ($0.05) or 4x ($0.10)degenai remove-bg
degenai remove-bg -i in.png -o transparent.png # $0.02degenai magic-eraser
degenai magic-eraser -i in.png -k mask.png -o out.png # $0.02 (white in mask = erase)Environment variables
| Variable | Required | Default | Purpose |
|---|---|---|---|
DEGENAI_PRIVATE_KEY |
yes (except pricing / init info) |
— | Base wallet that pays via x402 |
DEGENAI_API_URL |
no | https://aibasegen.vercel.app |
Override API host (self-hosted / staging) |
BASE_RPC_URL |
no | https://mainnet.base.org |
Custom Base RPC for init balance checks |
How payment works
Each command opens an HTTPS request to the API, receives an HTTP 402 Payment Required response with payment requirements, signs an EIP-3009 USDC transferWithAuthorization with your private key, retries the request with the signed X-PAYMENT header, and the server settles on Base before returning your result. You only pay on success — settlement runs before the expensive AI work, and the response is HTTP-streamed back. Powered by @x402/fetch.
Web playground & alternatives
- Browser (no CLI, no private key paste): https://aibasegen.vercel.app
- MCP server (Claude / Cursor): coming soon
License
MIT