bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 10쪽 중 5쪽
oading `image`/`mask` files via multipart form data. Provide `model` and `input` together in the playground's request body to use this shape.
</Note>
### Qwen-specific request fields
| Field | Type | Required | Description |
| -------------------------- | ------ | -------- | ----------------------------------------------------------------------------------------------- |
| `model` | string | Yes | Model identifier, such as `wanx-v1`. |
| `input` | object | Yes | Input wrapper object sent in the request body, used instead of multipart `image`/`mask` fields. |
| `input.messages` | array | Yes | Messages array nested under `input`. |
| `input.messages[].role` | string | Yes | Message role, e.g. `user`. |
| `input.messages[].content` | string | Yes | Editing instructions and any referenced source image(s). |
<Tip>
Source images can be referenced inline within `input.messages[].content` (for example as URLs or embedded references) rather than as separate multipart file uploads.
</Tip>
### Example: editing an image
```json theme={null}
{
"model": "wanx-v1",
"input": {
"messages": [
{
"role": "user",
"content": "Remove the background and replace it with a solid white backdrop."
}
]
}
}
```
### Response fields
The response follows the standard image edit shape:
<ResponseField name="created" type="integer">
Creation timestamp.
</ResponseField>
<ResponseField name="data" type="array">
Generated image entries.
<Expandable title="data item properties">
<ResponseField name="url" type="string">
Image URL.
</ResponseField>
<ResponseField name="b64_json" type="string">
Base64 image payload.
</ResponseField>
<ResponseField name="revised_prompt" type="string">
Revised prompt returned by the model.
</ResponseField>
</Expandable>
</ResponseField>
### Example response
```json 200 theme={null}
{
"created": 1719859200,
"data": [
{
"url": "https://cdn.dgrid.ai/generated/edited-abc123.png",
"b64_json": "",
"revised_prompt": "The subject with background removed and replaced with a solid white backdrop."
}
]
}
```
# Qwen Image Generations
Source: https://docs.dgrid.ai/api-reference/images/qwen-image-generations
api-reference/openapi.json POST /v1/images/generations
OpenAI-compatible image generation. Also accepts Qwen-compatible payloads (`wanx-v1` style models) using an `input.messages` wrapper instead of `prompt`.
This page uses the same `images/generations` operation as [Create image](/api-reference/images/create-image), with the playground above pre-filled for the generic OpenAI-style image schema (`prompt`, `model`, `size`, etc.). The notes below describe the Qwen-specific request shape for `wanx-v1` style models.
<Note>
Qwen image models accept an alternate request shape that wraps your prompt inside `input.messages` rather than a top-level `prompt` field. Provide `model` and `input` together in the playground's request body to use this shape.
</Note>
### Qwen-specific request fields
| Field | Type | Required | Description |
| -------------------------- | ------ | -------- | ------------------------------------------------------------------------------- |
| `model` | string | Yes | Model identifier, such as `wanx-v1`. |
| `input` | object | Yes | Input wrapper object sent in the request, used instead of a top-level `prompt`. |
| `input.messages` | array | Yes | Messages array nested under `input`. |
| `input.messages[].role` | string | Yes | Message role, e.g. `user`. |
| `input.messages[].content` | string | Yes | Prompt text describing the desired image. |
<Tip>
Unlike the standard `prompt`/`size`/`quality` fields shown in the playground, Qwen's `wanx-v1` models read the prompt from `input.messages[].content`. Other top-level fields such as `n` and `response_format` are not used by this format.
</Tip>
### Example: generating an image
```json theme={null}
{
"model": "wanx-v1",
"input": {
"messages": [
{
"role": "user",
"content": "A serene mountain lake at dawn, photorealistic."
}
]
}
}
```
### Response fields
The response follows the standard image generation shape:
<ResponseField name="created" type="integer">
Creation timestamp.
</ResponseField>
<ResponseField name="data" type="array">
Generated image entries.
<Expandable title="data item properties">
<ResponseField name="url" type="string">
Image URL.
</ResponseField>
<ResponseField name="b64_json" type="string">
Base64 image payload.
</ResponseField>
<ResponseField name="revised_prompt" type="string">
Revised prompt returned by the model.
</ResponseField>
</Expandable>
</ResponseField>
### Example response
```json 200 theme={null}
{
"created": 1719859200,
"data": [
{
"url": "https://cdn.dgrid.ai/generated/abc123.png",
"b64_json": "",
"revised_prompt": "A serene mountain lake at dawn with mist rising off the water, photorealistic."
}
]
}
```
# Introduction
Source: https://docs.dgrid.ai/api-reference/introduction
Overview of DGrid's three API surfaces — the Model API, Management API Keys, and x402 pay-per-inference API — with authentication and base URLs.
The DGrid API Reference is organized into three API surfaces, each with its own authentication model and purpose:
<CardGroup>
<Card title="Model API" icon="brain" href="#model-api">
OpenAI-, Claude-, and Gemini-compatible endpoints for chat, completions, embeddings, images, audio, and moderations.
</Card>
<Card title="Management API Keys" icon="key" href="/management-api-keys">
Programmatic lifecycle management for Model API Keys — create, rotate, limit, disable, and revoke.
</Card>
<Card title="x402 API" icon="credit-card" href="/x402/overview">
Pay-per-inference access using the x402 payment protocol, with no pre-funded account balance.
</Card>
</CardGroup>
<Note>
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`.
</Note>
## 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](/api-reference/usage-and-billing/get-request-billing-details) to retrieve token usage, pricing, and USD cost details.
### Base URL
```text theme={null}
https://api.dgrid.ai
```
### Authentication
All Model API endpoints authenticate with a bearer token:
```http theme={null}
Authorization: Bearer <DGRID_API_KEY>
```
The Claude-compatible `POST /v1/messages` endpoint additionally requires:
```http theme={null}
anthropic-version: 2023-06-01
```
Get your key by following the [key creation guide](https://blog.dgrid.ai/posts/2026-01-04/), or use the [Management API Keys](/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](/api-reference/models/list-models) to discover the model IDs available to your key.
### Endpoint families
| Family | Base path | Best for |
| --------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| Chat | `/v1/chat/completions`, `/v1/responses`, `/v1/messages`, `/v1/models/{model}:generateContent` | Conversational apps, multimodal assistants, tool calling |
| Completions | `/v1/completions` | Prompt-only text generation and legacy integrations |
| Embeddings | `/v1/embeddings`, `/v1/engines/{engine}/embeddings` | Search, clustering, retrieval, ranking |
| Images | `/v1/images/generations`, `/v1/images/edits` | Image generation and editing across model formats |
| Audio | `/v1/audio/speech`, `/v1/audio/transcriptions`, `/v1/audio/translations` | Speech synthesis, transcription, translation |
| Moderations | `/v1/moderations` | Content safety filtering and policy checks |
| Models | `/v1/models` | Discover available models and supported endpoint types |
| Usage & Billing | `/api/v1/model-router/billing-json` | Retrieve request-level token usage, pricing snapshots, and USD cost details |
| Realtime | `/v1/realtime` (WebSocket) | Low-latency streaming conversations |
### 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 Keys
Management API Keys are administrative credentials for the full lifecycle of Model API Keys — creation, rotation, usage limits, disabling, and revocation. They are restricted to key management operations and cannot call Model API inference endpoints.
See [Management API Keys](/management-api-keys) for the API surfaces, authentication boundaries, and endpoint reference.
## 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](/x402/overview) for the payment flow and [x402 API Reference](/x402/api-reference) for endpoint details.
# List models
Source: https://docs.dgrid.ai/api-reference/models/list-models
api-reference/openapi.json GET /v1/models
Retrieve all models visible to the current API key. The result is permission-aware and scoped to the key's assigned access group.
# Create moderation
Source: https://docs.dgrid.ai/api-reference/moderations/create-moderation
api-reference/openapi.json POST /v1/moderations
OpenAI-compatible content safety checks for user-generated or model-generated text. Evaluates input against categories such as hate, harassment, self-harm, sexual content, and violence.
# Get request billing details
Source: https://docs.dgrid.ai/api-reference/usage-and-billing/get-request-billing-details
Retrieve token usage, pricing, and USD cost details for a completed Model API request.
Retrieve the billing record for a single Model API request. Use this endpoint when you need to reconcile user-facing usage, audit model costs, or inspect the pricing snapshot that was applied when a request was billed.
<Note>
Use the same DGrid API key that made the original model request. Billing records are scoped to the authenticated key and cannot be queried across keys.
</Note>
## Endpoint
```http theme={null}
GET https://api.dgrid.ai/api/v1/model-router/billing-json?request_id=<DGRID_REQUEST_ID>
```
| | |
| ------------------ | --------------------------------------- |
| **Authentication** | `Authorization: Bearer <DGRID_API_KEY>` |
| **Request** | Query parameter |
| **Response** | `application/json` |
## Query parameters
| Parameter | Type | Required | Description |
| ------------ | ------ | -------- | ------------------------------------------------------------------------------------- |
| `request_id` | string | Yes | The ID of the completed Model API request whose billing details you want to retrieve. |
## Get the request ID
DGrid returns the request ID in the `DGrid-Request-ID` response header of the original model call. Store this value if you need to retrieve the request's billing details later.
```http theme={null}
DGrid-Request-ID: req_178027***********6dc9x
```
## Request example
<RequestExample>
```bash cURL theme={null}
curl --location \
'https://api.dgrid.ai/api/v1/model-router/billing-json?request_id=<DGRID_REQUEST_ID>' \
--header 'Authorization: Bearer <DGRID_API_KEY>'
```
</RequestExample>
## Response
### 200 OK
The billing record was found and belongs to the authenticated API key.
<ResponseExample>
```json 200 theme={null}
{
"code": 200,
"message": "ok",
"data": {
"request_id": "req_**********86dc9x",
"billing_json": {
"model": "anthropic/claude-opus-4.6",
"input_cost": 0.54909,
"output_cost": 0.0027500000000000003,
"cache_create_cost": 0,
"cache_read_cost": 0,
"request_cost": 0,
"total_cost": 0.55184,
"supplier_id": 1,
"input_tokens": 109818,
"output_tokens": 110,
"cache_create_tokens": 0,
"cache_read_tokens": 0,
"pricing_mode": "usage",
"pricing_snapshot": {
"pricing_mode": "usage",
"input_price_per_1m": 5,
"output_price_per_1m": 25,
"cache_create_price": 6.25,
"cache_read_price": 0.5,
"price_per_request": null,
"input_tiers": [],
"output_tiers": [],
"cache_create_tiers": [],
"cache_read_tiers": []
}
}
}
}
```
```json 401 theme={null}
{
"code": 401,
"message": "unauthorized"
}
```
```json 404 theme={null}
{
"code": 404,
"message": "not found"
}
```
</ResponseExample>
## Billing fields
| Field | Description |
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `model` | Model ID used by the original request. |
| `input_tokens` / `output_tokens` | Token counts charged for prompt and generated output. |
| `cache_create_tokens` / `cache_read_tokens` | Cache-related token counts when cache pricing applies. |
| `input_cost` / `output_cost` | USD cost attributed to input and output token usage. |
| `cache_create_cost` / `cache_read_cost` | USD cost attributed to cache creation and cache reads. |
| `request_cost` | Fixed per-request USD cost when the pricing mode includes one. |
| `total_cost` | Final USD cost billed for the request. |
| `pricing_snapshot` | The pricing configuration used at billing time. Later price changes do not modify this historical record. |
## Best practices
* Save `DGrid-Request-ID` with your own request logs so you can reconcile usage later.
* Treat `pricing_snapshot` as an immutable historical record for the request.
* All cost and price fields are denominated in USD.
* Numeric values may contain variable decimal precision. Do not rely on fixed-width decimal formatting.
# Background
Source: https://docs.dgrid.ai/background
Market pain points, industry gaps, and the centralized AI infrastructure problems that motivated DGrid's decentralized inference network.
In the current field of artificial intelligence, both centralized systems and Web3 ecosystems face key constraints that hinder the seamless integration of artificial intelligence and blockchain. The AI industry is experiencing explosive growth, yet it lacks both market efficiency and fairness, which restricts the overall development of the ecosystem.
## Market Pain Points: Fragmented Prosperity and Centralized Control
In the current field of artificial intelligence, both centralized systems and Web3 ecosystems face key constraints that hinder the seamless integration of artificial intelligence and blockchain. The AI industry is experiencing explosive growth, yet it lacks both market efficiency and fairness, which restricts the overall development of the ecosystem.
1. **Explosive Supply and Fragmented Ecosystem**: The number of proprietary, open-source, fine-tuned models and AI Agents is surging. However, inconsistent interface specifications and drastic quality disparities make it difficult for resources to interoperate and be compatible with each other.
2. **Matching Failure and Value Obscuration**: For developers, the cost of finding, testing, and integrating suitable models and Agents is extremely high, leading to low efficiency. For creators, excellent models and Agents lack efficient distribution channels, with their value monopolized by centralized platforms, resulting in an imbalanced profit distribution.
3. **Lack of Trust and Concentration of Power**: The service process operates in a "black box" mode—AI output results are neither verifiable nor auditable, and there is no room for autonomous governance. Centralized hierarchies control pricing power and traffic distribution, depriving the ecosystem of transparency and fairness.
The mission of DGrid AI is to ***"reconstruct the underlying architecture of AI inference"*** by building decentralized infrastructure, freeing AI operations and applications from dependence on a few large platforms. The ultimate goal is to make artificial intelligence a native foundational capability of the blockchain world—seamlessly integrated into blockchain applications, just like current data storage and transaction processing.
# Circulation Mechanism
Source: https://docs.dgrid.ai/circulation-mechanism
How the $DGAI token flows through the DGrid economy via staking, inference payments, rewards, and buyback to form a closed-loop value cycle.
\$DGAI operates within a closed-loop economic system, ensuring transparent value flow among users, node operators, and the broader ecosystem. This mechanism is governed by smart contracts (e.g., Bill Contract) and enforced via DGrid Nodes, eliminating intermediaries and aligning incentive mechanisms with network health.
## Core Cycle: From Payment to Rewards
The circulation of \$DGAI follows a structured process that links users' inference demands to node contributions:
1. **Initiation of User Payment**
When a user submits an inference request via the user client, the process unfolds as follows:
* The request is routed to a DGrid Node, which calculates the task fee using the following formula:
`Cost = Compute Unit (CU) × Base Price × (1 + Latency Penalty Coefficient)`
<Info>
- **Compute Unit (CU)**: A standardized metric for measuring inference complexity (correlated with model size, number of input tokens, and execution time).
- **Base Price**: A fixed price per CU (adjustable via governance mechanisms, with an initial value of 0.05 \$DGAI).
- **Latency Penalty Coefficient**: Ranges from 0 to 0.3 (fine-tuned for latency exceeding the target threshold).
</Info>
* The user's \$DGAI is escrowed via the **Bill Contract**—a smart contract deployed on the blockchain—to ensure payment upon task completion.
2. **Distribution of Node Rewards**
After inference is completed (verified by Grid Nodes and archived in the AI DA Layer), the escrowed \$DGAI is distributed via the Bill Contract.
Recipients include:
* **DGrid Nodes**: Compensation for executing inference tasks (proportional to CU, latency, and uptime).
* **Treasury**: Used for network maintenance (e.g., AI DA Layer fees, security audits) and developer grants.
* **Governance Pool**: Incentivizes \$DGAI holders to participate in voting (e.g., protocol upgrades, parameter adjustments).
3. **Staking and Lock-Up Requirements**
Nodes participating in the network must lock up \$DGAI as collateral to ensure accountability.
4. **Governance and Fee Allocation**
* **Governance Pool**: 5% of task payments (plus 10% of annual treasury funds) are distributed to \$DGAI holders who participate in proposal voting (e.g., adjusting base prices, whitelisting new models).
* **Network Fees**: A 2% processing fee is deducted upfront from all task payments to cover smart contract gas costs and AI DA Layer archiving, ensuring transaction efficiency.
5. **Penalty Mechanisms and Token Burning**
Node violations trigger automatic penalties to protect network integrity:
* **Confiscated Tokens**: 5–20% of a node's staked \$DGAI will be confiscated for malicious behaviors (e.g., submitting false inference results, downtime exceeding 72 hours).
* **Burning Mechanism**: All confiscated tokens are permanently burned, reducing the total supply of \$DGAI over time and enhancing scarcity.
## Key Processes: Capital Inflows and Outflows
| Inflows (Sources of \$DGAI) | Outflows프로젝트로 돌아가기