Public integration docs

Bring your own SDK.
Keep one DIT key.

DIT exposes multiple protocol-compatible gateway entries behind the same API key. Point your client at the base URL below, choose the protocol your app already speaks, and route traffic through a single buyer-side credential.

Base URL
https://api.dit.ai
Authentication
Bearer token on every request
1

Create a key

Sign in to /dashboard, mint a runtime API key, and copy the plain token immediately.

2

Discover models

Call /v1/models with the same bearer token to see the slugs and supported protocol surface.

3

Call the route you need

Use chat, responses, messages, or generateContent against the same base URL.

Quickstart

Use the same bearer token across discovery and inference. The gateway enforces auth and rate limiting before protocol routing.

Model discovery example

Request
curl https://api.dit.ai/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "object": "list",
  "data": [
    {
      "id": "gpt-5.4",
      "object": "model",
      "owned_by": "apiexchange",
      "status": "ready",
      "supported_protocols": [
        "openai_chat_completions",
        "openai_responses"
      ]
    },
    {
      "id": "claude-sonnet-4-6",
      "object": "model",
      "owned_by": "apiexchange",
      "status": "ready",
      "supported_protocols": [
        "openai_chat_completions",
        "openai_responses",
        "anthropic_messages"
      ]
    },
    {
      "id": "grok-imagine-video",
      "object": "model",
      "owned_by": "apiexchange",
      "status": "ready",
      "supported_protocols": [
        "xai_video_generations"
      ]
    }
  ],
  "request_id": "req_xxx"
}

Protocols

The following request examples mirror the protocol routes currently registered by the gateway.

OpenAI

Chat Completions

/v1/chat/completions

Default chat entry for OpenAI-compatible SDKs and most assistant-style traffic.

Use when your client already expects the classic messages array and optional streaming.
Request
curl https://api.dit.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5.4",
    "stream": false,
    "temperature": 0,
    "max_tokens": 64,
    "messages": [
      { "role": "user", "content": "Reply with exactly: v1-chat-ok" }
    ]
  }'
Response
{
  "id": "chatcmpl_xxx",
  "object": "chat.completion",
  "created": 1710000000,
  "model": "gpt-5.4",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "v1-chat-ok"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 4,
    "total_tokens": 16
  },
  "request_id": "req_xxx"
}
OpenAI

Responses

/v1/responses

Unified Responses-style interface for clients already using the newer OpenAI response schema.

The gateway normalizes this request format and forwards it through compatible model routes.
Request
curl https://api.dit.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5.4",
    "max_output_tokens": 64,
    "input": [
      {
        "role": "user",
        "content": [
          { "type": "input_text", "text": "Reply with exactly: v1-responses-ok" }
        ]
      }
    ]
  }'
Response
{
  "id": "resp_xxx",
  "object": "response",
  "created_at": 1710000000,
  "model": "gpt-5.4",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        { "type": "output_text", "text": "v1-responses-ok" }
      ]
    }
  ],
  "request_id": "req_xxx"
}
Anthropic

Messages

/v1/messages

Anthropic Messages-compatible entry for Claude-style message blocks.

Content blocks using `{ type: "text", text: ... }` are supported in the request body.
Request
curl https://api.dit.ai/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 64,
    "messages": [
      {
        "role": "user",
        "content": [
          { "type": "text", "text": "Reply with exactly: v1-anthropic-ok" }
        ]
      }
    ]
  }'
Response
{
  "id": "msg_xxx",
  "type": "message",
  "role": "assistant",
  "model": "claude-sonnet-4-6",
  "content": [
    { "type": "text", "text": "v1-anthropic-ok" }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 12,
    "output_tokens": 4
  },
  "request_id": "req_xxx"
}
xAI

Video Generations

/v1/videos/generations

xAI Grok Imagine-compatible asynchronous video generation route.

Start a request with JSON, then poll `/v1/videos/{request_id}` until the status is `done`, `failed`, or `expired`.
Request
REQUEST_ID=$(curl -s https://api.dit.ai/v1/videos/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "grok-imagine-video",
    "prompt": "A glowing crystal-powered rocket launching from the red dunes of Mars, cinematic, synchronized audio",
    "duration": 10,
    "aspect_ratio": "16:9",
    "resolution": "720p"
  }' | jq -r '.request_id')

curl https://api.dit.ai/v1/videos/$REQUEST_ID \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "status": "done",
  "video": {
    "url": "https://vidgen.x.ai/.../video.mp4",
    "duration": 10,
    "respect_moderation": true
  },
  "model": "grok-imagine-video"
}
Google

Generate Content (Text)

/v1beta/models/{model}:generateContent

Google Gemini-style content generation route exposed through the same DIT API key.

Replace `{model}` in the path with the model slug you want to call.
Request
curl https://api.dit.ai/v1beta/models/gemini-3.1-pro-preview:generateContent \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [
          { "text": "Reply with exactly: v1-google-ok" }
        ]
      }
    ],
    "generationConfig": {
      "temperature": 0,
      "maxOutputTokens": 64
    }
  }'
Response
{
  "candidates": [
    {
      "content": {
        "role": "model",
        "parts": [
          { "text": "v1-google-ok" }
        ]
      },
      "finishReason": "STOP"
    }
  ],
  "usageMetadata": {
    "promptTokenCount": 9,
    "candidatesTokenCount": 3,
    "totalTokenCount": 12
  },
  "request_id": "req_xxx"
}

Conventions

Shared rules across the gateway for instrumentation, retries, and debugging.

Request IDs

Every gateway response includes `x-request-id`. JSON responses also carry `request_id` in the payload.

Protocol gating

If a model route does not expose the protocol you called, expect a `protocol_unsupported` error.

Streaming

Available on protocol-compatible routes when the upstream path supports it.

Typical error shape

Response
{
  "error": {
    "code": "protocol_unsupported",
    "message": "Model <slug> does not support /v1/chat/completions"
  },
  "request_id": "req_xxx"
}