Skip to main content
The peaqOS CLI wraps the into a terminal surface for the most common machine flows: registering a machine, submitting events, querying , managing fleets, and the full Scale loop — an , searching the catalogue, placing and confirming orders. It’s the same and orchestration path as the JS and Python SDKs, scripted.

Install

pip install peaq-os-cli
peaqos --version
Python 3.10+ required. Ships to PyPI as peaq-os-cli and exposes the peaqos command. Wraps the Python SDK: same on-chain path, scripted. peaqos --version prints both the CLI and the underlying peaq_os_sdk versions on a single line. Global flags -v / --verbose and -q / --quiet toggle DEBUG and ERROR-only logging respectively (mutually exclusive; logs go to stderr). --orchestration-url <url> and --orch-api-key <key> are global overrides for the corresponding env vars on any peaqos scale ... invocation.

Configure

The CLI reads the same environment variables as the SDKs. Full table on Install.
export PEAQOS_RPC_URL=https://peaq.api.onfinality.io/public
export PEAQOS_PRIVATE_KEY=0x...

# Defaults to http://127.0.0.1:8000 (self-hosted MCR).
# Set to the public peaq MCR for mainnet reads.
export PEAQOS_MCR_API_URL=https://mcr.peaq.xyz
Other are available. See Public RPC endpoints. Or scaffold a .env interactively with peaqos init.

Commands

peaqos init

Interactive wizard that scaffolds a .env with the required peaqOS variables. Prompts for network, source (paste, generate, or wallet), RPC URL, MCR API URL, URL, Event Registry address, and (optionally) PEAQOS_ORCHESTRATION_URL + PEAQOS_ORCH_API_KEY for Machine Markets. The orchestration key is masked in any echoed or logged output. The wallet path creates a new and writes PEAQOS_OWS_WALLET=<name> instead of PEAQOS_PRIVATE_KEY. Writes .env with 0o600 permissions and auto-runs whoami to verify.
peaqos init
peaqos init --force            # overwrite existing .env without prompt
peaqos init --non-interactive  # read all values from env vars

peaqos whoami

Read-only command that prints the , network, , RPC + MCR API URLs, and all peaqOS the CLI is configured with. Useful as a sanity check after init.
peaqos whoami

peaqos activate

Register a machine on peaq end-to-end: balance check, Gas Station funding (when 2FA is configured), register_machine, the , write . Idempotent: safe to re-run if a step fails. Mirrors the Activate flow.
# Self-managed: caller's own key drives every step
peaqos activate --doc-url "https://example.com/docs" --data-api "https://example.com/events"

# Proxy-managed: caller activates on behalf of a machine EOA that signs its own DID writes
peaqos activate --for 0xMachineAddress --machine-key ./machine.key --doc-url "https://example.com/docs" --data-api "https://example.com/events"

Flags

FlagRequiredMeaning
--fornoMachine EOA address. Presence switches to proxy mode; requires --machine-key.
--machine-keynoPath to a file containing the machine’s 0x-prefixed hex private key.
--doc-urlyesDocumentation URL written to the machine DID.
--data-apiyesRaw data API URL written to the machine DID.
--visibilitynoData visibility: public (default), private, or onchain.
--skip-fundingnoSkip steps 1–3 (balance check, 2FA enrollment, Gas Station funding).
Private keys must be supplied via file path (--machine-key). Inline key flags are intentionally unsupported: reading from a file keeps the key out of shell history and ps output. Proxy preconditions. Proxy mode requires the to already be registered on IdentityRegistry (i.e. have run peaqos activate in self mode first). If not, the command exits 2 before spending any .

Output streams

The final summary (Machine ID, Token ID, Machine DID; plus Machine Address and Operator DID in proxy mode) goes to stdout so it can be piped or captured. Progress lines ([1/6], [2/6], …) and per-step info/warning messages go to stderr.

Idempotent rerun

Every mutating step does a read-before-write precheck. Re-running peaqos activate against state that’s already complete submits no and exits 0. A TOCTOU (AlreadyRegistered / AlreadyExists) is recovered as a skip rather than surfaced as a network error.

peaqos.log

