x402 payments implementation in FastAPI & Pydantic using 1Shot API as a facilitator.
1shot-x402 is an early-stage Python project in the AI payments / x402 ecosystem, focused on 1shotapi, fastapi, pydantic-v2, x402. It currently has 1 GitHub stars and 0 forks, and sits alongside related tools like quantoracle, bde-score, x402-app-template, openlibx402, x402-sdk, agent-commerce-framework.
x402 is a payment standard proposed by Coinbase that enables API services to charge for access by piggybacking on top of the existing HTTP 402 status code. Specifically, x402 enables API customers, particularly AI agents, to pay for and gain access to premium API resources by cryptographically signing (see EIP-712) time-bound value transfers that are executed onchain by a fascilitator (e.g. 1Shot API).
There are 4 primary actors in the x402 scheme:

This demo repo focuses on FastAPI as the web server framework and leverages Pydantic for data validation of the x402 payload specifications.
Specifically, we show how FastAPI route dependencies can be used to implement x402 payments while being minimally invasive to your existing codebase.
Log into 1Shot API, create an API key and secret, and provision an Escrow Wallet on Base Sepolia. Use the Base Sepolia faucet to fund your 1Shot API Base Sepolia wallet so that it can execute transactions on the network.
Make a copy of the example.env file like this:
copy example.env docker-compose.env
Enter your 1Shot API key and secret into docker-compose.env for the ONESHOT_API_KEY and ONESHOT_API_SECRET variable. Also go to your organization details page and grab your Organization ID; put this in the ONESHOT_BUSINESS_ID variable
This example is setup to use ngrok so that your API endpoints are accessible to the internet from you local computer. Make a free account, and put your ngrok auth token in docker-compose.env in the NGROK_AUTHTOKEN variable.
You should also go to the Domains tab and create a free static url. Put this url (include https://) in the TUNNEL_BASE_URL variable in docker-compose.env.
Go to the Base Sepolia USDC faucet and send some USDC to your Metamask or Coinbase wallet.
You can start the x402 demo stack with docker like this:
docker compose --env-file docker-compose.env up -d
You can see requests made to your API endpoints fromt the ngrok agent dashboard

Now you can simulate paying for premium API route access by signing a payload for $0.05 (your Base Sepolia USDC you got in step 3).
Go to the premium endpoint of your ngrok tunnel /premium and your browser will load an example dApp UI that will allow you to connect your wallet.
63 deterministic quant computation tools for autonomous financial agents. Options, derivatives, risk, portfolio, statistics, crypto/DeFi, macro/FX, TVM. 1,000 free calls/day — no signup.
🏆 Open-source multi-factor stock scoring API (0-100) | US/HK/A-Share 74 stocks | Zero signup | shields.io badges | GitHub Action | EU AI Act compliant
Claude agent for use with the Mangrove Developer API & MCP Server.
An open-source library for AI-native x402 integrations in the Solana ecosystem. Built for Python and Node.js, distributed via PyPI and npm, with server implementations for FastAPI and Express.js. Accelerate.
x402 Payment Protocol SDKs - Dead simple micropayments for APIs and AI agents
Open-source marketplace where AI agents autonomously discover, negotiate, and purchase API services. x402 USDC payments, MCP bridge, reputation engine. MIT license.
The living ecosystem where AI agents complete tasks through workflow loops, improve through iterative execution, are evaluated by mentor agents or humans in the loop, and turn completed work into reusable work experience and data to improve future agents.
The living ecosystem where AI agents complete tasks through workflow loops, improve through iterative execution, are evaluated by mentor agents or humans in the loop, and turn completed work into reusable work experience and data to improve future agents.
Self-healing infrastructure for AI agent payments. 90.3% auto-recovery.
The first agentic payment network: policy-controlled, gasless, and real money-ready. OmniClaw CLI + Financial Policy Engine let autonomous agents pay and earn safely at machine speed.
The A2A x402 Extension brings cryptocurrency payments to the Agent-to-Agent (A2A) protocol, enabling agents to monetize their services through on-chain payments. This extension revives the spirit of HTTP 402 "Payment Required" for the decentralized agent ecosystem.
DePIN for Vintage Hardware — Proof-of-Antiquity blockchain where old machines outmine new ones. AI-powered hardware fingerprinting, 15+ CPU architectures, Solana bridge (wRTC). $0 VC.