Service Interfaces

OpenAI Chat Completion Interface

Interface Function

Provides a conversation generation entry compatible with OpenAI v1/chat/completions, for multi-turn conversations, role setting, and context continuation.

Interface Format

Request type: POST

URL: http(s)://{IP}:{Port}/v1/chat/completions

For the IP and port, see Service Interface IP/Port and Configuration.

Request Parameters

ParameterTypeDescription
modelstringRequired; model name.
messagesarrayRequired; conversation message list.
streambooleanOptional; whether to use streaming output. The default value is false.
  • true: streaming;
  • false: non-streaming.

The sub-parameters of the messages parameter are described as follows:

ParameterTypeDescription
rolestringRequired; the roles are as follows:
  • system: system/rule prompt;
  • user: user input;
  • assistant: assistant output.
In a conversation, system is usually the highest-priority constraint, user is the question content, and assistant is the historical answer.
contentstring/array/nullUsually required; message content. It can be omitted only when role is assistant and tool_calls is a non-empty array, in which case the Coordinator fills it with null before forwarding. When null is explicitly passed, the Coordinator forwards it as-is for any role without validating its validity; whether it is supported depends on the backend engine.

Other OpenAI-compatible fields (such as max_tokens and temperature) are passed through to the backend inference engine. The common parameters are described as follows:

ParameterTypeDescription
max_tokensintegerMaximum number of generated tokens.
temperaturenumberSampling temperature. A higher temperature produces more random output (commonly 0 to 1). An excessively high temperature may cause unstable output.
top_pnumberNucleus sampling threshold (0 to 1). When used together with the temperature parameter, usually only one of them is used.
presence_penaltynumberTopic penalty that encourages introducing new content. The value range depends on the backend implementation.
frequency_penaltynumberFrequency penalty that reduces repeated content. The value range depends on the backend implementation.
stopstring/arrayStop word. Generation ends early when the stop word is matched.

Fields not supported by the backend inference engine are ignored or subject to degraded handling. The specific capabilities are subject to the actual model and backend version.

Usage Example

  • Streaming usage example:

    curl -N -X POST "http://{IP}:{Port}/v1/chat/completions" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer {API_KEY}" \
      -d '{
        "model": "qwen3",
        "messages": [
          { "role": "user", "content": "Hello there!" }
        ],
        "stream": true
      }'
  • Non-streaming usage example:

    curl -X POST "http://{IP}:{Port}/v1/chat/completions" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer {API_KEY}" \
      -d '{
        "model": "qwen3",
        "messages": [
          { "role": "system", "content": "You are a helpful assistant." },
          { "role": "user", "content": "Hi!" }
        ],
        "temperature": 0.7
      }'

