DGrid AI 백서

DGrid AI

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 10쪽 중 2쪽

ors should be **reinforced or discouraged** In this way, **every user choice becomes a vote for better AI**. ## FAQ #### Is there a "wrong" choice in AI Battle? No. There is **no wrong participation**. * If your choice matches the **community majority**, you earn **10 points**. * If your choice does **not** match the majority, you still earn **5 points**. Every decision is considered valuable signal for model evaluation. #### How many missions can I complete each day? You can complete up to **5 Daily Missions** in AI Battle per day. #### How do I earn referral points? Invite others to join DGrid AI Arena using the referral mechanism in the DGrid interface. For each **valid referred user**, you receive bonus points. #### How do points convert to \$DGAI tokens? Points accumulate as **airdrop weight** for the \$DGAI Token Generation Event (TGE). The more points you have — especially as an early participant — the larger your \$DGAI airdrop allocation. The exact snapshot timing will be announced in advance. #### How does the weekly leaderboard work? * Each week, DGrid allocates a **300,000 pts prize pool**. * Users are ranked based on **points earned during that week**. * Rankings reset every **Sunday at 00:00 UTC**. * The Top 50 users share the pool **proportionally**: more weekly points → larger share. #### How does my participation improve DGrid AI? Your votes: * Tell DGrid which AI responses users prefer * Help identify which models perform best in real usage * Provide ongoing feedback that informs: Model selection; Fine-tuning strategies; Safety and quality improvements # Free Models Router Source: https://docs.dgrid.ai/ai-gateway/free-models-router Use DGrid's free intelligent inference gateway for everyday AI tasks with automatic model routing and fair-use rate limits. Free Models Router is DGrid's free intelligent inference gateway for users worldwide. Instead of choosing a specific free model manually, you call one stable model ID and let DGrid route the request to available model capacity based on service availability, response efficiency, and the task requirements. <Info> Use model ID `dgridai/free` when you want DGrid to select an available free model automatically. See the [model detail page](https://dgrid.ai/models/dgridai/free) for the live model listing. </Info> ## What it is for Free Models Router is designed for general-purpose AI usage where fast access and low friction matter more than selecting a specific provider model. It works well for: * Everyday Q\&A and research assistance * Multilingual writing, rewriting, and translation * Coding help, debugging suggestions, and code explanation * Logical analysis and structured reasoning * Learning support and concept explanation * Drafting, summarizing, and content creation * Complex problem solving that benefits from a capable general model ## How routing works DGrid aggregates multiple sources of free inference capacity behind a single routing layer. For each request, the router evaluates available model resources and schedules the request to a suitable backend. Routing may consider: * Current service availability * Expected response speed * Task type and prompt requirements * Free compute availability across connected model sources * Operational stability of the underlying route This means the underlying model can change from request to request. If your application requires a fixed model identity, use a specific Model API model ID instead of `dgridai/free`. ## Quickstart Free Models Router uses the same OpenAI-compatible chat completion interface as the rest of DGrid AI Gateway. ```bash theme={null} curl https://api.dgrid.ai/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $DGRID_API_KEY" \ -d '{ "model": "dgridai/free", "messages": [ { "role": "user", "content": "Explain zero-knowledge proofs in simple terms." } ] }' ``` You can also use the OpenAI SDK by setting the DGrid base URL: ```typescript theme={null} import OpenAI from 'openai'; const client = new OpenAI({ baseURL: 'https://api.dgrid.ai/v1', apiKey: process.env.DGRID_API_KEY, }); const completion = await client.chat.completions.create({ model: 'dgridai/free', messages: [ { role: 'user', content: 'Help me outline a launch plan for a developer tool.', }, ], }); console.log(completion.choices[0].message.content); ``` ## Rate limits To keep free access reliable and fair, DGrid applies request limits to Free Models Router. Limits are enforced per account. | Access level | Eligibility | Requests per minute | Requests per day | | ---------------- | ------------------------------------------------------------- | ------------------: | ---------------: | | Standard access | Account has not completed at least `$5` in qualifying top-ups | 10 | 100 | | Increased access | Account has completed at least `$5` in qualifying top-ups | 20 | 1,000 | A qualifying top-up is a direct addition of funds to the account balance and is used to determine whether the account meets the `$5` threshold. ### Rate limit errors Requests that exceed the applicable limit are rejected with: ```text theme={null} Rate limit exceeded. Please try again later. ``` If your application needs predictable higher throughput, use a paid model route or contact DGrid support for production guidance. ## Operational guidance * Treat `dgridai/free` as a convenience router, not a fixed model. * Avoid relying on provider-specific behavior from the underlying routed model. * Add retry logic with backoff for temporary rate-limit or availability responses. * Use paid model IDs when you need deterministic model selection, higher throughput, stronger SLA expectations, or model-specific capabilities. * Log `DGrid-Request-ID` from responses if you need to reconcile usage later. See [Get request billing details](/api-reference/usage-and-billing/get-request-billing-details) for request-level billing lookup. # Integration Tutorials Source: https://docs.dgrid.ai/ai-gateway/integrations Step-by-step integration tutorials showing how to connect DGrid AI Gateway to popular developer tools, SDKs, frameworks, and AI coding assistants. This page collects practical integration tutorials for using **DGrid AI Gateway** in common developer tools and SDKs. ## Cursor (Override OpenAI Base URL) 1. Get your `DGRID_API_KEY` (see the prerequisite in [AI Gateway](/ai-gateway/overview)). 2. Open **Cursor Settings** → **Models**. 3. Under **API Keys**, enable **Override OpenAI Base URL**. 4. Set the base URL to: * `https://api.dgrid.ai/v1` 5. Paste your `DGRID_API_KEY` into **OpenAI API Key**. 6. Pick any supported model name using the DGrid format (for example: `openai/gpt-4o`). <Frame> <img alt="Cursor settings example" /> </Frame> Full tutorial: [How to Configure and Use DGrid AI Gateway in Cursor](https://blog.dgrid.ai/posts/2026-02-18/) ## OpenAI SDK (Node.js / Python) * See: [AI Gateway Quickstart](/ai-gateway/overview#quickstart) ## OpenClaw You can configure OpenClaw to route requests through **DGrid AI Gateway** using the OpenAI-compatible endpoint. 1. Open your OpenClaw model/provider settings. 2. Set the API base URL to `https://api.dgrid.ai/v1`. 3. Paste your `DGRID_API_KEY` into the API key field. 4. Select a supported DGrid model ID. 5. Save the configuration and run a quick test request. <video> <source type="video/mp4" /> Your browser does not support the video tag. </video> ## Blog integration tutorials (collected) * **AI as Workspace (AIaW)**: [Step-by-Step Guide: Configure DGrid AI Gateway in AI as Workspace (AIaW)](https://blog.dgrid.ai/posts/2026-03-10/) * **AnythingLLM**: [Tutorial: Using DGrid AI Gateway with AnythingLLM](https://blog.dgrid.ai/posts/2026-01-30/) * **Chatbox**: [Step-by-Step Guide: Configure DGrid AI Gateway in Chatbox](https://blog.dgrid.ai/posts/2026-03-09/) * **Claude Code**: [Use Claude Code with DGrid](https://blog.dgrid.ai/posts/2026-03-12/) * **Codex CLI**: [Using Codex CLI with DGrid: A Complete Guide](https://blog.dgrid.ai/posts/2026-03-23/) * **Junie CLI**: [Step-by-Step Guide: Integrate DGrid with Junie CLI](https://blog.dgrid.ai/posts/2026-04-13/) * **LibreChat**: [Using DGrid with LibreChat: A Step-by-Step Guide](https://blog.dgrid.ai/posts/2026-01-28/) * **LobeChat**: [Configuring and Utilizing DGrid AI Gateway in LobeChat: A Full Guide](https://blog.dgrid.ai/posts/2026-02-09/) * **Open WebUI**: [Using DGrid AI Gateway with Open WebUI: A Comprehensive Guide](https://blog.dgrid.ai/posts/2026-01-22_2/) * **OpenClaw (agent platform)**: [Supercharging OpenClaw with DGrid: The Ultimate AI Agent Setup](https://blog.dgrid.ai/posts/2026-02-02/) * **OpenClaw (no-code)**: [Step-by-Step Guide: OpenClaw Installation & DGrid AI Gateway Setup (No Code Required)](https://blog.dgrid.ai/posts/2026-02-27/) * **Vercel AI SDK**: [How to Use DGrid AI Gateway with the Vercel AI SDK](https://blog.dgrid.ai/posts/2026-03-26/) # Realtime Source: https://docs.dgrid.ai/ai-gateway/model-api/realtime Build OpenAI-compatible Realtime API sessions on DGrid for low-latency text and audio conversations over WebSocket with streaming voice models. The Realtime API exposes OpenAI-compatible low-latency text and audio conversations through websocket sessions plus an HTTP endpoint for short-lived client tokens. ## WebSocket Connection Open a realtime websocket session directly when your backend can securely hold the DGrid API key. ```http theme={null} WSS wss://api.dgrid.ai/v1/realtime?model={model} ``` | | | | ----------------- | ----------------------------------------------------------------- | | **Authorization** | `Authorization: Bearer <DGRID_API_KEY>; OpenAI-Beta: realtime=v1` | | **Request** | `websocket` | | **Response** | `websocket events` | ### Query Parameters | Parameter | Type | Required | Description | | --------- | ------ | -------- | ----------------------------------------------------- | | `model` | string | Yes | Realtime model ID, such as `gpt-4o-realtime-preview`. | ### Client Events | Event Type | Description | | --------------------------- | ---------------------------------- | | `session.update` | Update session-level options. | | `input_audio_buffer.append` | Stream audio chunks to the server. | | `input_audio_buffer.commit` | Commit the current buffered audio. | | `response.create` | Trigger a new assistant response. | | `conversation.item.create` | Insert a conversation item. | ### Server Events | Event Type | Description | | ---------------------- | --------------------------------- | | `session.created` | Session was successfully created. | | `session.updated` | Session settings were updated. | | `response.text.delta` | Streamed text token delta. | | `response.audio.delta` | Streamed audio chunk delta. | | `response.done` | Response has completed. | | `error` | Error payload. | <RequestExample> ```javascript JavaScript Example theme={null} const ws = new WebSocket( 'wss://api.dgrid.ai/v1/realtime?model=gpt-4o-realtime-preview', [], { headers: { Authorization: `Bearer ${apiKey}`, 'OpenAI-Beta': 'realtime=v1' } } ) ws.onopen = () => { ws.send(JSON.stringify({ type: 'session.update', session: { modalities: ['text', 'audio'], voice: 'alloy' } })) } ws.onmessage = (event) => { const data = JSON.parse(event.data) console.log('received event:', data) } ``` ```http Realtime Notes theme={null} Authorization: Bearer <DGRID_API_KEY> OpenAI-Beta: realtime=v1 ``` </RequestExample> ## Create Realtime Session Token Use the realtime endpoint example shown below when you need an authenticated GET request against the realtime HTTP entrypoint. ```http theme={null} GET /v1/realtime ``` | | | | ----------------- | --------------------------------------- | | **Authorization** | `Authorization: Bearer <DGRID_API_KEY>` | | **Request** | `none` | | **Response** | `101 · application/json` | ### Request Headers | Field | Type | Required | Description | | --------------- | ------ | -------- | ------------------------------------------------------- | | `Authorization` | string | Yes | Bearer token used to authenticate the realtime request. | ### Response Body | Field | Type | Description | | ------- | ------ | ---------------------------------------------- | | `101` | text | Successful upgrade response with no JSON body. | | `error` | object | Error payload returned when the request fails. | <RequestExample> ```bash cURL theme={null} curl -X GET "https://api.dgrid.ai/v1/realtime" \ -H "Authorization: Bearer " ``` ```javascript JavaScript theme={null} fetch("https://api.dgrid.ai/v1/realtime", { method: "GET", headers: { "Authorization": "Bearer " } }) ``` ```go Go theme={null} package main import ( "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.dgrid.ai/v1/realtime" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```python Python theme={null} import requests url = "https://api.dgrid.ai/v1/realtime" response = requests.request("GET", url, headers = { "Authorization": "Bearer " }) print(response.text) ``` ```java Java theme={null} import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; import java.time.Duration; HttpClient client = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(10)) .build(); HttpRequest.Builder requestBuilder = HttpRequest.newBuilder() .uri(URI.create("https://api.dgrid.ai/v1/realtime")) .header("Authorization", "Bearer ") .GET() .build(); try { HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString()); System.out.println("Status code: " + response.statusCode()); System.out.println("Response body: " + response.body()); } catch (Exception e) { e.printStackTrace(); } ``` ```csharp C# theme={null} using System; using System.Net.Http; using System.Text; var client = new HttpClient(); client.DefaultRequestHeaders.Add("Authorization", "Bearer "); var response = await client.GetAsync("https://api.dgrid.ai/v1/realtime"); var responseBody = await response.Content.ReadAsStringAsync(); ``` </RequestExample> <ResponseExample> ```text 101 theme={null} Empty ``` ```json 400 theme={null} { "error": { "message": "string", "type": "string", "param": "string", "code": "string" } } ``` </ResponseExample> ## WebSocket Events Plan your client around a small set of request and response event types for low-latency conversational streaming. ```http theme={null} WSS wss://api.dgrid.ai/v1/realtime?model={model} ``` | | | | ----------------- | ----------------------------------------------------------------- | | **Authorization** | `Authorization: Bearer <DGRID_API_KEY>; OpenAI-Beta: realtime=v1` | | **Request** | `websocket` | | **Response** | `event stream` | ### Core Client Events | Event Type | Description | | --------------------------- | ------------------------------------------------------- | | `session.update` | Update modalities, voice, or other session preferences. | | `input_audio_buffer.append` | Send encoded audio fragments. | | `input_audio_buffer.commit` | Mark the buffered audio as ready. | | `response.create` | Ask the server to begin generating a response. | | `conversation.item.create` | Add a conversation turn or tool result. | ### Core Server Events | Event Type | Description | | ---------------------- | ------------------------------------------------------- | | `session.created` | Initial confirmation that the websocket session exists. | | `session.updated` | Confirmation that session settings changed. | | `response.text.delta` | Incremental text output. | | `response.audio.delta` | Incremental audio output. | | `response.done` | Final event for a completed response. | | `error` | Recoverable or fatal error payload. | ### Integration Guidance 1. Buffer client-side audio in small chunks and use `input_audio_buffer.commit` to signal turn boundaries. 2. Listen for both `response.text.delta` and `response.audio.delta` if the session supports multimodal output. 3. Use the HTTP session token endpoint for browser clients so the long-lived API key never reaches the client. <ResponseExample> ```json response.text.delta theme={null} { "type": "response.text.delta", "response_id": "resp_123", "delta": "Hello" } ``` ```json response.done theme={null} { "type": "response.done", "response": { "id": "resp_123", "status": "completed" } } ``` </ResponseExample> # AI Gateway Source: https://docs.dgrid.ai/ai-gateway/overview DGrid AI Gateway provides one unified, OpenAI-compatible API to call 200+ leading AI models with crypto billing, routing, and global edge access. DGrid AI Gateway provides a single, unified API to access 200+ leading AI models. Users can directly plug their own API keys into tools like Claude Code, Codex, and Moltbot (Clawdbot), which dramatically reduces integration complexity and operational costs. ## Quickstart DGrid AI Gateway unifies the interfaces of hundreds of AI models. You don't need to handle compatibility adaptations for different models in your code—with a single API endpoint and a standardized API request format, you can freely switch and access all the hundreds of models provided by DGrid. <Tip> Looking for tool-specific guides (OpenClaw / Cursor / SDK / etc.)? See [Integration Tutorials](/ai-gateway/integrations). </Tip> <Tip> Looking for endpoint-level API reference? See [Model API](/api-reference/introduction). </Tip> <Tip> Want a free route that chooses available model capacity automatically? See [Free Models Router](/ai-gateway/free-models-router). </Tip> <Note> The DGrid official SDK is currently under active development—stay tuned for its release. Below are the available temporary request methods to interact with DGrid AI Gateway. </Note> ### Prerequisites Before getting started, you need to: 1. Obtain a valid `DGRID_API_KEY` ([Guide](https://blog.dgrid.ai/posts/2026-01-04/)). 2. Ensure your development environment has network access to `https://api.dgrid.ai/v1`. 3. For SDK usage, install the corresponding OpenAI SDK package in your project. ### Direct API Request via cURL You can send a direct HTTP POST request to the DGrid AI Gateway endpoint using cURL. ```bash theme={null} curl https://api.dgrid.ai/v1/chat/completions \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $DGRID_API_KEY" \ -d '{ "model": "openai/gpt-4o", "messages": [ { "role": "user", "content": "What is the meaning of life?" } ] }' ``` ### Using the OpenAI SDK (DGrid Compatible) DGrid AI Gateway is fully compatible with the OpenAI SDK specification. You only need to modify the `baseURL` (and fill in the `DGRID_API_KEY`) to quickly migrate or integrate. #### Prerequisite: Install the OpenAI SDK First, install the OpenAI SDK in your project: ```bash theme={null} # For TypeScript/Node.js npm install openai # For Python pip install openai ``` #### TypeScript Implementation ```typescript theme={null} import OpenAI from 'openai'; // Initialize the OpenAI client with DGrid AI Gateway configuration const openai = new OpenAI({ baseURL: 'https://api.dgrid.ai/v1', // Point to DGrid AI Gateway endpoint apiKey: '<DGRID_API_KEY>', // Replace with your valid DGrid API key defaultHeaders: { 'HTTP-Referer': '<YOUR_SITE_URL>', // Optional: Your application's site URL 'X-Title': '<YOUR_SITE_NAME>', // Optional: Your application's name }, }); // Async function to send chat completion request async function getChatCompletion() { const completion = await openai.chat.completions.create({ model: 'openai/gpt-4o', // Specify the target model (DGrid-supported form
프로젝트로 돌아가기