Install
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..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 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 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.
Flags
| Flag | Required | Meaning |
|---|---|---|
--for | no | Machine EOA address. Presence switches to proxy mode; requires --machine-key. |
--machine-key | no | Path to a file containing the machine’s 0x-prefixed hex private key. |
--doc-url | yes | Documentation URL written to the machine DID. |
--data-api | yes | Raw data API URL written to the machine DID. |
--visibility | no | Data visibility: public (default), private, or onchain. |
--skip-funding | no | Skip steps 1–3 (balance check, 2FA enrollment, Gas Station funding). |
--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-runningpeaqos 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.
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.
--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.
| Flag | Required | Meaning |
|---|---|---|
--machine-id | yes | Positive integer machine ID. |
--type | yes | revenue or activity. |
--value | yes | Non-negative integer in the currency’s minor unit. |
--ts | yes | Unix seconds or ISO 8601 with timezone (Z or +hh:mm). Must be on or before block time. |
--currency | no | ISO 4217 code, 3-10 uppercase alphanumerics (^[A-Z0-9]{3,10}$). Default: USD for revenue, "" for activity. |
--trust | no | self (default), onchain, or hardware. |
--source-chain | no | same (default), peaq, or base. |
--source-tx | conditional | 32-byte hex tx hash. Required when --trust onchain. |
--raw-data | no | Path to a file; bytes are hashed and stored as the event data hash. |
--metadata | no | Path to a file; bytes are attached as on-chain metadata. Absent = empty bytes. |
peaqos qualify mcr
Fetch a machine’s credit rating from the MCR API. Wraps query_mcr.
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:
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):
peaqos show machine
Fetch a full machine profile: Machine ID, operator, DID attributes, MCR snapshot, recent events. Wraps query_machine.
peaqos show operator machines
List the machines registered under a proxy operator, with MCR per machine. Wraps query_operator_machines.
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).
| Subcommand | Purpose |
|---|---|
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. |
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 inload_client(). Override at any point with the root-level flags --orchestration-url / --orch-api-key.
| Env var | CLI override | Purpose |
|---|---|---|
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:
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.
--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:
- Calls
client.orchestration.createAgentPairingChallenge(machineId, params)for a server-issued challenge keyed toagentAddress,agentProvider,agentRole, and optionalagentDid. - The Machine Agent signs the returned challenge message () with the wallet key behind
agentAddress. Supply the signature via--agent-signature-file <path>. - Calls
client.orchestration.createAgentPairing(machineId, paramsWithProof)to persist the pairing and issue the session JWT.
--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:
client.orchestration.createAgentPairingSession(...) from your own tooling, signing a fresh challenge.
peaqos scale search
Agent-facing. Posts a market search and returns ranked service quotes. Hits POST /api/v1/market/search plus GET /api/v1/market/searches/:searchId.
--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 printsSearch 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 alignedSearch ID:line and broaden-your-search guidance. --jsonemits the fullMarketSearchenvelope. The rawMarketSearchRequestis constructed from typed SDK data classes, not raw dicts.
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_WALLETis 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 .
--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. Whennext_cursoris set, the CLI prints a copy-paste hint:Next page: peaqos scale order list --machine-id <id> [--limit N] --cursor <verbatim>. --jsonwithout--limit: auto-paginates all pages and emits a flat root-level JSON array.--jsonwith--limit: emits a single-page envelope{ "items": [...], "next_cursor": ... }.
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 code | Meaning |
|---|---|
0 | Success |
1 | User / validation error (bad flag, invalid DID, cap or rate limit) |
2 | Network, RPC, or on-chain error (connection failure, HTTP, revert) |
3 | Configuration 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.