Response Example

  • Streaming response example:

    data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","created":1765856304,"model":"qwen3","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","created":1765856304,"model":"qwen3","choices":[{"index":0,"delta":{"content":"Hey there! "},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","created":1765856304,"model":"qwen3","choices":[{"index":0,"delta":{"content":"Great to see you. "},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","created":1765856304,"model":"qwen3","choices":[{"index":0,"delta":{"content":"How can I help today?"},"finish_reason":null}]}
    
    data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","created":1765856304,"model":"qwen3","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
    
    data: [DONE]
  • Non-streaming response example:

    {
      "id": "chatcmpl-xxx",
      "object": "chat.completion",
      "created": 1765856304,
      "model": "qwen3",
      "choices": [
        {
          "index": 0,
          "message": { "role": "assistant", "content": "Hey there! Great to see you—how can I help today?" },
          "finish_reason": "stop"
        }
      ]
    }

Output Description

  • Streaming response parameter description:

    The streaming response is an SSE event stream. Each line starts with data:, and data: [DONE] indicates the end. The JSON structure after data: is as follows:

    ParameterTypeDescription
    idstringRequest ID.
    objectstringReturn object type: chat.completion.chunk.
    createdintegerCreation timestamp (seconds).
    modelstringModel name.
    choicesarrayIncremental result list.
    choices[].indexintegerSequence number.
    choices[].deltaobjectIncremental content.
    choices[].delta.rolestringOnly the first packet may return assistant.
    choices[].delta.contentstringGenerated incremental text.
    choices[].finish_reasonstring/nullEnd reason. It is null when not ended.
  • Non-streaming response parameter description:

    ParameterTypeDescription
    idstringRequest ID.
    objectstringReturn object type: chat.completion.
    createdintegerCreation timestamp (seconds).
    modelstringModel name.
    choicesarrayGenerated result list.
    choices[].indexintegerSequence number.
    choices[].messageobjectGenerated message.
    choices[].message.rolestringRole, fixed to assistant.
    choices[].message.contentstringGenerated content.
    choices[].finish_reasonstring/nullEnd reason, such as stop and length.

OpenAI Responses Interface

Interface Function

It provides a text generation entry point compatible with the OpenAI Responses API (/v1/responses) and is applicable to unified response-based generation scenarios.

Interface Format

Request type: POST

URL: http(s)://{IP}:{Port}/v1/responses

For the IP and ports, see Service Interface IP/Port and Configuration.

Request Parameters

ParameterTypeDescription
modelstringRequired; model name.
inputstring/arrayRequired; text or an array of Responses input items. The item type depends on the deployed backend engine.
streambooleanOptional; whether to use streaming output. The default value is false.
  • true: streaming;
  • false: non-streaming.
instructionsstringOptional; system instructions that the model needs to follow.
max_output_tokensintegerOptional; maximum number of output tokens to generate.

The request is forwarded by the Coordinator as-is to a backend engine that natively supports the Responses API. Currently, the Coordinator additionally supports extracting scheduling information from the plain text input, the text message array, and instructions for the existing PD, load, and KV affinity scheduling, and does not rewrite the original request into Chat Completions. Input items that are not of the message type are verified by the backend engine according to its native Responses schema.

Response format description: As a transparent proxy, the Coordinator returns the response content directly from the backend inference engine without secondary wrapping. The actual response format and optional fields depend on the inference engine version in the deployment environment. Before going live, you must confirm that the engine natively provides POST /v1/responses. Currently, this interface only adds the "create and infer" capability. It does not include GET /v1/responses/{id}, POST /v1/responses/{id}/cancel, or background task state storage. Plain text requests can participate in KV affinity scheduling. Non-text inputs such as images and tool calls are still forwarded as-is, but the KV prefix extraction logic added by this interface is not used. The response example below is in the OpenAI standard format and is for reference only.

Usage Example

  • Non-streaming usage example:

    curl -X POST "http://{IP}:{Port}/v1/responses" \\
      -H "Content-Type: application/json" \\
      -H "Authorization: Bearer {API_KEY}" \\
      -d '{
        "model": "qwen3",
        "input": "Hello there!"
      }'
  • Streaming usage example:

    curl -N -X POST "http://{IP}:{Port}/v1/responses" \\
      -H "Content-Type: application/json" \\
      -H "Authorization: Bearer {API_KEY}" \\
      -d '{
        "model": "qwen3",
        "input": "Hello there!",
        "stream": true
      }'

Response Example

{
  "id": "resp_xxx",
  "object": "response",
  "created_at": 1765856304,
  "status": "completed",
  "model": "qwen3",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Hello there!"
        }
      ]
    }
  ]
}

Output Description

  • Non-streaming response parameter description:

    ParameterTypeDescription
    idstringRequest ID.
    objectstringReturn object type: response.
    created_atintegerCreation timestamp (seconds).
    statusstringResponse status, such as completed.
    modelstringModel name.
    outputarrayList of output content.
    output[].typestringOutput type, such as message.
    output[].rolestringOutput role, usually assistant.
    output[].contentarrayList of output content fragments.
    output[].content[].typestringContent type, such as output_text.
    output[].content[].textstringGenerated text.

OpenAI Completion Interface

Interface Function

OpenAI Completion-compatible interface that supports text completion and result sampling.

Interface Format

Request type: POST

URL: http(s)://{IP}:{Port}/v1/completions

For the IP and port, see Service Interface IP/Port and Configuration

Request Parameters

ParameterTypeDescription
modelstringRequired; model name.
promptstring/arrayRequired; prompt.
streambooleanOptional; whether to use streaming output. The default value is false.
  • true: streaming;
  • false: non-streaming.

Other OpenAI-compatible fields (such as max_tokens and temperature) are passed through to the backend inference engine. For descriptions of common fields, see the preceding section. If the backend does not support some fields, they are ignored or subject to degraded handling.

Usage Example

  • Streaming usage example:

    curl -N -X POST "http://{IP}:{Port}/v1/completions" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer {API_KEY}" \
      -d '{
        "model": "qwen3",
        "prompt": "Hello!",
        "stream": true
      }'
  • Non-streaming usage example:

    curl -X POST "http://{IP}:{Port}/v1/completions" \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer {API_KEY}" \
      -d '{
        "model": "qwen3",
        "prompt": "Hi!",
        "max_tokens": 64,
        "temperature": 0.7
      }'

