APIQIKAPIQIK
Docs
Api

Object Definitions

Review the field structures of Message, Choice, Usage, Tool, and Tool Call objects.

This page describes common Chat Completions objects. Unused optional fields may be absent or null.

Message

FieldTypeDescription
rolestringMessage author role.
contentstring, array, or nullContent; may be empty during tool calling.
namestringOptional participant name; model-dependent.
tool_callsarrayAssistant-generated tool calls.
tool_call_idstringCall ID associated with a tool result.

Choice

FieldTypeDescription
indexintegerCandidate index in the array.
messageobjectComplete assistant message for non-streaming responses.
deltaobjectIncremental content for streaming responses.
finish_reasonstring or nullWhy generation stopped.

Common finish_reason values

ValueMeaningRecommended handling
stopCompleted normally or matched a stop condition.Display the result.
lengthReached an output or context limit.Warn of truncation; shorten input or continue if needed.
tool_callsThe model proposes tool calls.Inspect message.tool_calls and enter the tool-execution flow.
content_filterOutput stopped due to safety policy.Show a safe message without exposing internal policy details.
nullStreaming generation is still in progress.Continue reading chunks.

Usage

FieldTypeDescription
prompt_tokensintegerInput tokens used by the request.
completion_tokensintegerModel output tokens.
total_tokensintegerCombined input and output usage.

Function Tool

{
  "type": "function",
  "function": {
    "name": "get_current_weather",
    "description": "Get the current weather for a city",
    "parameters": {
      "type": "object",
      "properties": {
        "city": {"type": "string"},
        "unit": {
          "type": "string",
          "enum": ["celsius", "fahrenheit"]
        }
      },
      "required": ["city"],
      "additionalProperties": false
    }
  }
}

Tool Call

{
  "id": "call_weather_01",
  "type": "function",
  "function": {
    "name": "get_current_weather",
    "arguments": "{\"city\":\"Beijing\",\"unit\":\"celsius\"}"
  }
}

arguments is a JSON string, not a parsed object. Your application must parse and validate it and confirm the function name is allowlisted.