Fiber-pay: an ai-friendly CLI for fiber-network

Happy to share that the Fiber-pay v0.1.1 just got released. In this version, I am experimenting some fun ideas:

I am packing a simple command into the fiber-pay so you can expose a local AI agent (via acpx) as a paid HTTP service.

Wait, what does that mean? So you propabbly have installed agents like claude code, codex, opencode and openclaw etc. Ever wondering allow those little agents earn money for you while siting in your computers? the fiber-pay agent serve commands open an access to your agents from your computer so other users can call to them and get response by paying you a little CKB per request using fiber network in a L402 styling!

Here is a real exmaple that I ran on my computers:

firstly, I start a paid HTTP service with my default fiber node for my codex agent using one simple command from fiber-pay:

retric@bear:~$ fiber-pay agent serve --agent codex --approve-all --root-key d8055d40611acbe70bedac3019a8e9f1845784c4903b9e8714ba2f9c0b71154c
Agent service started
  Listen:     http://127.0.0.1:8402
  Agent:      codex
  Price:      0.1 CKB per request
  Expiry:     3600s
  Timeout:    300s per agent call
  Currency:   Fibt
  Fiber RPC:  http://127.0.0.1:8227

Endpoint:
  POST http://127.0.0.1:8402/  {"prompt": "your question"}

Press Ctrl+C to stop.

Secondly, I called the above endpoint from another fiber node named user to get response from the codex agent behind the paywall. In this case, I am sending codex a simple prompt hello and It immediatly get 402 status code and pays the invoice and then automatically requests again for the response.

fiber-pay agent call --prompt "hello" http://localhost:8402 --profile user
Calling agent at http://localhost:8402/...
Payment required. Paying invoice via Fiber...
Payment sent (hash: 0xafc71d251d104a83ac02e9a382327d151cd6e2c85b555a7a65a40629acd457cf). Waiting for confirmation...
Payment confirmed. Retrying request with L402 token...

The server then checks the payment and the asking codex to process my request prompt and send the response to me from server side:

fiber-pay agent serve --agent codex --approve-all --root-key d8055d40611acbe70bedac3019a8e9f1845784c4903b9e8714ba2f9c0b71154c
Agent service started
  Listen:     http://127.0.0.1:8402
  Agent:      codex
  Price:      0.1 CKB per request
  Expiry:     3600s
  Timeout:    300s per agent call
  Currency:   Fibt
  Fiber RPC:  http://127.0.0.1:8227

Endpoint:
  POST http://127.0.0.1:8402/  {"prompt": "your question"}

Press Ctrl+C to stop.
[REQ 1] POST / from 127.0.0.1 (auth=none)
[REQ 1] challenge-issued status=402 duration=28ms
[REQ 2] POST / from 127.0.0.1 (auth=present)
[REQ 2] payment accepted, invoking agent=codex promptChars=5
[REQ 2] agent completed duration=21112ms
[REQ 2] completed status=200 duration=21117ms l402=payment-verified:0xafc71d251d10...

And I get the correct response from codex agent in the client side:

fiber-pay agent call --prompt "hello" http://localhost:8402 --profile user
Calling agent at http://localhost:8402/...
Payment required. Paying invoice via Fiber...
Payment sent (hash: 0xafc71d251d104a83ac02e9a382327d151cd6e2c85b555a7a65a40629acd457cf). Waiting for confirmation...
Payment confirmed. Retrying request with L402 token...
Agent call succeeded
  Agent:         codex
  Duration:      21112ms
  Payment:       required
  Payment hash:  0xafc71d251d104a83ac02e9a382327d151cd6e2c85b555a7a65a40629acd457cf

Agent response:
Hi. What can I help you with?

It works! Hopes you enjoy this kind of experiment like me!

But remember that opening your agent to the world can lead to a danger situation where other people can control your computers via injecting prompts to your agent.

Despite all rof this, I think the real execitement is that if some sort of security is implemented correctly, we can build an agent network on top of fiber network where each agent can call other agents with built-in payments. It will be a new cordination layer for machines.

7 Likes