Pay.sh is a Solana-based developer tool that transforms HTTP 402 (Payment Required) responses into wallet-approved API access by automatically detecting payment protocols, preparing stablecoin payments, requesting local wallet approval, and retrying requests with payment proof, enabling CLIs and AI agents to access paid APIs without managing API keys or private keys.
Inmersión profunda
Prerrequisito
- No hay datos disponibles.
Próximos pasos
- No hay datos disponibles.
Inmersión profunda
How AI Agents Can Pay for Things | Pay.sh tutorial and integrationsAñadido:
Pay is a new developer tool on Salana that turns HTTP 402 into a wallet approved API. It's a payment layer that lets CLIs and AI agents access paid APIs without juggling API keys. So when an API returns a 402 payment required, Pay detects the payment protocol, prepares a stable coin payment, asks for a local wallet approval, and then retries the request automatically. In this video, I'll show you the difference between a normal curl request that gets blocked and a pay powered request that completes successfully. Then I'll show the payment debugger to get a full challenge, payment, and response flow in real time.
And finally, I'll show how this works for developers who are building with paid APIs and agents using tools like Codeex orClot. So, let's get started.
So, we're just going to start with the installation and setup. Here you can see the GitHub repo for pay which I will link in the description of this video.
If we scroll down in the readme, you can see the installation section. We're going to use Brew. You can also build from source if you would prefer. And I'm just going to brew install pay. Once that's set up, I'm going to check the version to make sure it's installed correctly.
And we're good to go. So up next is just setting up pay. And when you do that, you can just follow the setup instructions here. So, do I want to install pay for my skills? I'm going to do that. So, now when I'm using Claude, it's going to know about pay and be able to use it when answering my questions or working with any codebase that I have.
And now the next question is, how should you sort your accounts? I'm going to use the Touch ID in my keychain. So, I'm just going to verify that. And then we're good to go.
Then next, it's going to prompt you to top up the wallet. So, this is the wallet that Pay is going to be using to make any payments needed. You can see here it says QR code unavailable. If I just expand it, it's going to show up. I just have my terminal shrunk a bit, but this gives you the QR code that you can scan from your mobile wallet and then send funds directly to this wallet that Pay is using. And that is going to allow it to make onchain payments. And once that's done, I already have my wallet funded, so I'm going to skip that.
Now, we're all set up and we can start actually using Pay. So, first I'm going to spin up a demo server so I can demo on local. And you can actually do this directly with the pay CLI.
So, I'll just call pay server demo and specify the bind. And this is now going to run our demo server. Now this server was set up so that all of the local endpoints here are payment gated. So let's see what endpoints are available and then we can test them out.
So let's use this first endpoint here that's returned which is for the usage report. And let's first test it out just running a curl command. So this is how you would normally call an API endpoint.
So, we're going to scroll up and you see this error here that says 402 payment required. So, this is what a normal client sees. The API is reachable, but the resource is gated. So, the server responds with a 402 payment required error. And that's the part that pay is actually designed to handle. So, let's test this out again using pay. And I'm going to call the same command, but we're going to wrap that in the pay CLI.
So if we have pay curl, and then the same local API we're going to be calling.
And here you can see the API was successfully called. It returned the usage report and a okay status. Now here I'm making the same request through pay and pay reads the payment challenge, builds the payment proof, signs it with the local wallet, and then retries the request. But from the user's perspective, it feels like you're just running a normal curl command, but the payment handshake actually happens automatically here.
Now, let's see what pay looks like in a UI with a debugger. So, it's a little bit easier to conceptually understand when we're looking at the UI and able to analyze the debugger. I'm going to open up that site here in my browser. And I'm just going to execute a payment gated API request one more time. Here I'm going to use this gated endpoint that is shown on the payments debugger UI. So, let me just copy this and then paste it in my terminal.
And now you can see what's happening in real time.
Okay. So you can see the resource was delivered. I'm going to expand my browser so you can see everything. We'll zoom in a bit. So this debugger, it's one of the best ways to understand what's actually happening behind the hood with pay. It groups the raw HTTP request into a single payment flow. So instead of staring at headers. So now I'm going to show basically the same thing but just all of these different ways to do it so you can see the full process from different perspectives. If I go back to this server that I'm running, I'm going to click onto this request and now you can see a UI that comes up with it and this is now pay but pay running in a UI with a clickable button. So, if I just click on the continuous Salana button, it will now execute my payment and return an okay status. So, here's multiple ways to have your payments be executed with the pay CLI. Now, I'm going to show one more way to use pay for payments, and that is directly with your cloud code. So, if I type in pay claude, it's now going to open up my cloud code and I can interact with cloud code and it's going to be using pay. So, let me ask it a question that's going to need an API request that does require a payment. So, we can use the Google API.
I can ask it what are the what is the best a restaurant in Philly for Italian food.
So here you can see it returned some response, but it says it can get an updated list with current hours, current reservations, and reviews using a live search via pay. And it's able to do a live search by calling the Google API endpoint, which is payment gated. So, it's going to be able to use pay to then make that payment for the API request and then make a live search directly in my cloud code terminal. So, let me say yes, do a live search with pay.
So, here you can see it's using the Google Places API. It costs1 for a text search. And now my wallet has not been funded yet on mainnet. Um for all of the other requests we were using local which does automatically fund your wallet with DevNet soul to be able to execute the request. And this is actually a mainet call. So it's now prompting me to top up my wallet. And it's giving me the wallet address that I need to send funds to and then telling me how to send those funds. So, if I update that with the funds, it's going to be able to execute a request for me.
So, now I went and funded my wallet and it has USDC on it now. So, I'm going to go one more time back into Cloud. So, if we do pay cloud, it's going to open my cloud code. And I'm going to ask one more time.
So here you can see it found the API request that was needed to search for the top Italian restaurants in Philadelphia with up-to-date live information. And that one call was $.001.
And it took the wallet that I just funded and made that payment. But before actually executing that payment, it came up on screen with a popup that I had to approve it and I had to use my Touch ID on my Mac to be able to approve that request. And once I approved the request, it made the request and then returned all of this information. So just a recap of everything we went over today. Pay is basically the missing payment layer for HTTP. Instead of every paid API needing its own account system, API keyflow, dashboard, and billing setup, the server can return a standard 402 challenge. So, Pay understands protocols like MPP and X42, pays with the supported stable coins on Salana, and then sends the proof back to the API. And the important part is that this works with tools developers already use.
So, you can wrap curl, claude, codeex or any agent workflow. and the API gets paid. The user stays in control and the agent doesn't need to hold private keys or API secrets.
Videos Relacionados
Free TON in 2026? How I Tested This Reddit TON Tool
SirenHead-z9y
2K views•2026-05-28
Are our DeFi tools becoming too easy to exploit?
saidotfun
228 views•2026-05-30
Solana Unchained ($UCHN) Explained: Solana’s Next Big Utility Project?
CryptoVlogOfficial
339 views•2026-05-30
🚨 Access Network App FREE Withdrawal to MetaMask?! Only 25M Supply 🔥
Airdrop26Alpha
459 views•2026-05-28
GDOR tokenization amid oil shock hedge
sam.dmitri
720 views•2026-05-28
⚠️ALGO Has a Very Bright Future! ✅ One #Crypto Everyone Should Own!
MetaShackle
184 views•2026-05-30
BingX EventX: Trade Sports, Crypto & Global Events With One Click
AidenCryptox
311 views•2026-05-31
XRP IS GOING TO VANISH! A SUPPLY SHOCK IS INEVITABLE! (THIS IS THE PROOF!)
NCash
2K views•2026-05-31











