DINGJIAI
DINGJIAI
Quick start in 5 minutesWhat is DINGJIAI?

Popular Agents

Codex SetupClaude Code SetupOne-Click Setup

API Reference

Chat Completions

Billing

Model pricingOpens in a new window
Protocol endpoints

Chat Completions

The OpenAI-compatible Chat Completions endpoint.

OpenAI-compatible endpoint

Chat Completions is suitable for existing OpenAI-compatible clients. It uses a Bearer user API Key and settles charges from the OpenAI usage fields.

Paths

PurposeMethod and path
Model requestPOST /v1/chat/completions
Compatible pathPOST /chat/completions
Model listGET /v1/models, GET /v1/models/, GET /models, GET /models/

Request example

POST /v1/chat/completions
curl https://dingjiai.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "A_MODEL_NAME_COPIED_FROM_THE_OPENAI_CHAT_MODEL_LIST",
    "messages": [
      { "role": "user", "content": "Introduce yourself in one sentence" }
    ]
  }'

Streaming

stream=true
curl -N https://dingjiai.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_USER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "A_MODEL_NAME_COPIED_FROM_THE_OPENAI_CHAT_MODEL_LIST",
    "stream": true,
    "messages": [
      { "role": "user", "content": "Explain the integration in three points" }
    ]
  }'

The gateway requires upstream usage data for a streaming Chat Completions request so the completed call can be settled.

Request fields

Prop

Type

Usage and billing

Settlement reads usage.prompt_tokens, usage.completion_tokens, and the optional usage.prompt_tokens_details.cached_tokens field from the response body.

Missing usage fails the request

DINGJIAI needs explicit usage data for settlement. If an upstream returns content without usage, the call is handled as usage_missing or usage_invalid.

Last updated on

Base URL and authenticationModel pricing

On this page

PathsRequest exampleStreamingRequest fieldsUsage and billing