Response Example

  • Streaming response example:

    data: {"id":"cmpl-xxx-0","object":"text_completion","created":1765856304,"model":"qwen3","choices":[{"index":0,"text":"Hey there! ","finish_reason":null}]}
    
    data: {"id":"cmpl-xxx-0","object":"text_completion","created":1765856304,"model":"qwen3","choices":[{"index":0,"text":"Lovely to hear from you—","finish_reason":null}]}
    
    data: {"id":"cmpl-xxx-0","object":"text_completion","created":1765856304,"model":"qwen3","choices":[{"index":0,"text":"what would you like to do today?","finish_reason":null}]}
    
    data: {"id":"cmpl-xxx-0","object":"text_completion","created":1765856304,"model":"qwen3","choices":[{"index":0,"text":"","finish_reason":"stop"}]}
    
    data: [DONE]
  • Non-streaming response example:

    {
      "id": "cmpl-xxx-0",
      "object": "text_completion",
      "created": 1765856304,
      "model": "qwen3",
      "choices": [
        { "index": 0, "text": "Hey there! Lovely to hear from you—what would you like to do today?", "finish_reason": "stop" }
      ]
    }

Output Description

  • Streaming response parameter description:

    The streaming response is an SSE event stream. Each line starts with data:, and data: [DONE] indicates the end. The JSON structure after data: is as follows:

    ParameterTypeDescription
    idstringRequest ID.
    objectstringReturn object type: text_completion.
    createdintegerCreation timestamp (seconds).
    modelstringModel name.
    choicesarrayIncremental result list.
    choices[].indexintegerSequence number.
    choices[].textstringGenerated incremental text.
    choices[].finish_reasonstring/nullEnd reason. It is null when not finished.
  • Non-streaming response parameter description:

    ParameterTypeDescription
    idstringRequest ID.
    objectstringReturn object type: text_completion.
    createdintegerCreation timestamp (seconds).
    modelstringModel name.
    choicesarrayGenerated result list.
    choices[].indexintegerSequence number.
    choices[].textstringGenerated text.
    choices[].finish_reasonstring/nullEnd reason, such as stop and length.

Anthropic Messages Interface

Interface Function

It provides a dialogue generation entry point compatible with the Anthropic Messages API and supports multimodal image input, tool calls, and thinking content blocks. The request is transparently forwarded by the Coordinator to the vLLM backend engine, and vLLM handles the complete Anthropic protocol. It is available only in vLLM backend mode.

Interface Format

Request type: POST

URL: http(s)://{IP}:{Port}/v1/messages

For the IP and port, see Service Interface IP/Port and Configuration

Request Parameters

ParameterTypeDescription
modelstringRequired; model name.
messagesarrayRequired; list of dialogue messages. Each message contains role (user or assistant) and content (a string or an array of content blocks).
max_tokensintegerRequired; maximum number of generated tokens.
streambooleanOptional; whether to use streaming output (SSE). The default value is false.
systemstring/arrayOptional; system prompt, supporting a string or an array of content blocks.
stop_sequencesarrayOptional; list of stop sequences.
temperaturenumberOptional; sampling temperature (0 to 1).
top_pnumberOptional; nucleus sampling threshold.
top_kintegerOptional; top-k sampling parameter.
toolsarrayOptional; list of tool definitions. Each tool contains name, description, and input_schema.
tool_choiceobjectOptional; tool selection policy. The value of type can be auto, any, tool, or none.

Usage Example

  • Basic text dialogue (non-streaming):

    curl -X POST "http://{IP}:{Port}/v1/messages" \
      -H "Content-Type: application/json" \
      -H "x-api-key: {API_KEY}" \
      -d '{
        "model": "qwen3-8b",
        "messages": [
          { "role": "user", "content": "Hello!" }
        ],
        "max_tokens": 100
      }'
  • Streaming conversation:

    curl -N -X POST "http://{IP}:{Port}/v1/messages" \
      -H "Content-Type: application/json" \
      -H "x-api-key: {API_KEY}" \
      -d '{
        "model": "qwen3-8b",
        "messages": [
          { "role": "user", "content": "Explain quantum computing in simple terms." }
        ],
        "max_tokens": 200,
        "stream": true
      }'
  • With system prompt:

    curl -X POST "http://{IP}:{Port}/v1/messages" \
      -H "Content-Type: application/json" \
      -H "x-api-key: {API_KEY}" \
      -d '{
        "model": "qwen3-8b",
        "messages": [
          { "role": "user", "content": "What is the weather?" }
        ],
        "max_tokens": 100,
        "system": "You are a helpful weather assistant."
      }'
  • With tool call:

    curl -X POST "http://{IP}:{Port}/v1/messages" \
      -H "Content-Type: application/json" \
      -H "x-api-key: {API_KEY}" \
      -d '{
        "model": "qwen3-8b",
        "messages": [
          { "role": "user", "content": "What is the weather in Beijing?" }
        ],
        "max_tokens": 100,
        "tools": [
          { "name": "get_weather", "description": "Get current weather", "input_schema": { "type": "object" } }
        ],
        "tool_choice": { "type": "auto" }
      }'

