# Nightshift Labs Base Gas Price API

> Nightshift Labs Base Gas Price API is a paid API for AI agents from nightshift-x402.nightshift-labs.workers.dev, paid per call via x402, $0.003/call, status unknown (last checked 2026-11-18).

Returns current gas prices and estimated transaction costs on the Base blockchain, optionally for a custom gas limit.

## Facts

- Endpoint: GET https://nightshift-x402.nightshift-labs.workers.dev/v1/base/gas?utm_source=zero.xyz
- Price: $0.003/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-18
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/nightshift-labs-base-gas-price-api-283d8be1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ZJo8s8YXjxSs73yIZfNEb

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 nightshift-labs-base-gas-price-api-283d8be1
```

Example prompt: What are the current gas prices on Base right now, and how much would an ETH transfer and an ERC-20 transfer each cost in USD?

## When to prefer this

Use this endpoint when you need real-time gas price data specifically for the Base L2 network, including USD cost estimates for common transaction types (ETH transfer, ERC-20 transfer) or a custom gas limit. Prefer this over generic Ethereum mainnet gas APIs when operating on Base. It is pay-per-call via x402/USDC, making it suitable for autonomous AI agents that handle their own micropayments.

## Known failure modes

- Network unavailability of Base RPC endpoint returns an error response
- Invalid gasLimit format (non-numeric or too large) returns a validation error
- Cloudflare Worker timeout if upstream Base node is slow
- Payment failure (insufficient USDC balance for x402 micropayment) blocks the call

## How this service works

Base gas snapshot: gas price, base fee, priority fee, 10-block base-fee trend, ETH/USD (Chainlink) and estimated USD cost of an ETH transfer, ERC-20 transfer, swap and contract deploy right now.

## Output

A JSON object containing the current Base blockchain chain identifier, ETH/USD price, base fee in gwei, gas price in gwei, and estimated costs (in ETH and USD) for a standard ETH transfer (21,000 gas) and ERC-20 transfer (65,000 gas). If a custom gasLimit query parameter is provided, an additional estimatedCost.custom field is returned with ETH and USD cost for that gas amount.

## 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",
     "properties": {
      "gasLimit": {
       "type": "string",
       "pattern": "^[0-9]{1,9}$",
       "description": "optional: gas units of your own transaction; adds estimatedCost.custom (ETH + USD)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "chain": "base",
  "ethUsd": 2259.98,
  "baseFeeGwei": 0.005,
  "gasPriceGwei": 0.006,
  "estimatedCost": {
   "ethTransfer": {
    "eth": 1.26e-7,
    "gas": 21000,
    "usd": 0.000285
   },
   "erc20Transfer": {
    "gas": 65000,
    "usd": 0.000881
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/nightshift-labs-base-gas-price-api-283d8be1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from nightshift-x402.nightshift-labs.workers.dev](https://www.zero.xyz/host/nightshift-x402.nightshift-labs.workers.dev/llms.txt)
