Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

bezant

Typed async access to the Interactive Brokers Client Portal Web API — Rust-first, with HTTP / CLI / MCP / TypeScript surfaces auto-generated from the same vendored OpenAPI spec.

crates.io docs.rs CI License: MIT OR Apache-2.0

Bezant turns IBKR’s 154-endpoint CPAPI into five ergonomic surfaces that all ship from the same vendored OpenAPI 3.1 spec:

Crate / packageInstallWhat it’s for
bezant-corecargo add bezant-coreTyped async Rust client. Keepalive, WebSocket streaming, pagination, symbol cache, 11 typed error variants, is_retryable() predicate, Subscription cancel handles
bezant-servercargo install bezant-serveraxum HTTP sidecar exposing CPAPI as plain REST+JSON for any language. Production-hardened: CF Access cookie filtering, edge-cookie strip, request-ID propagation, graceful shutdown, concurrency cap
bezant-clicargo install bezant-clibezant accounts, bezant positions DU123, bezant quote AAPL, bezant orders DU123--output {json,table}
bezant-mcpcargo install bezant-mcpModel Context Protocol server — Claude / Cursor / Continue can call IBKR tools
TypeScript clientnpm install from repoAuto-generated TS client for Node / Deno / browser

All five drive off the same vendored IBKR OpenAPI spec. Re-run ./scripts/codegen.sh when IBKR ships a new revision and every surface updates together — verified by 14 normaliser-invariant tests + a CI drift check.

What’s special about it

  • Production-grade IBKR deploy story. Out of the box, every cloud IBKR API client hits the same wall: api.ibkr.com (Akamai-fronted) rejects datacenter egress IPs. bezant ships a documented Cloudflare Zero Trust + residential-Pi recipe that bypasses it without code changes — same image runs on Railway or a Pi at home with no fork.
  • Single-tenant proxy by design. bezant-server is honest about its trust model: one shared cookie jar, one IBKR account. No surprising fan-out semantics, no opaque session sharing.
  • Edge-aware cookie handling. Drops CF_Authorization, CF_AppSession, AWS ALB OIDC, OAuth2 Proxy, Vercel JWT, Pomerium cookies before they reach IBKR — Akamai 401s on unrecognised cookies and we don’t want your bot to inherit that surprise.
  • Per-request observability. Every typed handler is #[tracing::instrument]’d, every request gets a UUID x-request-id echoed in the response, every mapped 4xx/5xx logs at the boundary with the typed error variant.
  • Diagnostic probe. /debug/probe (token-gated) walks auth_status → ssodh_init → tickle → accounts and pins the first diverging step in a top-level verdict. Built specifically to discriminate “proxy regression” vs “upstream IBKR rejection” so you don’t waste hours debugging code that’s working.

Where to go next

GoalPage
Get something running locallyQuickstart
Understand the layered designArchitecture overview
Deploy to productionCloudflare Zero Trust + Pi
Use the Rust crateRust crate
Use the HTTP sidecar from non-RustHTTP sidecar
Use the CLICommand-line
Wire up an MCP clientMCP server
Refresh the spec / regen clientsCodegen pipeline
ContributeContributing

Status

Alpha — v0.3. Production-deployed against IBKR live + paper accounts; the public API surface will continue to evolve until v1.0. See the ROADMAP for what’s shipped and what’s next.

Not affiliated with Interactive Brokers

Bezant is an independent open-source project. Trading involves substantial risk; this software is provided without warranty. See the license.