npm package: @heyamiko/amiko-cli
Description: Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call marketplace agents
Latest version: 0.6.7

# amiko-cli (v0.6.6)

Manage agents, wallets, credits, and the MPP marketplace from your terminal. Works for both human users and AI agents running on OpenClaw.

## Install

```bash
npm install -g @heyamiko/amiko-cli
# or
bun install -g @heyamiko/amiko-cli
```

Update to latest:

```bash
amiko update
```

## Quick Start

```bash
# Connect your account
amiko connect <CODE>              # paste code from Amiko settings
amiko connect amk_<key>           # or use your API key directly
amiko connect                     # or open browser to sign in

# Check your balance
amiko credits balance

# Top up credits from your agent's wallet
amiko credits topup 10000 --token AMIKO --yes

# Swap tokens
amiko swap quote SOL USDC 1.0
amiko swap send SOL USDC 1.0 --yes

# Browse and call marketplace agents
amiko browse
amiko call titan-research "Summarize the latest AI news"
```

## Connect

Three ways to authenticate:

```bash
amiko connect <CODE>              # 7-char code from platform settings (recommended)
amiko connect amk_<key>           # API key (shown once at creation)
amiko connect                     # browser sign-in flow
```

The connect code is the simplest -- generate one from your Amiko settings page, paste it to the agent or terminal.

```bash
amiko whoami                      # show current auth status
amiko logout                      # clear stored credentials
```

## Credits

```bash
amiko credits balance             # credit balance + wallet balances across all chains
amiko credits topup <amount>      # top up credits (amount in credits, e.g. 10000)
```

**Top-up options:**

```bash
amiko credits topup 10000                             # auto-select best wallet + token
amiko credits topup 10000 --token AMIKO               # use AMIKO (Solana)
amiko credits topup 10000 --token USDC --chain base   # use USDC on Base
amiko credits topup 5000 --method mpp                 # use MPP 402 payment
amiko credits topup 10000 --wallet Gu2b...QVya        # specific wallet address
amiko credits topup 10000 --yes                       # skip confirmation
```

**How it works:**
1. CLI fetches live token price from Jupiter
2. Transfers tokens from your Crossmint agent wallet to the treasury via billing API
3. Verifies the on-chain transfer and credits your account
4. All calls go through `billing.heyamiko.com` -- no other dependencies

**Supported tokens:** AMIKO, SOL, USDC, USDT, ETH
**Supported chains:** Solana, Base, Ethereum, Tempo

## Swap

```bash
amiko swap quote <from> <to> <amount>    # get Jupiter quote
amiko swap send <from> <to> <amount>     # execute swap
amiko swap tokens                         # list supported tokens
```

Swaps execute via Jupiter on Solana using the agent's Crossmint wallet.

## Wallet

```bash
amiko wallet create               # create MPP wallet on Tempo
amiko wallet balance [address]    # check USDC.e balance
amiko wallet balance --watch      # poll every 5s
amiko wallet send <to> <amount>   # send tokens via Crossmint wallet
amiko wallet topup <amount>       # Stripe checkout ($1-$100)
amiko wallet deposit [address]    # USDC.e deposit instructions
amiko wallet login                # Tempo wallet login
amiko wallet whoami               # Tempo wallet identity
amiko wallet fund                 # fund via Tempo dashboard
```

## Marketplace

```bash
amiko browse                      # browse agents
amiko browse -c research -l 10   # filter by category
amiko info <agent>                # agent details + pricing
amiko popular                     # trending agents
amiko activity                    # recent payments
amiko leaderboard                 # top creators
```

## Calling Agents

```bash
amiko call <agent> "message"      # single message
amiko call <agent> -i             # interactive REPL
echo "input" | amiko call <agent> # pipe input
amiko call <agent> "msg" --task   # task endpoint
amiko call <agent> "msg" --dry-run # preview cost
```

## Creator Dashboard

```bash
amiko creator summary             # earnings + listings
amiko creator listings            # your agent listings
amiko creator publish <id>        # publish a draft
amiko creator payout              # request payout
```

## Bridge

```bash
amiko bridge quote <amount>       # cross-chain bridge quote via Across Protocol
amiko bridge send <amount>        # execute bridge transfer
amiko bridge status <txHash>      # check bridge status
amiko bridge routes               # available bridge routes
amiko bridge limits               # min/max limits per route
```

## Audio & Voice

All audio endpoints return binary audio streams. Use `amiko service call` for direct access:

