For the complete documentation index, see llms.txt. This page is also available as Markdown.

CLI

A command-line tool for sending requests, managing your escrow balance, and inspecting on-chain state.

Install

pip install spacerouter

The Python package ships with the spacerouter command. Verify it's on your PATH:

spacerouter --version

Environment

Most commands read defaults from these environment variables:

Variable
Used by

SR_GATEWAY_URL

request commands

SR_GATEWAY_MANAGEMENT_URL

request commands (challenge endpoint)

SR_ESCROW_CHAIN_RPC

escrow, receipts

SR_ESCROW_CONTRACT_ADDRESS

escrow, receipts

SR_ESCROW_PRIVATE_KEY

escrow write commands, request --pay

request — send proxy requests

spacerouter request get https://httpbin.org/ip --pay --region US --ip-type residential

spacerouter request post https://api.example.com/v1/items --pay \
    -H "Content-Type: application/json" \
    --data '{"name":"widget"}'

Sub-commands: get, post, put, patch, delete, head.

Common flags

Flag
Purpose

--pay

Sign the request with the SPACE-payment flow (required for paid requests).

--auto-settle

After --pay, sign and submit the parked Leg 1 receipt in the same step.

--gateway-url URL

Gateway endpoint (overrides SR_GATEWAY_URL).

--region XX

2-letter ISO country code.

--ip-type TYPE

residential, mobile, business, hosting.

-H, --header

Add a request header (repeat for multiple).

-d, --data

Request body (string, file, or @filename).

--timeout SEC

Request timeout in seconds.

--output FORMAT

json (default) or raw.

--follow-redirects

Follow HTTP redirects.

escrow — manage your on-chain balance

Read commands

Example output for balance:

Write commands (need --private-key or SR_ESCROW_PRIVATE_KEY)

All amounts are in wei. 1 SPACE = 10¹⁸ wei. The 5-day withdrawal delay is enforced by the contract — see Pay with SPACE.

receipts — inspect on-chain receipt state

Use sync after a session to make sure the gateway can claim its bandwidth fees on-chain. is-settled lets you double-check that a specific request was claimed.

Examples

Top up and use SPACE for a session

Last updated

Was this helpful?