Skip to content

Model API

The DGrid Model API consolidates DGrid's model-facing endpoints into a single reference section. It covers Gemini-compatible, OpenAI-compatible, Claude-compatible, and realtime interfaces so teams can choose the protocol that matches their application stack while keeping DGrid as the unified backend.

Looking for tool-specific onboarding instead of endpoint reference? See Integration Tutorials.

Quickstart

Use the OpenAI-compatible chat endpoint for the fastest first integration:

bash
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": "Hello from DGrid."
      }
    ]
  }'

Authentication Formats

OpenAI-Compatible

http
Authorization: Bearer <DGRID_API_KEY>
Content-Type: application/json

Use this format for Chat Completions, Responses, Completions, Embeddings, Images, Moderations, audio speech endpoints, and realtime session creation.

Claude-Compatible

http
Authorization: Bearer <DGRID_API_KEY>
anthropic-version: 2023-06-01
Content-Type: application/json

Use this format for the POST /v1/messages interface.

Gemini-Compatible

http
Authorization: Bearer <DGRID_API_KEY>
Content-Type: application/json

Use this format for generateContent and embedContent requests.

Endpoint Families

FamilyPrimary Base PathBest For
Audio/v1/audio/* and /v1/models/*:generateContentSpeech synthesis, transcription, translation, and multimodal audio understanding
Chat/v1/messages, /v1/chat/completions, /v1/responses, /v1/models/*:generateContentConversational apps, multimodal assistants, tool calling
Completions/v1/completionsPrompt-only text generation and legacy integrations
Embeddings/v1/embeddings, /v1/models/*:embedContentSearch, clustering, retrieval, ranking
Images/v1/images/*, /v1/chat/completions, /v1/models/*:generateContentImage generation and editing across multiple model formats
Moderations/v1/moderationsContent safety filtering and policy checks
Realtime/v1/realtime, /v1/realtime/sessionsLow-latency streaming conversations over websocket

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.