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 text, multimodal, and music 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, music, 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"
      ]
    },
    {
      "id": "suno-v6-wild",
      "object": "model",
      "owned_by": "apiexchange",
      "status": "ready",
      "supported_protocols": [
        "music_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"
}
Suno

Music Generations

/v1/music/generations

Provider-neutral asynchronous music generation for Suno models, with one route for submission and status polling.

Suno models do not support `/v1/chat/completions`. Submit JSON here, save the JSON `request_id`, then poll `/v1/music/generations/{request_id}` every 10–20 seconds until the status is `done`, `failed`, or `expired`.
Request
MUSIC_REQUEST_ID=$(curl -sS https://api.dit.ai/v1/music/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "suno-v6-wild",
    "prompt": "A luminous synthwave anthem for a midnight drive",
    "style": "synthwave, energetic, female vocal",
    "title": "Neon Horizon",
    "instrumental": false
  }' | jq -r '.request_id')

curl https://api.dit.ai/v1/music/generations/$MUSIC_REQUEST_ID \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "id": "1305183664787431425",
  "request_id": "1305183664787431425",
  "object": "music.generation",
  "model": "suno-v6-wild",
  "status": "done",
  "outputs": [
    {
      "id": "2d6b301a-517d-4430-824e-60088fc0b76d",
      "status": "done",
      "title": "Neon Horizon",
      "duration": 197.88,
      "progress": 100,
      "audio_url": "https://example.com/generated-song.m4a",
      "error": null
    }
  ],
  "billing": {
    "actual_cost": 0.06,
    "currency": "USD"
  }
}
Suno

YunApi-compatible Suno

/_open/suno/music/generate

Drop-in compatibility for YunApi's native Suno request and response fields.

This is a YunApi-compatible protocol, not an official Suno API contract. Save `data.taskBatchId`, then poll `/_open/suno/music/getState?taskBatchId=...`. Supported `mv` values are `chirp-v6`, `chirp-v6-wild`, and `chirp-v6-mini`.
Request
TASK_BATCH_ID=$(curl -sS https://api.dit.ai/_open/suno/music/generate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "inputType": 10,
    "gptDescriptionPrompt": "A warm ambient piano instrumental",
    "tags": "warm piano, ambient, relaxing",
    "title": "Quiet Morning",
    "mv": "chirp-v6-mini",
    "makeInstrumental": true
  }' | jq -r '.data.taskBatchId')

curl "https://api.dit.ai/_open/suno/music/getState?taskBatchId=$TASK_BATCH_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "code": 200,
  "msg": "99",
  "data": {
    "taskBatchId": "1305183664787431425",
    "taskStatus": "finished",
    "items": [
      {
        "clipId": "2d6b301a-517d-4430-824e-60088fc0b76d",
        "status": 30,
        "title": "Quiet Morning",
        "progress": 100,
        "cld2AudioUrl": "https://example.com/generated-song.m4a",
        "cld2ImageUrl": "https://example.com/generated-cover.jpg"
      }
    ]
  }
}
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.

Asynchronous generation

Music submissions return a task `request_id`. Poll the matching status route until the task reaches `done`, `failed`, or `expired`.

Streaming

Text routes can stream when the upstream path supports it. Music generation currently rejects `stream: true`.

Typical error shape

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