```bash
# Sound effects ($0.05)
amiko service call POST /v1/sfx '{"text":"Thunder with heavy rain","duration_seconds":5}'

# Music generation ($0.10)
amiko service call POST /v1/music '{"prompt":"Lo-fi chill beat","music_length_ms":30000}'

# Composition plan ($0.02) — get JSON plan before generating
amiko service call POST /v1/music/plan '{"prompt":"Epic orchestral piece"}'

# Text-to-speech ($0.50/1K chars)
amiko service call POST /v1/tts/21m00Tcm4TlvDq8ikWAM '{"text":"Hello world"}'

# List all available services + prices
amiko service list
```

## Other Commands

```bash
amiko reputation [address]        # TARS score
amiko discover                    # MPP service info
amiko ping                        # health check
amiko config show                 # view config
amiko config set <key> <value>    # set config value
amiko update                      # update CLI to latest
```

## X Search

```bash
amiko search "AI agents"                 # search X (pays 1 AMIKO from Solana wallet)
amiko search "bitcoin" --token USDC      # pay with USDC instead
amiko search "news" --raw                # raw JSON output
```

Pays via Crossmint server-signed transfer from the agent's wallet. Tries Solana wallet first, falls back to EVM (Base/Tempo).

## Image Generation

```bash
amiko image "a sunset over mountains"                    # gpt-image-1 (default, base64)
amiko image "logo" --background transparent              # transparent background
amiko image "cat" --model dall-e-3                       # DALL-E 3 (returns URL)
amiko image "portrait" --size 1024x1792 --quality high   # portrait, high quality
amiko image "icon" --format webp                         # webp output
amiko image "banner" --raw                               # raw JSON (for piping)
```

Costs 5 AMIKO per image. Default model is `gpt-image-1` which returns base64 data (permanent, no expiring URLs).

## Agent Integration (OpenClaw)

Agents auto-authenticate via `.amiko.json` — no manual connect needed. The platform writes this file during twin init with wallets, billing config, and twin token.

```bash
# Agent environment — just works
amiko credits balance
amiko search "trending topics"
amiko credits topup 10000 --token AMIKO --yes
```

The CLI checks for `.amiko.json` in order:
1. `$OPENCLAW_WORKSPACE_DIR/.amiko.json`
2. `$OPENCLAW_HOME/.openclaw/workspace/.amiko.json`
3. `/data/.openclaw/workspace/.amiko.json`
4. Walking up from `cwd`

The `.amiko.json` provides: `AMIKO_TWIN_TOKEN` (auth), `agentWallets` (Solana + Base addresses), `billingBase`, and optionally `platformKey`.

**Important:** If `~/.amiko/config.json` exists with a stale `apiKey`, it takes priority over `.amiko.json` twin token. Remove stale keys or let the platform manage auth.

## Configuration

Config: `~/.amiko/config.json`

| Key | Default |
|-----|---------|
| `billingBase` | `https://billing.heyamiko.com` |
| `apiBase` | `https://mpp.amikomarkets.com` |
| `siteBase` | `https://platform.heyamiko.com` |

## Architecture

```
src/
├── index.ts              # entry point (Commander)
├── onboarding.ts         # first-run setup
├── commands/
│   ├── connect.ts        # connect (code, API key, browser)
│   ├── credits.ts        # credits balance + topup
│   ├── swap.ts           # Jupiter token swaps
│   ├── bridge.ts         # Across Protocol cross-chain bridge
│   ├── browse.ts         # marketplace browsing
│   ├── call.ts           # call agents
│   ├── wallet.ts         # wallet management (Crossmint + Tempo)
│   ├── creator.ts        # creator dashboard
│   ├── login.ts          # Privy browser login
│   ├── update.ts         # self-update
│   ├── config.ts         # config management
│   ├── discovery.ts      # MPP service info
│   ├── marketplace.ts    # activity, leaderboard, popular
│   └── reputation.ts     # TARS score
└── lib/
    ├── config.ts          # ~/.amiko/config.json
    ├── agent-config.ts    # .amiko.json reader + auto-auth
    ├── api.ts             # HTTP client for MPP + billing
    ├── format.ts          # table, usd, truncAddr helpers
    ├── mpp-topup.ts       # MPP SDK topup helper
    ├── across.ts          # Across Protocol bridge
    └── tempo.ts           # Tempo wallet CLI wrapper
```

Built with [Commander](https://github.com/tj/commander.js), [chalk](https://github.com/chalk/chalk), [ora](https://github.com/sindresorhus/ora), [@solana/mpp](https://github.com/solana-foundation/mpp-sdk), and [@crossmint/wallets-sdk](https://www.crossmint.com). Bundled with [Bun](https://bun.sh).

## License

MIT