Every step appends a JSONL entry to ./peaqos.log (0o600) in the working directory: a resume marker for partial failures and the audit trail.
{"address":"0xDC5b...","machine_id":42,"mode":"self","status":"confirmed","step":"register","ts":"2026-04-23T15:00:18.482917+00:00"}
{"machine_id":42,"recipient":"0xDC5b...","status":"confirmed","step":"mint_nft","token_id":11,"tx_hash":"0xminttx...","ts":"..."}
{"machine_did_tx_count":6,"machine_id":42,"mode":"self","status":"confirmed","step":"machine_did","token_id":11,"tx_hash":"0xdidtx...","ts":"..."}
Keys are alphabetically sorted on disk (json.dumps(..., sort_keys=True)); ts is the UTC datetime.isoformat() (+00:00 suffix, microseconds included) and sits where the alphabetic order puts it on each line (last for most rows). status is one of pending / skipped / failed / confirmed. On rerun, the same rows reappear as "status":"skipped" and, for DID writes, with "recovered_from":"AttributeAlreadyOnChain". Fund-step retries with the same request_id carry "resumed_from":"pending" on the new pending row instead.

peaqos qualify event

Submit a revenue or activity event to the EventRegistry. Wraps submit_event. See the Submit events guide for and patterns.
# HK$1.23 (123 cents) revenue event
peaqos qualify event \
  --machine-id 42 \
  --type revenue \
  --value 123 \
  --ts 2026-04-23T12:00:00Z \
  --trust self \
  --source-chain peaq
--value is an ISO 4217 minor-unit integer: cents for USD/HKD, whole units for JPY/KRW/VND. HK$1.23 → --value 123, ¥100 → --value 100. The CLI defaults --currency to USD for revenue events and to "" for activity events; pass --currency explicitly to override. The MCR API converts the value to USD using FX at the event timestamp.
FlagRequiredMeaning
--machine-idyesPositive integer machine ID.
--typeyesrevenue or activity.
--valueyesNon-negative integer in the currency’s minor unit.
--tsyesUnix seconds or ISO 8601 with timezone (Z or +hh:mm). Must be on or before block time.
--currencynoISO 4217 code, 3-10 uppercase alphanumerics (^[A-Z0-9]{3,10}$). Default: USD for revenue, "" for activity.
--trustnoself (default), onchain, or hardware.
--source-chainnosame (default), peaq, or base.
--source-txconditional32-byte hex tx hash. Required when --trust onchain.
--raw-datanoPath to a file; bytes are hashed and stored as the event data hash.
--metadatanoPath to a file; bytes are attached as on-chain metadata. Absent = empty bytes.
Human output on success:
Event submitted.
  Machine ID:  42
  Type:        revenue
  Value:       123
  Trust:       self-reported
  Tx:          0x3f4a8c1e2d9b7f05a6c3e8d1f4b2a7c9e0d5f3b1a8e2c6d9f7b4a1e3c5d8f2b4
  Data Hash:   0xa1b2c3d4e5f67890a1b2c3d4e5f67890a1b2c3d4e5f67890a1b2c3d4e5f67890

peaqos qualify mcr

Fetch a machine’s credit rating from the MCR API. Wraps query_mcr.
peaqos qualify mcr did:peaq:0x9a5F1E244c15e491Ae571c5bF77fDD836ddc37C5
peaqos qualify mcr did:peaq:0x9a5F... --json
The must match did:peaq:0x plus 40 hex characters. --json emits the raw SDK response on stdout with no banner or prose: useful for jq and scripting. Human output:
MCR for did:peaq:0x9a5F1E244c15e491Ae571c5bF77fDD836ddc37C5

  Rating:          A
  Score:           82 / 100
  Bond Status:     bonded

  Events:
    Total:         150
    Revenue:       120
    Activity:      30

  30-Day Revenue:  up
  Last Updated:    2026-04-20T14:30:00Z
  FX Degraded:     no
revenue_trend is one of up, stable, down, or insufficient (returned when there isn’t enough revenue history to compute a trend). FX Degraded: reflects the top-level mcr_degraded field — yes when one or more scored events used a stale or unavailable FX snapshot, no otherwise. --json output (raw SDK MCRResponse):
{
  "did": "did:peaq:0x9a5F1E244c15e491Ae571c5bF77fDD836ddc37C5",
  "machine_id": 42,
  "mcr_score": 82,
  "mcr": "A",
  "mcr_degraded": false,
  "bond_status": "bonded",
  "negative_flag": false,
  "event_count": 150,
  "revenue_event_count": 120,
  "activity_event_count": 30,
  "revenue_trend": "up",
  "total_revenue": 1542075,
  "average_revenue_per_event": 12851,
  "last_updated": 1745152200
}

