Skip to content

Commit f147bb6

Browse files
committed
docs: add X402 payment protocol section to README
1 parent 96c3b62 commit f147bb6

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ benefit from Linkup services to the full extent. 📝
1919
- 🔍 **Support all Linkup entrypoints and parameters.**
2020
-**Support synchronous and asynchronous calls.**
2121
- 🔒 **Handle authentication and request management.**
22+
- 💳 **Built-in x402 payment protocol support for on-chain payments.**
2223

2324
## 📦 Installation
2425

@@ -28,6 +29,12 @@ Simply install the Linkup Python SDK as any Python package, for instance using `
2829
pip install linkup-sdk
2930
```
3031

32+
To use the x402 payment protocol (on-chain payments via EVM), install the optional x402 extras:
33+
34+
```bash
35+
pip install linkup-sdk[x402]
36+
```
37+
3138
## 🛠️ Usage
3239

3340
### Setting Up Your Environment
@@ -203,6 +210,27 @@ Which prints:
203210
}
204211
```
205212

213+
#### 💳 x402 Payment Protocol
214+
215+
The SDK supports the [x402 payment protocol](https://www.x402.org/), allowing clients to
216+
automatically handle HTTP 402 responses by signing and retrying requests with on-chain payments.
217+
This can be used as an alternative to API key authentication.
218+
219+
```python
220+
from linkup import LinkupClient
221+
from linkup.x402 import create_x402_signer
222+
223+
signer = create_x402_signer(private_key="0x...")
224+
client = LinkupClient(x402_signer=signer)
225+
226+
result = client.search(
227+
query="What is x402?",
228+
depth="standard",
229+
output_type="sourcedAnswer",
230+
)
231+
print(result.answer)
232+
```
233+
206234
#### 📚 More Examples
207235

208236
See the `examples/` directory for more examples and documentation, for instance on how to use Linkup

0 commit comments

Comments
 (0)