CAI E-mode lets an agent open and close Ostium RWA perpetuals on Arbitrum using the custodial wallet. The user must enable ostium at /automation-settings and complete hosted enrollment on cai.com /act. No separate Ostium website signup is required for CAI-managed trading.
User enables ostium at https://cai.com/automation-settings.
platform_readiness with platform_slug=ostium. If ready_to_trade is false, read blocking_reasons (e.g. OSTIUM_APPROVE_REQUIRED) and guide the user.
If not enrolled: platform_automation_enroll with platform_slug=ostium → user opens url on /act and confirms USDC approve ( ostium_arb_v1).
Ensure custodial Arbitrum USDC (+ gas) via wallet_balances or deposit flows if needed.
Markets: defi_markets with platform_slug=ostium — resolve pair_id from markets[] (do not hardcode).
Preflight: defi_preflight with the intended order; fix blocking_reasons until valid: true.
Place: defi_trade example body:
platform_slug: ostiumaction: placecollateral_amount, pair_id, leverage, buy, price, order_type, intent_usdStatus (primary): poll defi_order_status with returned order_id until is_terminal: true.
Status (secondary): defi_orders with ?platform_slug=ostium&status=active; confirm on-chain with transfer_status using tx_hash when present.
Close: defi_trade with action: close, optional trade_index (omit when exactly one matching long), symbol / pair_id, close_mode=full.
Sell guard: place + buy=false without long → preflight NO_POSITION_TO_CLOSE — use action=close instead.
ostium_open_trade / ostium_close_trade — do not use in new flows.gap_id: GAP_DEFI_OSTIUM_V1, GAP_DEFI_AUTOMATION_V1 — partial_live until staging/production smokes pass.ostium must be in server DEFI_ENABLED_PLATFORMS.bash
openclaw secrets set CAI_API_KEY "your_dashboard_api_key"
Scope: platform or full.