# 1gateway On-Chain Token Price API

> 1gateway On-Chain Token Price API is a paid API for AI agents from 1gateway.dev, paid per call via x402, $0.003/call, status unknown (last checked 2026-11-30).

Returns real-time USD spot prices for up to 10 ERC-20 (Base) or SPL (Solana) tokens sourced directly from on-chain DEX pools, with confidence scores and pool metadata.

## Facts

- Endpoint: GET https://1gateway.dev/v1/onchain/prices?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-30
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/1gateway-on-chain-token-price-api-3a545c24
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-PA9jA7a9lkP_UHhqoe40

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 1gateway-on-chain-token-price-api-3a545c24
```

Example prompt: What's the current on-chain USD price of the Base token at 0x940181a94A35A4569E4529A3CDfB74e38FD98631 — include which pool was used and the confidence level?

## When to prefer this

Choose this endpoint when you need raw on-chain token prices without relying on a centralized price feed like CoinGecko or Chainlink. Ideal for AI agents operating in DeFi contexts on Base or Solana that need trustless, DEX-sourced prices with pool provenance and confidence metadata. Best when you need to audit exactly which pool and fee tier the price comes from, or when pricing long-tail tokens not covered by major oracles. Pay-per-call model ($0.003 USDC) suits low-frequency or exploratory use cases.

## Known failure modes

- 400 error returned before payment if token address format is invalid or chain prefix is wrong — not charged
- priceUsd returns null if pool depth is below $1,000 USD floor
- Low confidence warning if pool depth is below configured threshold
- Token not found in any supported pool returns null price with warning
- Up to 10 tokens per call — exceeding limit causes 400 error
- Spot price only — no TWAP, so subject to manipulation on low-liquidity tokens

## How this service works

Use when an agent needs a token's USD price without a third-party price feed. Input: tokens (up to 10, base:0x… or sol:<mint>). Output: per token priceUsd, confidence, the pool used (Uniswap v3 / Aerodrome on Base, Orca Whirlpool on Solana; fee tier, depth in USD), path (direct USDC or via WETH/SOL), warnings; no price below $1,000 depth. Spot, not TWAP. Example: ?tokens=base:0x940181a94A35A4569E4529A3CDfB74e38FD98631

## Output

Returns a JSON array of per-token results, each containing: priceUsd (nullable if below depth floor), confidence level (high/low/null), the pool used (DEX name, quote token, pool address, fee tier, depth in USD), the pricing path (direct USDC or routed via WETH/SOL), and any warnings. Also includes a top-level asOf timestamp with block/slot numbers, and metadata about which DEXes and depth thresholds were applied. Prices below $1,000 pool depth are suppressed (null).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "tokens"
     ],
     "properties": {
      "tokens": {
       "type": "string",
       "pattern": "^(?:(?:base|sol|solana):[0-9A-Za-z]{32,44}|[A-Za-z]{2,6})(?:,(?:(?:base|sol|solana):[0-9A-Za-z]{32,44}|[A-Za-z]{2,6})){0,9}$",
       "description": "Comma-separated chain:address list, max 10 (base:0x… ERC-20, sol:<mint> base58), or tickers BTC, ET…"
      }
     },
     "additionalProperties": false
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "prices",
      "asOf",
      "method",
      "notes",
      "rpc"
     ],
     "properties": {
      "rpc": {
       "type": "object",
       "properties": {
        "kind": {
         "type": "string"
        },
        "source": {
         "type": "string"
        }
       },
       "additionalProperties": true
      },
      "asOf": {
       "type": "object",
       "properties": {
        "at": {
         "type": "string"
        },
        "baseBlock": {
         "type": "integer"
        },
        "solanaSlot": {
         "type": "integer"
        }
       },
       "additionalProperties": true
      },
      "notes": {
       "type": "array",
       "items": {
        "type": "string"
       }
      },
      "method": {
       "type": "object",
       "properties": {
        "dexes": {
         "type": "object",
         "additionalProperties": true
        },
        "depthUsd": {
         "type": "string"
        },
        "floorUsd": {
         "type": "integer"
        },
        "lowConfidenceBelowUsd": {
         "type": "integer"
        }
       },
       "additionalProperties": true
      },
      "prices": {
       "type": "array",
       "items": {
        "type": "object",
        "additionalProperties": true
       }
      }
     },
     "additionalProperties": true
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "rpc": {
   "kind": "public",
   "source": "base-rpc.publicnode.com"
  },
  "asOf": {
   "at": "2026-10-24T23:27:00.257Z",
   "baseBlock": 53047536,
   "solanaSlot": 461036588
  },
  "notes": [
   "Computed from onchain pool state at the block/slot above; no third-party price feed."
  ],
  "method": {
   "dexes": {
    "base": [
     "uniswap_v3"
    ],
    "solana": [
     "orca_whirlpool"
    ]
   },
   "depthUsd": "2 × the pool's quote-side balance (USDC, or WETH/SOL converted to USD)",
   "floorUsd": 1000,
   "lowConfidenceBelowUsd": 50000
  },
  "prices": [
   {
    "path": [
     "WETH"
    ],
    "pool": {
     "dex": "uniswap_v3",
     "quote": "USDC",
     "address": "0x6c561b446416e1a00e8e93e221854d6ea4171372",
     "feeTier": "0.3%",
     "depthUsd": 83615789
    },
    "chain": "base",
    "token": "0x4200000000000000000000000000000000000006",
    "symbol": "WETH",
    "priceUsd": 2338.8024,
    "warnings": [],
    "confidence": "high"
   }
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/1gateway-on-chain-token-price-api-3a545c24/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from 1gateway.dev](https://www.zero.xyz/host/1gateway.dev/llms.txt)