Response Example

  • Non-streaming response example:

    {
      "id": "msg_xxx",
      "type": "message",
      "role": "assistant",
      "content": [
        { "type": "text", "text": "Hello! How can I help you today?" }
      ],
      "model": "qwen3-8b",
      "stop_reason": "end_turn",
      "usage": {
        "input_tokens": 10,
        "output_tokens": 8
      }
    }
  • Streaming response example (SSE event stream):

    event: message_start
    data: {"type":"message_start","message":{"id":"msg_xxx","type":"message","role":"assistant","content":[],"model":"qwen3-8b","usage":{"input_tokens":10}}}
    
    event: content_block_start
    data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
    
    event: content_block_delta
    data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello! "}}
    
    event: content_block_delta
    data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"How can I help?"}}
    
    event: content_block_stop
    data: {"type":"content_block_stop","index":0}
    
    event: message_delta
    data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":8}}
    
    event: message_stop
    data: {"type":"message_stop"}
    
    data: [DONE]

Output Description

  • Non-streaming response parameter description:

    ParameterTypeDescription
    idstringRequest ID.
    typestringReturn object type: message.
    rolestringRole, fixed to assistant.
    contentarrayList of content blocks.
    content[].typestringContent block type: text, tool_use, thinking, etc.
    content[].textstringText content (when type is text).
    modelstringModel name.
    stop_reasonstringEnd reason: end_turn (normal end), max_tokens (limit reached), tool_use (tool call).
    usageobjectToken statistics, including input_tokens and output_tokens.
  • Streaming response event type description:

    Event TypeDescription
    message_startMessage start, including metadata and initial usage.
    content_block_startContent block start, marking a new text / tool_use / thinking block.
    content_block_deltaContent block increment, carrying text_delta, input_json_delta, thinking_delta, etc.
    content_block_stopContent block end.
    message_deltaMessage increment, including stop_reason and final usage.
    message_stopMessage end.

Anthropic Count Tokens Interface

Interface Function

Provides a token counting entry point compatible with the Anthropic messages/count_tokens API, used to estimate the token consumption of input messages. The request is transparently forwarded by the Coordinator to the vLLM backend engine. It is available only in vLLM backend mode.

Interface Format

Request type: POST

URL: http(s)://{IP}:{Port}/v1/messages/count_tokens

For the IP and port, see Service Interface IP/Port and Configuration

Request Parameters

ParameterTypeDescription
modelstringRequired; model name.
messagesarrayRequired; message list, in the same format as /v1/messages.
systemstring/arrayOptional; system prompt.
toolsarrayOptional; tool definitions.
tool_choiceobjectOptional; tool selection policy.

Usage Example

curl -X POST "http://{IP}:{Port}/v1/messages/count_tokens" \
  -H "Content-Type: application/json" \
  -H "x-api-key: {API_KEY}" \
  -d '{
    "model": "qwen3-8b",
    "messages": [
      { "role": "user", "content": "Hello!" }
    ]
  }'

Response Example

{
  "input_tokens": 10,
  "context_management": {
    "original_input_tokens": 10
  }
}

Output Description

ParameterTypeDescription
input_tokensintegerNumber of input tokens.
context_managementobjectContext management information.
context_management.original_input_tokensintegerNumber of original input tokens.

Model List Query Interface

Interface Function

Returns the current AIGW model configuration and instance quantity information.

Interface Format

Request type: GET

URL: http(s)://{IP}:{Port}/v1/models

For the IP and port, see Service Interface IP/Port and Configuration

Request Parameters

None

Usage Example

curl -X GET "http://{IP}:{Port}/v1/models"

Response Example

{
  "object": "list",
  "data": [
    {
      "id": "qwen3",
      "object": "model",
      "owned_by": "motor",
      "p_max_seqlen": 8192,
      "d_max_seqlen": 8192,
      "slo_ttft": 1000,
      "slo_tpot": 50,
      "p_instances_num": 2,
      "d_instances_num": 2,
      "created": 1765856000
    }
  ]
}

Output Description

ParameterTypeDescription
objectstringReturn object type: list.
dataarrayModel list.
data[].idstringModel name.
data[].objectstringReturn object type.
data[].owned_bystringModel ownership.
data[].p_max_seqlenintegerMaximum sequence length of the P instance.
data[].d_max_seqlenintegerMaximum sequence length of the D instance.
data[].slo_ttftintegerSLO time to first token (TTFT, in milliseconds).
data[].slo_tpotintegerSLO time per output token (TPOT, in milliseconds).
data[].p_instances_numintegerNumber of P instances.
data[].d_instances_numintegerNumber of D instances.
data[].createdintegerCreation timestamp (seconds).