Python SDK

pip install plumb-sdk

The Python SDK wraps every public gateway route in typed client methods. All request/response payloads are dataclasses.

Client

from plumb_sdk import Client

c = Client(
    base_url="https://api.plumbtech.xyz",
    session_token="sess_...",   # from SIWE login
    timeout=30.0,               # seconds
)

Environment variables are also respected: PLUMB_API_BASE, PLUMB_SESSION.

client.chat.completions.create(**kwargs)

OpenAI-compatible chat endpoint. Extra keyword extra_body={"plumb_memory": True} enables memory extraction on the turn.

Returns a ChatCompletion with .id, .choices[0].message.content, .usage, plus .receipt_id and .receipt_cost_micro surfaced from Plumb response headers.

client.receipts.get(id) -> Receipt

Fetches a receipt. Receipt has .id, .addr, .request_hash, .response_hash, .model_id, .prompt_tokens, .completion_tokens, .cost_micro, .ed25519_sig, .signer_key_id, .verification_mode, .created_at, .settled_onchain_at, .settlement_tx_hash.

client.receipts.list(limit=100) -> list[Receipt]

Most recent first, caller-scoped.

client.verify_receipt(receipt) -> bool

Re-hashes the canonical v1 payload and verifies the ed25519 signature against the published signer-key registry. Returns True on match.

client.deposits.list() -> list[Deposit]

On-chain PLMB deposits credited to the caller's address. Deposit has .tx_hash, .addr, .amount_micro, .block_number, .confirmed_at.

client.memsync

  • .list() -> list[Memory] — retrieved memories for the caller.
  • .profile() -> Profile — the composed profile JSON derived from memories.
  • .delete(memory_id) -> None — hard-delete one memory.

client.hub

  • .upload(bytes, *, name, framework="onnx") -> HubModel — raw binary upload, keccak256-hashed.
  • .register(model_hash) -> OnchainRegistration — registers (hash, uploader) on HubRegistry.
  • .get(model_hash) -> HubModel — metadata.

client.pipe

  • .upload_input(bytes) -> PipeInputRecord — upload input bytes for a future requestInference call.
  • .jobs() -> list[PipeJob] — caller-scoped pipe jobs.
  • .get_job(id) -> PipeJob — one job detail.

Errors

All 4xx errors raise PlumbAPIError with .status, .code, .message. Receipt verification failures raise ReceiptVerificationError.

Examples

Full e2e in apps/sdk-python/examples/ in the repo.