Skip to main content
This page documents the x402-specific endpoint details for DGrid pay-per-inference requests. If you are looking for provider-style request patterns such as OpenAI-compatible or Claude-compatible payloads, see Model API. Those references remain the best source for provider-specific invocation examples. This page focuses on the x402 payment flow plus the shared inference fields exposed at the x402 endpoint.

x402 AI Inference API

Call DGrid inference with x402 payment requirements. The first request returns payment instructions; the second request includes a signed x-payment header and executes inference.

Payment and Authentication

This endpoint uses the x402 payment protocol instead of an account balance workflow. Required request headers for the paid request:

Request Body

Response Modes

stream = true (default)

Returns UIMessageStream SSE (text/event-stream) using AI SDK style UIMessageChunk events. Common event types include:
  • start
  • text-start
  • text-delta
  • text-end
  • finish
The final finish event includes messageMetadata such as:
  • totalTokens
  • allowanceLeft
  • calculatedPriceWei
  • realPriceWei

stream = false

Returns a single JSON response in DGrid’s standard completion format with choices and usage.

Errors

Settlement Notes

  • The endpoint settles based on actual usage.
  • If actual cost exceeds the authorized upper bound, settlement is capped at that authorized limit.