APIQIKAPIQIK
Docs
Api

Chat Completions

Request parameters, message structure, examples, and successful responses for POST /v1/chat/completions.

Given a list of messages, the model returns a chat completion. The endpoint supports non-streaming responses, streaming output, and tool calling when the selected model supports it.

POST /v1/chat/completions

Request headers

HeaderRequiredDescription
AuthorizationYesBearer YOUR_APIQIK_API_KEY
Content-TypeYesapplication/json

Request parameters

ParameterTypeRequiredDescription
modelstringYesModel ID, such as qwen-turbo or deepseek-chat.
messagesarrayYesChronologically ordered messages.
temperaturenumberNoSampling randomness; supported range depends on the model.
max_tokensintegerNoMaximum generated tokens, also subject to the context window.
streambooleanNoSet to true for incremental streaming output.
stopstring or arrayNoStop at specified text when supported by the model.
toolsarrayNoTool definitions available to the model.
tool_choicestring or objectNoControl whether and how tools are selected.
response_formatobjectNoRequest structured output such as JSON when supported.

Message fields

FieldTypeRequiredDescription
rolestringYesCommon values: system, user, assistant, tool.
contentstring or arrayRole-dependentText is usually a string; multimodal content depends on model support.
tool_callsarrayNoCalls the assistant proposes for application execution.
tool_call_idstringFor tool messagesID of the call that produced this result.

Request example

{
  "model": "qwen-turbo",
  "messages": [
    {
      "role": "system",
      "content": "You are a concise, reliable assistant."
    },
    {
      "role": "user",
      "content": "Explain intelligent API routing."
    }
  ],
  "temperature": 0.7,
  "max_tokens": 512,
  "stream": false
}

Successful response

{
  "id": "chatcmpl-apiqik-7f3a2c9e",
  "object": "chat.completion",
  "created": 1789987200,
  "model": "qwen-turbo",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Intelligent API routing automatically selects an appropriate inference path based on node health."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 27,
    "total_tokens": 51
  }
}

Response fields

FieldTypeDescription
idstringUnique generation identifier; retain it for diagnostics.
objectstringUsually chat.completion for non-streaming responses.
createdintegerCreation time as a Unix timestamp.
modelstringModel identifier for the response.
choicesarrayCandidate results; ordinary requests read the first item.
choices[].messageobjectAssistant message containing text or tool calls.
finish_reasonstring or nullStop reason, such as stop, length, or tool_calls.
usageobjectInput, output, and total token usage.