# GlianaAI Swap Build Tool

> GlianaAI Swap Build Tool is a paid API for AI agents from api.glianalabs.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-27).

Builds a token swap transaction payload (quotes and structures a DEX swap) via GlianaAI's pay-per-call utility API

## Facts

- Endpoint: GET https://api.glianalabs.com/x402/tools/swap-build?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-27
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/glianaai-swap-build-tool-15fa0b5b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_xj6q52uP23R6LdmIydxte

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 glianaai-swap-build-tool-15fa0b5b
```

Example prompt: Build me a swap transaction to trade 100 USDC for ETH on a DEX — I need the full transaction payload I can sign and submit on-chain.

## When to prefer this

Choose this endpoint when you need to programmatically build a DEX swap transaction payload without managing API keys or subscriptions — paying only $0.005 USDC per call via x402 on supported chains (Base, Solana, Algorand, BNB Chain, Tempo). Ideal for agents that need to construct swap calldata on-demand without a standing API contract.

## Known failure modes

- Insufficient liquidity for the requested token pair returns an error or empty route
- Unsupported token address returns a validation error
- Malformed input body or missing required fields returns a 400-level error
- Payment not received or insufficient USDC balance returns a 402 Payment Required
- Network congestion may cause stale quotes or timeouts

## How this service works

GlianaAI - Pay-per-call AI models, live market data, SEC filings and identity APIs, no signup, USDC. This resource: tools/swap-build. Input: { chain, from, to, amount, address, to_chain?, to_address?, slippage_pct?, max_value_lost_pct? }. https://ai.glianalabs.com

## Output

Returns a structured swap transaction payload (tool: tools/swap-build) including routing information, estimated output amounts, and encoded transaction data ready for signing and on-chain submission on supported blockchains.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "to": {
   "type": "string",
   "description": "Token to buy: a symbol or contract address."
  },
  "from": {
   "type": "string",
   "description": "Token to sell: a symbol like USDC or ETH, or its contract address."
  },
  "chain": {
   "type": "string",
   "description": "Chain to swap on: a name like base, ethereum, arbitrum, bsc, solana, or a chain id."
  },
  "amount": {
   "type": "string",
   "description": "How much of the from token to sell, in whole tokens, e.g. \"10\" or \"0.25\"."
  },
  "address": {
   "type": "string",
   "description": "The wallet that will sign and send the transaction (0x… on EVM, base58 on Solana)."
  },
  "to_chain": {
   "type": "string",
   "description": "Optional destination chain for a bridge. Default: same as chain."
  },
  "to_address": {
   "type": "string",
   "description": "Optional recipient on the destination chain. Default: address. Required when bridging between EVM and Solana."
  },
  "slippage_pct": {
   "type": "number",
   "description": "Optional slippage tolerance in percent, 0.05 to 10. Default 0.5."
  },
  "max_value_lost_pct": {
   "type": "number",
   "description": "Optional ceiling on value lost to fees and price impact, in percent. Default 3; above it the call is refused for free."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "tool": "tools/swap-build"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/glianaai-swap-build-tool-15fa0b5b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.glianalabs.com](https://www.zero.xyz/host/api.glianalabs.com/llms.txt)
