Skip to main content
The SDK does not ask you to pick a credential mode. It derives one from what you pass to the constructor: Passing both is legal — the SDK uses the key for authentication and the signer for transaction signing — but it takes brickken-relayed off the table, because a relayed send must be paid with x402.

What each credential reaches

Brickken treats the two credentials as alternatives, not layers: when x-api-key is present the API skips the x402 path entirely, so no payment is taken.

Combinations the SDK refuses locally

These throw before any request leaves your process, with the fix named in the message.
Credential rules that only bind at send time are checked only when you pass execute: true. A free prepare is never rejected for a credential it does not yet need.

Prepare without a credential

An x402-eligible agentic method — everything under /x402/* — prepares with no credential at all. A Dapp method does not: the backend requires a key for any non-x402 method at prepare as well as at send, so the SDK refuses the call rather than spending a round trip on it.

Environment variables

Brickken.fromEnv reads the same variables the CLI and MCP server already use, including the BKN_* aliases:
BRICKKEN_PRIVATE_KEY is deliberately not read. Turning a key into a signer is an explicit choice, never an implicit one:

Key handling

Your private key never leaves your process. It signs the x402 payment authorization, client-signed and client-broadcast transactions, and RAMS typed data, all locally. The SDK never puts it in a request body or a header.
Never paste production API keys or private keys into shared terminals, tickets, chat logs, or committed .env files. Use your platform’s secret store or process environment.
For institutional custody, implement the Signer interface against your KMS or MPC provider instead of holding a raw key.