peaqos show machine

Fetch a full machine profile: Machine ID, operator, DID attributes, MCR snapshot, recent events. Wraps query_machine.
peaqos show machine did:peaq:0xabc1230000000000000000000000000000000001
peaqos show machine did:peaq:0xabc... --json

peaqos show operator machines

List the machines registered under a proxy operator, with MCR per machine. Wraps query_operator_machines.
peaqos show operator machines did:peaq:0xProxyAddress
peaqos show operator machines did:peaq:0xProxyAddress --json

peaqos wallet

Manage OWS-format wallets in the local encrypted vault at ~/.ows/wallets/. Requires the [ows] extra: pip install 'peaq-os-cli[ows]' (quote the bracketed extra so zsh does not glob it). The vault is read from OWS_PASSPHRASE when set, otherwise prompted interactively. Subcommands wrap the SDK static helpers documented on Wallets (OWS).
SubcommandPurpose
peaqos wallet create <name> [--words 12|24] [--json]Generate a new BIP-39 mnemonic and derive accounts for every supported chain. The mnemonic is not displayed; back up via wallet export.
peaqos wallet import <name> --mnemonic [--index N] [--json]Import from an existing BIP-39 mnemonic (hidden prompt). --index selects the derivation index (default 0).
peaqos wallet import <name> --private-key-file <path> [--json]Import a raw EVM private key from file. peaq-only; other chains synthesize on read where possible.
peaqos wallet list [--json]Compact table of all wallets: Name, ID, peaq Address, Key Type, Created.
peaqos wallet show <name-or-id> [--json]Wallet metadata plus the full multi-chain address table.
peaqos wallet export <name-or-id>Reveal the recovery phrase / private key. Requires interactive confirmation. Secret prints to stdout; warning prints to stderr.
peaqos wallet delete <name-or-id>Securely delete a wallet (file overwritten with random bytes before unlink). Requires confirmation.
peaqos wallet use <name-or-id>Set the active wallet. Writes PEAQOS_OWS_WALLET=<name> into .env in the current directory. Subsequent commands that call load_client() will sign with this wallet.
When PEAQOS_OWS_WALLET is set, load_client() resolves the wallet from the vault using OWS_PASSPHRASE and skips PEAQOS_PRIVATE_KEY entirely. If both are set, the wallet wins.

peaqos scale

Machine Market orchestration commands. Pair an AI agent to an activated machine, search the curated catalogue, and drive the full purchase loop. The peaqos scale surface (CLI v0.0.4+): agent pair, machine onboard (plus machine status and machine list), search, and the scale order family — place (dispatched from a service UUID), status, list with cursor pagination, received, dispute.

Setup

Two new env vars, both optional in load_client(). Override at any point with the root-level flags --orchestration-url / --orch-api-key.
Env varCLI overridePurpose
PEAQOS_ORCHESTRATION_URL--orchestration-url <url>Machine Markets API base URL
PEAQOS_ORCH_API_KEY--orch-api-key <key>Platform API key (x-api-key header)
peaqos init prompts for both during the wizard and writes them as active .env lines (not commented placeholders). The orchestration key is masked in any echoed or logged output:
# Machine Market orchestration
PEAQOS_ORCHESTRATION_URL=https://orchestration.peaq.xyz
PEAQOS_ORCH_API_KEY=<masked>
peaqos init --non-interactive reads both from existing env vars. The pairing token returned by agent pair is the credential for agent-side commands. Save it once to a single-line file with chmod 600 and reference it via --pairing-token-file.

peaqos scale machine onboard

Operator-facing. Walks a machine through the four-step orchestration onboard: request an identity , with the DID controller key, register the machine with proof attached, then activate (unless --skip-activate). Hits POST /api/v1/machine-identity/challenges and POST /api/v1/machines.
peaqos scale machine onboard \
  --identity-ref did:peaq:0xMachineWallet \
  --display-name "rover-014" \
  --owner-id op_xyz \
  --machine-type qvac \
  --runtime-profile machine-runtime-agent
Required: --identity-ref, --display-name, --owner-id, --machine-type, --runtime-profile. Optional: --capabilities (CSV), --skill-keys (CSV), --labels (KEY=VALUE,...), --identity-signature-file, --identity-key-file, --skip-activate, --yes, --json. Supply exactly one of the two signing inputs: --identity-signature-file if you have already signed the challenge externally (one-line hex signature), or --identity-key-file if you want the CLI to sign in-process with the DID controller’s private key. Either is enough; supplying both is rejected. Exit codes: 0 happy path, 1 input error, 2 server / proof error (MACHINE_IDENTITY_EXISTS, MACHINE_IDENTITY_PROOF_INVALID, PEAQOS_IDENTITY_UNAVAILABLE).

peaqos scale agent pair

Operator-facing. Pairs an AI agent to a machine via a three-step challenge-sign flow. Returns a one-time signed-JWT pairingToken. Internally the command:
  1. Calls client.orchestration.createAgentPairingChallenge(machineId, params) for a server-issued challenge keyed to agentAddress, agentProvider, agentRole, and optional agentDid.
  2. The Machine Agent signs the returned challenge message () with the wallet key behind agentAddress. Supply the signature via --agent-signature-file <path>.
  3. Calls client.orchestration.createAgentPairing(machineId, paramsWithProof) to persist the pairing and issue the session JWT.
peaqos scale agent pair \
  --machine-id mach_61f043950cf1 \
  --agent-address 0xagent...0101 \
  --agent-did did:pkh:eip155:1:0xagent...0101 \
  --agent-provider teneo \
  --agent-role machine-market-buyer \
  --agent-signature-file ~/.peaqos/agent-challenge.sig \
  --per-tx-limit 5 --daily-limit 20 --currency USD \
  --allowed-skills agentic-market-claude-inference,pay-sh-gemini \
  --allowed-service-ids svc_abc \
  --denied-service-ids svc_xyz
Required: --machine-id, --agent-address, --agent-provider, --agent-role. Optional: --agent-did, --agent-signature-file (path to pre-signed EIP-191 challenge signature; required with --json, otherwise the CLI prompts interactively), --description, --per-tx-limit, --daily-limit, --currency, --allowed-skills (CSV), --denied-skills (CSV), --allowed-service-ids (CSV), --denied-service-ids (CSV), -y/--yes to skip the confirmation prompt, --json for raw JSON (implies --yes). Preconditions: PEAQOS_ORCH_API_KEY set. Machine already active in peaqOS or the server returns MACHINE_NOT_ACTIVATED and the CLI exits 2. Output adds Agent DID, Session ID, Session Expires, and Verification lines to the existing pairing summary. The token prints exactly once on stdout, never written to peaqos.log or --verbose output. Pipe to a file:
peaqos scale agent pair ... --json | jq -r .pairing_token > ~/.peaqos/agent.token
chmod 600 ~/.peaqos/agent.token
Session tokens expire (default 1 hour). Rotate directly via client.orchestration.createAgentPairingSession(...) from your own tooling, signing a fresh challenge. Agent-facing. Posts a market search and returns ranked service quotes. Hits POST /api/v1/market/search plus GET /api/v1/market/searches/:searchId.
peaqos scale search \
  --machine-id mach_1 \
  --service-type oracle.price-feed \
  --pairing-token-file ~/.peaqos/agent.token \
  --budget-amount 1 --budget-currency USD \
  --native-only
Required: --machine-id, --service-type, --pairing-token-file. Optional: --agent-pairing-id, --operation, --capabilities (CSV), --region, --max-results, --budget-amount, --budget-max, --budget-currency, --native-only, --allow-handoff, --provider-credentials (path to JSON), --json. Preconditions: machine active with verified identityRef, active agent pairing, pairing token in the token file. Provider credential file contents never appear on stdout, stderr, or in log output. Output:
  • Human mode: ranked quote table with columns Service ID, Quote ID, Operation, Provider, Score, Execution, Integration. Footer prints Search ID: msearch_... plus a concrete next-step hint: peaqos scale order <service-id> --search-id <search-id> --quote-id <quote-id>.
  • Empty results print No matching services found. with the same aligned Search ID: line and broaden-your-search guidance.
  • --json emits the full MarketSearch envelope. The raw MarketSearchRequest is constructed from typed SDK data classes, not raw dicts.
