algorand-x402-client
Query Algorand Indexer with the official py-algorand-sdk / AlgoKit client. This package does not add a new query API. It only changes where the HTTP goes, and whether that request can pay.
| Backend | Default origin | Auth | Data |
|---|---|---|---|
.free |
Nodely / AlgoNode (AlgoKit getAlgoNodeConfig) |
none | full archival Indexer v2 |
.paid |
https://api.algorand-indexer.xyz |
x402 USDC (exact / AVM) |
private full Indexer (genesis → tip) |
You call the same methods as always (account_info(), search_transactions(),
pagination helpers). Under the hood the official IndexerClient is pointed at
one of two transports:
.free— send the request to Nodely. No payment headers, no USDC..paid— send the same path to the x402 gateway. If the gateway replies HTTP 402, the client signs a USDC payment (capped), retries once with a payment signature, and returns the Indexer JSON.
Both backends speak vanilla Indexer REST and retain history from genesis. They differ by billing and rate limits, not by how far back data goes. There is no silent “try Nodely, then pay” fallback — a free-tier 429 would otherwise spend USDC.
Install
Python 3.10+:
pip install algorand-x402-client
# or: uv add algorand-x402-client
Usage
import os
from algorand_x402_client import Payer, configure_logging, create_algorand_indexer, get_logger
configure_logging() # stderr + algorand-x402-client.log
logger = get_logger(__name__)
indexer_client = create_algorand_indexer(
"mainnet",
payer=Payer(mnemonic=os.environ["BUYER_MNEMONIC"]), # omit for free-only
)
# Nodely — never sends PAYMENT-SIGNATURE, never spends USDC
account = indexer_client.free.account_info("JRG3CUVOFK3YJK3QDD4IOWKMHHRCWVTEMUSYKDN7U73FQO5ZYTCC7CEBRQ")
# x402 gateway — HTTP 402 → sign USDC → retry (search tier is $0.0001)
paid = indexer_client.paid.account_info("JRG3CUVOFK3YJK3QDD4IOWKMHHRCWVTEMUSYKDN7U73FQO5ZYTCC7CEBRQ")
logger.info("gateway network=%s", indexer_client.gateway.health()["network"])
indexer_client.close()
indexer_client.free / indexer_client.paid are py-algorand-sdk IndexerClients.
indexer_client.algorand_free is AlgorandClient.from_clients with Nodely algod
- the free Indexer.
Payer must be opted into USDC: MainNet 31566704, TestNet 10458941. Default
max payment is 10_000 microUSDC ($0.01).
Environment: BUYER_MNEMONIC, X402_BASE_URL, X402_NETWORK, ALGORAND_X402_LOG_FILE.
How the HTTP layer is swapped
py-algorand-sdk’s IndexerClient has no session hook, so this library subclasses
it (SessionIndexerClient) and sends every call through a requests.Session.
- Free session — plain
requests, plus backoff on HTTP 429. - Paid session — the same session wrapped with x402-avm
wrapRequestsWithPayment. The wrapper owns the 402 → sign → retry loop. Suggested params for the payment group come from Nodely algod, not from the Indexer.
You still get official response types. Only the transport is ours.
Docs
- Repository: https://github.com/thecryptomie/algorand-x402-client
- Gateway health: https://api.algorand-indexer.xyz/health
- OpenAPI: https://api.algorand-indexer.xyz/openapi.json
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file algorand_x402_client-0.1.1.tar.gz.
File metadata
- Download URL: algorand_x402_client-0.1.1.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e7f313524d8f112850a790f8ca4c565ee2e167e2a735365a7cb6203b3ec581b
|
|
| MD5 |
7672b5bf5595fabc85f6d5afa06c3bbe
|
|
| BLAKE2b-256 |
33d6fd9c746031cdb83cfa7f667681d25f60a2e6e0dce1f2159327aac996298d
|
Provenance
The following attestation bundles were made for algorand_x402_client-0.1.1.tar.gz:
Publisher:
release.yml on thecryptomie/algorand-x402-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
algorand_x402_client-0.1.1.tar.gz -
Subject digest:
8e7f313524d8f112850a790f8ca4c565ee2e167e2a735365a7cb6203b3ec581b - Sigstore transparency entry: 2646349254
- Sigstore integration time:
-
Permalink:
thecryptomie/algorand-x402-client@f667d184b96ffa31d33bbb6400b4a0255fd0b9eb -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/thecryptomie
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f667d184b96ffa31d33bbb6400b4a0255fd0b9eb -
Trigger Event:
push
-
Statement type:
File details
Details for the file algorand_x402_client-0.1.1-py3-none-any.whl.
File metadata
- Download URL: algorand_x402_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75b840e7541ae75414554476cd418fafb52c7bff79362d5d04fb8304f87169e8
|
|
| MD5 |
941ea091428a54400900ca98c34fff7c
|
|
| BLAKE2b-256 |
9a995f0471aa16fa430cc5cbf349e388164e10ba578036db1a085d62b771be6e
|
Provenance
The following attestation bundles were made for algorand_x402_client-0.1.1-py3-none-any.whl:
Publisher:
release.yml on thecryptomie/algorand-x402-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
algorand_x402_client-0.1.1-py3-none-any.whl -
Subject digest:
75b840e7541ae75414554476cd418fafb52c7bff79362d5d04fb8304f87169e8 - Sigstore transparency entry: 2646349323
- Sigstore integration time:
-
Permalink:
thecryptomie/algorand-x402-client@f667d184b96ffa31d33bbb6400b4a0255fd0b9eb -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/thecryptomie
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@f667d184b96ffa31d33bbb6400b4a0255fd0b9eb -
Trigger Event:
push
-
Statement type: