httpx, with pydantic v2 for typed response models. Fully type-checked (py.typed). Requires Python 3.9+.
Installation
Configuration
Configuration fields
| Field | Type | Default | Description |
|---|---|---|---|
api_key | Optional[str] | None | Partner API key. Omit for anonymous tier. |
base_url | str | https://api.hypermid.io | API base URL |
timeout | float | 30.0 | Per-request timeout in seconds |
Hypermid() with no arguments uses all defaults — the recommended starting point.
Sync vs. async
Both clients have the exact same method surface. Choose based on your stack:await inside async with AsyncHypermid() as hm:.
Methods
Chains & tokens
Quote / Execute / Status
int or str. Token amounts are always strings in base units (wei-equivalent) to avoid precision loss.
Balances
get_balances auto-detects the address ecosystem (EVM, Solana, Bitcoin, NEAR, Sui, Tron) and returns priced holdings plus dust classification.
NEAR Intents deposits
For non-EVM destinations,execute returns a deposit address. After the user sends funds, poll status:
Webhooks
Fiat on-ramp (RampNow)
**kwargs and forward to the API directly, so any field the API supports works without an SDK upgrade.
SuperSwap inbound receiver
For SuperSwap V2 inbound deposits (PulseChain-side outputs):Error handling
| Exception | Raised when |
|---|---|
HypermidError | The API returned an error response (4xx/5xx) |
HypermidTimeoutError | A single request exceeded config.timeout |
HypermidNetworkError | Transport-level failure (DNS, connection reset, TLS, etc.) |
HypermidPollTimeoutError | A poll-until helper exceeded its overall deadline |
Exception directly — no shared HypermidBaseError for unrelated bases.
Types
Response models arepydantic v2 classes with full type hints. Import them from hypermid.types:
extra="allow") so a new API field never breaks consumers — your existing code keeps working when the API expands.
End-to-end example
A complete EVM swap from Ethereum to Arbitrum, anonymous tier:What’s not in this SDK (yet)
The Python SDK currently covers the core consumer surface: swap pipeline, balances, webhooks, on-ramp, inbound receiver. Some endpoints available in TypeScript / Go / Rust are not yet wrapped:get_connections,get_routes,get_tools,get_gas_pricessubmit_deposit(onlyget_deposit_statusis exposed today)record_swap_eventget_partner_info,get_partner_stats,get_partner_transactionslist_webhooks,delete_webhook- High-level
execute_swaplifecycle helper - Type guards (
is_lifi_route,is_near_intents_route, etc.)
httpx or requests. See the API Reference.
These are planned for the next minor release.