The order group is dynamic-dispatch. Any first token that is not status, list, received, or dispute is interpreted as a service UUID and routed to the placement flow. peaqos scale order foo-bar reads as “place an order for service foo-bar.”

peaqos scale order <service-uuid>

Agent-facing. End-to-end purchase. Hits the POST /market/orders + payment intent + execute flow. Three payment paths chosen from the MarketPayment returned at order create:
  • No payment — create → execute (2 steps).
  • Wallet payment — create → intent → transfer → proof → execute (5 steps). If PEAQOS_OWS_WALLET is set the CLI auto-signs the ERC-20 transfer via OWS; otherwise it prompts for a pasted tx hash (or use --payment-tx-hash).
  • Escrow / handoff — same five steps with the .
Required: --machine-id, --agent-pairing-id, --pairing-token-file. Optional: --search-id, --quote-id, --operation, --budget-amount, --budget-currency, --input <path> (JSON object file — there is no @file shorthand), --provider-credentials <path> (JSON file with provider creds; never logged), --payment-tx-hash, --payment-chain (CAIP-2 alias: base, peaq, agung, ethereum/eth, polygon, arbitrum, optimism, bsc, solana), --payment-token, --skip-payment, -y/--yes, --json. PEAQOS_RPC_URL overrides the built-in payment RPC list (peaq uses public wss-async by default). Error codes: QUOTE_EXPIRED, EXECUTION_UNSUPPORTED, PAYMENT_REQUIRED, PAYMENT_RPC_ERROR, PAYMENT_TX_FAILED, PAYMENT_TRANSFER_NOT_FOUND, ORDER_CLOSED, ORDER_NOT_DELIVERED, MACHINE_NOT_FOUND. --json does not silence progress. Progress prints to stderr; the JSON envelope goes to stdout. Global --quiet suppresses stderr.

peaqos scale order status <order-id>

Returns current state of the purchase. Read-only platform auth. Hits GET /market/orders/:orderId plus the payment lookup. Optional: --json for the { order, payment } envelope. Missing payment record (NOT_FOUND) is not an error — payment is null in the JSON envelope. Missing order ID exits 1.

peaqos scale order list --machine-id <id>

Lists orders for a machine. Hits GET /market/orders?machineId=.... Required: --machine-id. Optional: --limit <int> (1-500; outside range exits 1), --cursor <opaque> (from a prior next_cursor; never logged), --json. Output behaviour:
  • Human mode: one page, N order(s) shown. footer. When next_cursor is set, the CLI prints a copy-paste hint: Next page: peaqos scale order list --machine-id <id> [--limit N] --cursor <verbatim>.
  • --json without --limit: auto-paginates all pages and emits a flat root-level JSON array.
  • --json with --limit: emits a single-page envelope { "items": [...], "next_cursor": ... }.
The CLI surfaces next_cursor (snake_case) on stdout; the wire field is nextCursor.

peaqos scale order received <order-id>

Confirms delivery and releases escrow. Requires --pairing-token-file. Hits POST /market/orders/:orderId/confirm. Optional: --json. Status moves to confirmed, payment to release_pending. Error codes: ORDER_NOT_DELIVERED, ORDER_CLOSED, AGENT_AUTH_INVALID. Missing order ID or token file exits 1.

peaqos scale order dispute <order-id>

Raises a dispute. Requires --reason and --pairing-token-file. Hits POST /market/orders/:orderId/dispute. Optional: --evidence <path> (JSON object file), -y/--yes to skip the Raise dispute? [y/N] prompt, --json (also skips the prompt). Status moves to disputed, payment to frozen. Error codes: ORDER_CLOSED, AGENT_AUTH_INVALID. Missing order ID, reason, or token file exits 1.

Exit codes

Every subcommand funnels SDK and network exceptions through a single error handler that raises with a stable exit code.
Exit codeMeaning
0Success
1User / validation error (bad flag, invalid DID, cap or rate limit)
2Network, RPC, or on-chain error (connection failure, HTTP, revert)
3Configuration error (missing env var, invalid private key file)

See also

peaqOS AI

The peaqOS agent skill that drives these CLI flows from any AI agent.

SDK reference

The TypeScript / Python API the CLI wraps.

API reference

The MCR API that get-mcr, get machine, and operator machines hit.