Skip to content

feat: native x402 in Python + TS SDKs (accountless + top-up modes)#137

Open
laithrw wants to merge 3 commits intomainfrom
x402-sdk
Open

feat: native x402 in Python + TS SDKs (accountless + top-up modes)#137
laithrw wants to merge 3 commits intomainfrom
x402-sdk

Conversation

@laithrw
Copy link
Copy Markdown
Member

@laithrw laithrw commented May 5, 2026

Summary by cubic

Add native x402 (USDC pay‑per‑request) to the Python and TypeScript SDKs with accountless and top‑up modes. Also suppresses unhandled rejection warnings when an x402‑wrapped fetch is never used, and documents the $5 default top‑up per payment (with $1 fallback).

  • New Features

    • TypeScript (v2/v3): x402PrivateKey and x402 options; lazy x402 helpers; top‑up when apiKey is set; new x402 base URLs; HttpClient supports custom or promised fetch and omits the API key header in accountless mode; suppress unhandled‑rejection if the client is instantiated but unused.
    • Python (v2/v3): AsyncBrowserUse supports x402_private_key and x402; sync clients disallow x402; automatic top‑up when api_key is set; new x402 base URLs; AsyncHttpClient uses an x402‑aware transport.
    • Docs: new x402 guide (default $5 top‑ups; $1 fallback) and updated Claude Code tutorial.
  • Migration

    • TypeScript: when using x402, install optional peers @x402/fetch, @x402/evm, and viem. Pass x402PrivateKey or a prebuilt x402; or set BROWSER_USE_X402_PRIVATE_KEY.
    • Python: install browser-use-sdk[x402] (Python 3.10+). Use AsyncBrowserUse; pass x402_private_key or x402, or set BROWSER_USE_X402_PRIVATE_KEY.
    • Top‑up mode: to credit an existing API key’s project, provide both the API key and x402 credentials.
    • x402 endpoints: default to https://x402.api.browser-use.com/api/v3 and /api/v2 when x402 is enabled.

Written for commit 4b3b22b. Summary will update on new commits.

@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 5, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
browser-use 🟢 Ready View Preview May 5, 2026, 3:22 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 15 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="browser-use-node/src/v3/client.ts">

<violation number="1" location="browser-use-node/src/v3/client.ts:64">
P2: The eagerly-started async IIFE can reject before any request awaits it, triggering an unhandled promise rejection in Node.js 15+ (default `--unhandled-rejections=throw`). Consider deferring execution to first use, or attaching a no-op `.catch()` and re-throwing on await.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

Comment thread browser-use-node/src/v3/client.ts
register_exact_evm_client(client, EthAccountSigner(Account.from_key(key)))
"""
try:
from eth_account import Account # pyright: ignore[reportMissingImports]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to ignore missing imports here? And check if they are imported in the first place?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants