Synopsis
cowboy session drives the on-chain CIP-8 Session actor (0x0C): a payer escrows CBY against a runner, the runner is paid by cumulative off-chain vouchers, and unspent deposit is refunded after a dispute window.
Write subcommands sign with the key found by key auto-discovery. Each signs with a 500,000 cycle / 100,000 cell limit and the protocol default access limit, prints the transaction hash, and submits via POST /submit. Without --json a write returns on acceptance; with --json it waits up to 90 seconds for the transaction to commit and reports it only once committed (transaction_failed if it commits unsuccessfully, receipt_pending if it does not commit in time).
Parent flags:
Subcommands
cowboy session models
List the models active inference runners serve, with how many runners serve each (* is a runner that serves any model). Counts only runners that run llm jobs, advertise the inference entitlement, and have a route-serving endpoint. Read-only; no private key.
Flags:
cowboy session open
Open a new session, escrowing max_amount from the payer: for a model the chain assigns a runner to (--model, the usual way), or, as an advanced option, against a runner you name (--runner). Exactly one of --model and --runner is required.
Behavior:
- Load the payer key and derive the payer address.
- With
--model: default--expires-atto the current height plus 2,592,000 blocks (30 days of 1-second blocks), default the session id to 32 random bytes, and submitSessionOpenAssigned; the chain assigns the runner when the transaction commits. - With
--runner: compute the session id as--session-idif given, otherwisekeccak256(payer || runner || nonce || expires_at)using the--noncevalue as passed (before auto-fetch), and submitSessionOpen. The runner must be registered and not the payer, but need not serve a model. - Both use asset CBY, the given
max_amount, and the price-advert digest (all zeros if omitted). - Print
session_id,payer, thenrunner(with--runner) ormodel, anyexcludeandsigner(with--model), thenmax_amountandexpires_at. With--json, wait for commit and report the session id, assigned runner, its endpoint, deposit, expiry, and transaction hash.
Example:
cowboy session voucher
Sign a voucher with the global --private-key and print it as JSON; nothing is sent. The output (or the voucher object of --json) is what settle --voucher accepts.
Flags:
cowboy session deposit
Top up an open session.
Flags:
cowboy session settle
Submit SessionSettle with a voucher the session’s signer signed elsewhere (--voucher), or sign one here with --signer-key.
Behavior:
- With
--voucher: parse the voucher object (inline JSON or@FILE, at most 64 KiB), check it matches--session-idif given, and sign the transaction with the global--private-key. - Otherwise: load the signer key (
--signer-key) and, if given, a separate submitter key (--private-key); the submitter defaults to the signer. Sign the voucher’s EIP-712 digest with the signer key over the Session actor domain. - Read the session and check the voucher recovers to the session’s signer (its payer, unless opened with
--signer) before anything is submitted. - Submit
SessionSettle { session_id, voucher }signed by the submitter. - Print
session_id,signer(voucher signer),submitter(tx signer), and the voucher’s nonce, cumulative amount, and expiry.
cowboy session close
Payer-initiated close; the session enters its dispute window.
Flags:
cowboy session finalize
Refund the unspent deposit after the dispute window expires.
Flags:
cowboy session get
Read on-chain session state by id. Read-only; no private key.
Behavior:
- Compute the session storage key and
GET /actors/<session actor>/storage/value?key=<key>. - A key the node does not hold fails with
session_not_found; a node without the route fails withrpc_failed; a native route session’s record fails withsession_unsupported. - Otherwise print
session_id,payer,signer,runner,deposit,spent,max_amount,opened_at_block,expires_at_block,last_voucher_nonce, andstatus(Open,Closing (closed_at=N),Disputed,Settled, orRefunded), followed by the runner’sendpointwhen it has one.
Edge Cases
- Amounts are in CBY wei (1 CBY = 10^9 wei), not CBY.
- With
--nonce 0the transaction nonce is fetched from the account; the derived session id foropen --runnerstill uses the literal0, so pass--session-idto control it explicitly. settlelets a different account submit the transaction than the one that signed the voucher; the voucher signature is always the session signer’s (the payer, or the sponsoropen --signernamed), and a voucher signed by any other key is refused before submission.getfails when the session is not on chain or the node does not serve actor storage reads.