Skip to main content
The DGrid API Reference is organized into three API surfaces, each with its own authentication model and purpose:

Model API

OpenAI-, Claude-, and Gemini-compatible endpoints for chat, completions, embeddings, images, audio, and moderations.

Management API

Manage Model API keys programmatically and query account balances with a Management API Key.

x402 API

Pay-per-inference access using the x402 payment protocol, with no pre-funded account balance.
To receive events at your own HTTPS endpoint, see the Webhook guide. For email and Lark setup, see Notifications.
Every Model API reference page has an interactive playground: fill in your API key and parameters, then press Send to test the endpoint live against https://api.dgrid.ai.

Model API

The Model API gives you a single gateway to 200+ leading AI models. Every endpoint is compatible with an ecosystem standard — OpenAI, Claude, or Gemini — so your existing SDKs and tooling work unchanged. For request-level cost reconciliation, store the DGrid-Request-ID response header and use Get request billing details to retrieve token usage, pricing, and USD cost details.

Base URL

Authentication

All Model API endpoints authenticate with a bearer token:
The Claude-compatible POST /v1/messages endpoint additionally requires:
Get your key by following the key creation guide, or use the Management API Keys surface for programmatic key lifecycle management.

Model naming

The model parameter uses the provider/model-name format — for example openai/gpt-4o — consistent across all DGrid-supported models. Call List models to discover the model IDs available to your key.

Endpoint families

Best practices

  1. Store the DGrid API key on the server side and never expose it in public clients or repositories.
  2. Prefer the OpenAI-compatible format when you want the broadest SDK compatibility with minimal migration effort.
  3. Use provider-native formats only when you need provider-specific payload features such as Gemini multimodal parts or Claude tool payloads.
  4. Keep request and response examples in sync with your target model family, because parameter names differ between OpenAI, Claude, and Gemini styles.

Management API

Management API Keys are administrative credentials for Model API key lifecycle operations and account balance queries. They cannot call Model API inference endpoints. See Management API Keys for key creation, authentication boundaries, and lifecycle endpoints. Use Get account balance to query total, subscription, and recharge balances with a Management API Key.

x402 API

The x402 API is DGrid’s pay-per-inference access mode. Instead of creating an account or pre-funding a balance, requests are authorized and settled per call using the x402 payment protocol — well suited to autonomous agents and on-demand integrations. See x402 API for the payment flow and x402 API Reference for endpoint details.