# ChainHilt TWAP Order Preview (Hyperliquid Perp/Spot)

> ChainHilt TWAP Order Preview (Hyperliquid Perp/Spot) is a paid API for AI agents from chainhilt.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-11-16).

Prepares a TWAP (Time-Weighted Average Price) order for Hyperliquid perpetual or spot markets, returning EIP-712 typed data for L1 signing before submission.

## Facts

- Endpoint: POST https://chainhilt.ai/api/v1/perp/hyperliquid/twap/place/preview?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/chainhilt-twap-order-preview-hyperliquid-perp-spot-ee5a7fe5
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_PRdNzw9v8QVol8k8xDLlv

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability chainhilt-twap-order-preview-hyperliquid-perp-spot-ee5a7fe5 -d '<json body>'
```

Example prompt: Prepare a TWAP buy order on Hyperliquid for asset ID 0, size 0.5, duration 30 minutes, with randomize enabled and reduce-only off, using my account 0xAbC1234567890abcdef1234567890abcdef123456 — I'll sign and submit it myself.

## When to prefer this

Use this endpoint when you need to execute a large trade gradually on Hyperliquid using TWAP execution to minimize market impact, and you require EIP-712 L1 signing (e.g., from a hardware wallet or smart contract wallet) rather than API-key-based signing. Prefer this over a market or limit order when order size is large relative to liquidity or when price impact must be managed over time. This is the right choice for agents operating on Hyperliquid perpetuals or spot markets with direct L1 wallet control.

## Known failure modes

- Estimated total order value below $100 for perps or 100 quote tokens for spot — rejected with validation error
- Asset ID out of range (0–99999) or not supported on Hyperliquid — returns error
- Duration outside 5–10080 minutes range — schema validation failure
- Builder-deployed perp assets not supported — returns unsupported asset error
- Invalid Ethereum address format for accountAddress or vaultAddress — schema validation failure
- Size string not matching numeric pattern — schema validation failure
- Account abstraction mode mismatch when treating spot and perp as unified — may return warning or error

## How this service works

Discover, pay for, and execute the on-chain actions your agent needs. No API keys. Compatible with x402. Your wallet stays local.

## Output

Returns an action payload containing the original TWAP order parameters, an EIP-712 typed data object (domain, types, message, primaryType) for L1 signing, a nonce, the Arbitrum chain ID (42161), protocol identifier 'hyperliquid', and a submitPath (/perp/hyperliquid/twap/place/execute) to use after signing. Also includes any warnings or errors from the exchange.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "nonce": {
   "type": "integer",
   "minimum": 0,
   "description": "Action nonce in milliseconds since the epoch; defaults to the current time."
  },
  "action": {
   "type": "object",
   "required": [
    "type",
    "twap"
   ],
   "properties": {
    "twap": {
     "type": "object",
     "required": [
      "a",
      "b",
      "s",
      "r",
      "m",
      "t"
     ],
     "properties": {
      "a": {
       "type": "integer",
       "maximum": 99999,
       "minimum": 0,
       "description": "Asset ID from /perp/hyperliquid/asset-id; builder-deployed perps (100000+) are not supported."
      },
      "b": {
       "type": "boolean",
       "description": "true to buy, false to sell."
      },
      "m": {
       "type": "integer",
       "maximum": 10080,
       "minimum": 5,
       "description": "Duration in minutes, from 5 to 10,080 (7 days)."
      },
      "r": {
       "type": "boolean",
       "description": "true for reduce-only."
      },
      "s": {
       "type": "string",
       "pattern": "^(0|[1-9][0-9]*)(\\.[0-9]+)?$",
       "description": "Total size as a decimal string."
      },
      "t": {
       "type": "boolean",
       "description": "true to randomize slice timing."
      }
     },
     "description": "TWAP parameters in Hyperliquid wire order.",
     "additionalProperties": false
    },
    "type": {
     "type": "string",
     "const": "twapOrder",
     "description": "Always \"twapOrder\"."
    }
   },
   "description": "TWAP order action.",
   "additionalProperties": false
  },
  "expiresAfter": {
   "type": "integer",
   "minimum": 0,
   "description": "Millisecond timestamp after which Hyperliquid rejects the action. Signed with the action."
  },
  "vaultAddress": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]{40}$",
   "description": "Vault or subaccount to act for; omit to act for the signer. Signed with the action."
  },
  "accountAddress": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]{40}$",
   "description": "Signing account's address, returned as response metadata; not part of the signed action."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "response": {
   "errors": [],
   "actions": [
    {
     "data": {
      "nonce": 1710000000000,
      "action": {
       "twap": {
        "a": 0,
        "b": true,
        "m": 30,
        "r": false,
        "s": "0.01",
        "t": true
       },
       "type": "twapOrder"
      },
      "typedData": {
       "types": {
        "Agent": [
         {
          "name": "source",
          "type": "string"
         },
         {
          "name": "connectionId",
          "type": "bytes32"
         }
        ],
        "EIP712Domain": [
         {
          "name": "name",
          "type": "string"
         },
         {
          "name": "version",
          "type": "string"
         },
         {
          "name": "chainId",
          "type": "uint256"
         },
         {
          "name": "verifyingContract",
          "type": "address"
         }
        ]
       },
       "domain": {
        "name": "Exchange",
        "chainId": 1337,
        "version": "1",
        "verifyingContract": "0x0000000000000000000000000000000000000000"
       },
       "message": {
        "source": "a",
        "connectionId": "0x39c45888f5aa540c7605aac5a1a4316347ba09f9948095174ff50dc1069e980c"
       },
       "primaryType": "Agent"
      }
     },
     "type": "signature",
     "chainId": 42161,
     "protocol": "hyperliquid",
     "submitPath": "/perp/hyperliquid/twap/place/execute"
    }
   ],
   "warnings": []
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/chainhilt-twap-order-preview-hyperliquid-perp-spot-ee5a7fe5/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from chainhilt.ai](https://www.zero.xyz/host/chainhilt.ai/llms.txt)
