# d402 LLM Inference Gateway

> d402 LLM Inference Gateway is a paid API for AI agents from gateway.d402.xyz, paid per call via x402, $0.01/call, status down (last checked 2026-09-15).

Runs LLM text completions through worker-owned providers (Ollama, vLLM, OpenAI-compatible) via the d402 payment network for $0.01 USDC per call.

## Facts

- Endpoint: POST https://gateway.d402.xyz/v1/llm/inference
- Price: $0.01/call
- Payment: x402
- Status: down
- Last checked: 2026-09-15
- Activations on Zero: 0
- Provider: gateway.d402.xyz
- Website: https://gateway.d402.xyz
- Canonical page: https://www.zero.xyz/c/gateway-d402-xyz-d402-llm-inference-gateway-24f1fd8c
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_bMH7Jy9MamzyuB4ycIWM9

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 gateway-d402-xyz-d402-llm-inference-gateway-24f1fd8c -d '<json body>'
```

Example prompt: Using the d402 LLM gateway with the ollama provider, send the prompt 'Explain quantum entanglement in simple terms' to llama3 with a temperature of 0.7 and max 300 tokens.

## When to prefer this

Choose this endpoint when you need LLM text completions without managing API keys or subscriptions, want to pay per-call in USDC via the d402 micropayment network, need access to local or open-source model providers (Ollama, llama.cpp, vLLM), or want auditable inference with prompt/response hashes for verification. Prefer over direct OpenAI/Anthropic APIs when decentralization, worker-owned compute, or crypto-native payment settlement is required.

## Known failure modes

- No workers available for requested provider/model — returns status=error with error message
- Payment not settled or insufficient USDC — request rejected before inference runs
- Timeout exceeded (max 45000ms) — returns status=error
- Model not allowed by seller profile — may return error or fall back to default model
- Provider credentials expired on worker side — worker returns error passed through as status=error
- Invalid messages format — request rejected with validation error

## How this service works

Paid d402 capability alias for llm.inference@1. Workers can wrap local Ollama/LM Studio/llama.cpp/vLLM or consumer/free-tier OpenAI-compatible APIs and sell completions through d402 without exposing provider keys.

## Output

Returns a taskId and status, plus a result object containing the generated text completion, model name, provider name, prompt and response hashes for auditability, token usage stats, and optionally raw choices array. Also includes settlement and validation receipt metadata from the d402 payment network.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "model": {
   "type": "string",
   "description": "Requested model, honored only if the seller profile allows it."
  },
  "prompt": {
   "type": "string",
   "description": "Convenience single user prompt; messages wins if provided."
  },
  "profile": {
   "type": "string",
   "description": "Optional seller profile alias from D402_LLM_PROVIDERS_JSON."
  },
  "messages": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "role": {
      "type": "string"
     },
     "content": {
      "type": "string"
     }
    }
   }
  },
  "provider": {
   "type": "string",
   "description": "Seller-offered provider/profile name, for example nvidia, ollama, groq-free. The buyer does not provide credentials."
  },
  "maxTokens": {
   "type": "number"
  },
  "timeoutMs": {
   "type": "number",
   "maximum": 45000,
   "minimum": 1
  },
  "temperature": {
   "type": "number"
  }
 },
 "additionalProperties": true
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "taskId",
  "status"
 ],
 "properties": {
  "error": {
   "type": [
    "string",
    "null"
   ]
  },
  "links": {
   "type": "object",
   "properties": {
    "task": {
     "type": "string"
    },
    "result": {
     "type": "string"
    },
    "receipt": {
     "type": "string"
    }
   }
  },
  "result": {
   "type": "object",
   "required": [
    "provider",
    "model",
    "text",
    "promptHash",
    "responseHash",
    "serviceName",
    "serviceVersion"
   ],
   "properties": {
    "raw": {
     "type": "object"
    },
    "text": {
     "type": "string"
    },
    "model": {
     "type": "string"
    },
    "usage": {
     "type": [
      "object",
      "null"
     ]
    },
    "choices": {
     "type": "array"
    },
    "message": {
     "type": "object"
    },
    "provider": {
     "type": "string"
    },
    "createdAt": {
     "type": "string"
    },
    "promptHash": {
     "type": "string"
    },
    "serviceName": {
     "type": "string"
    },
    "responseHash": {
     "type": "string"
    },
    "runnerVersion": {
     "type": "string"
    },
    "serviceVersion": {
     "type": "string"
    }
   }
  },
  "status": {
   "enum": [
    "accepted",
    "rejected",
    "running",
    "error"
   ],
   "type": "string"
  },
  "taskId": {
   "type": "string"
  },
  "settlement": {
   "type": [
    "object",
    "null"
   ],
   "additionalProperties": true
  },
  "x402Settlement": {
   "type": [
    "object",
    "null"
   ],
   "additionalProperties": true
  },
  "validationReceipt": {
   "type": [
    "object",
    "null"
   ],
   "additionalProperties": true
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/gateway-d402-xyz-d402-llm-inference-gateway-24f1fd8c/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from gateway.d402.xyz](https://www.zero.xyz/host/gateway.d402.xyz/llms.txt)
