Conversations

Chat Completions API Objects

Type definitions for every object the Chat Completions API emits — ChatCompletion, ChatCompletionChunk, ChatMessage, ContentFilterResults, PromptFilterResults, ChatCompletionUsage.

This page defines every named object returned by POST /v1/chat/completions. Reference these from guides and other docs using anchor links, for example:

"Returns a ChatCompletion object."


The ChatCompletion Object

The top-level response object returned by a non-streaming POST /v1/chat/completions call.

interface ChatCompletion {
  id:                    string;
  object:                "chat.completion";
  created:               number;                    // Unix timestamp
  model:                 string;
  system_fingerprint:    string | null;
  choices:               ChatCompletionChoice[];
  prompt_filter_results: PromptFilterResults[];     // Skytells safety field
  usage:                 ChatCompletionUsage;
}

interface ChatCompletionChoice {
  index:                 number;
  message:               ChatMessage;
  finish_reason:         "stop" | "length" | "tool_calls" | "content_filter";
  logprobs:              ChatCompletionLogprobs | null;
  content_filter_results: ContentFilterResults;     // Skytells safety field
}
FieldTypeDescription
idstringUnique completion ID, prefixed chatcmpl-
object"chat.completion"Object type discriminator
creatednumberUnix timestamp when the completion was created
modelstringThe resolved model identifier (may differ from requested namespace after routing)
system_fingerprintstring | nullServer fingerprint — useful for reproducibility debugging
choicesChatCompletionChoice[]One entry per n. Normally one element unless you set n > 1
choices[].messageChatMessageThe model's response message
choices[].finish_reasonstringWhy generation stopped. See values below
choices[].content_filter_resultsContentFilterResultsPer-choice safety evaluation of the completion
prompt_filter_resultsPromptFilterResults[]Safety evaluation of the input prompt — one entry per prompt
usageChatCompletionUsageToken counts

finish_reason values:

ValueMeaning
"stop"Natural end — the model produced a stop token or reached a stop sequence
"length"Reached max_tokens limit before a natural stop
"tool_calls"The model is requesting one or more tool calls
"content_filter"Output was blocked by a safety filter

The ChatCompletionChunk Object

One SSE frame emitted during a streaming POST /v1/chat/completions call (stream: true). The stream begins with a chunk containing an empty delta and prompt_filter_results, then emits content deltas, and ends with a chunk where finish_reason: "stop" and delta: {}.

interface ChatCompletionChunk {
  id:                    string;
  object:                "chat.completion.chunk";
  created:               number;
  model:                 string;
  system_fingerprint:    string | null;
  choices:               ChatCompletionChunkChoice[];
  prompt_filter_results?: PromptFilterResults[];    // present on the first chunk only
  usage:                 null;                      // always null mid-stream
}

interface ChatCompletionChunkChoice {
  index:                  number;
  delta:                  ChatCompletionDelta;
  finish_reason:          "stop" | "length" | "tool_calls" | "content_filter" | null;
  logprobs:               null;
  content_filter_results: ContentFilterResults;
}

interface ChatCompletionDelta {
  role?:       "assistant";
  content?:    string;           // the incremental text chunk
  tool_calls?: ToolCallDelta[];
  refusal?:    string | null;
}
FieldTypeDescription
idstringSame chatcmpl- ID across all chunks in the stream
object"chat.completion.chunk"Type discriminator
choices[].delta.contentstring | undefinedThe incremental text token(s). Concatenate these to reconstruct the full response
choices[].delta.tool_callsToolCallDelta[] | undefinedIncremental tool call fragments
choices[].finish_reasonstring | nullnull mid-stream; set to a terminal value on the last chunk
choices[].content_filter_resultsContentFilterResultsSafety evaluation of this delta
prompt_filter_resultsPromptFilterResults[]Only present on the first chunk

The ChatMessage Object

A single message in the conversation — returned as choices[].message in a ChatCompletion.

interface ChatMessage {
  role:        "assistant";
  content:     string | null;
  refusal:     string | null;
  annotations: Annotation[];
  tool_calls?: ToolCall[];
}

interface ToolCall {
  id:       string;
  type:     "function";
  function: {
    name:      string;
    arguments: string;  // JSON string — parse with JSON.parse()
  };
}
FieldTypeDescription
role"assistant"Always "assistant" for model responses
contentstring | nullThe full text response. null when the model made a tool call instead
refusalstring | nullIf the model declined the request, this contains the refusal message; otherwise null
annotationsAnnotation[]Structured annotation metadata (citations, links) — may be empty
tool_callsToolCall[] | undefinedPresent when finish_reason is "tool_calls". Each entry has the function name and JSON-encoded arguments

The ContentFilterResults Object

Skytells safety evaluation attached to each choices[] entry. Reports whether the completion text was evaluated against each category.

interface ContentFilterResults {
  hate:                    ContentFilterCategory;
  self_harm:               ContentFilterCategory;
  sexual:                  ContentFilterCategory;
  violence:                ContentFilterCategory;
  protected_material_code: ContentFilterDetection;
  protected_material_text: ContentFilterDetection;
}

interface ContentFilterCategory {
  filtered:  boolean;    // true = content was blocked
  severity:  "safe" | "low" | "medium" | "high";
}

interface ContentFilterDetection {
  detected:  boolean;    // true = category was detected
  filtered:  boolean;    // true = was blocked
}
FieldTypeDescription
hateContentFilterCategoryHateful, demeaning, or discriminatory content
self_harmContentFilterCategoryContent related to self-harm or suicide
sexualContentFilterCategorySexually explicit content
violenceContentFilterCategoryGraphic or incitement-to-violence content
protected_material_codeContentFilterDetectionCopyrighted code patterns detected
protected_material_textContentFilterDetectionCopyrighted text patterns detected

A filtered: true result means the request was blocked. A severity: "safe" result with filtered: false means the category was evaluated and found safe.


The PromptFilterResults Object

Skytells safety evaluation of the input prompt — returned in prompt_filter_results[] on the ChatCompletion object and in the first streaming chunk.

interface PromptFilterResults {
  prompt_index:           number;
  content_filter_results: PromptContentFilterResults;
}

interface PromptContentFilterResults {
  hate:      ContentFilterCategory;
  self_harm: ContentFilterCategory;
  sexual:    ContentFilterCategory;
  violence:  ContentFilterCategory;
  jailbreak: ContentFilterDetection;   // only on prompt evaluation
}
FieldTypeDescription
prompt_indexnumberIndex of the evaluated prompt (always 0 for single-prompt requests)
content_filter_results.hateContentFilterCategoryHate speech in the input
content_filter_results.self_harmContentFilterCategorySelf-harm content in the input
content_filter_results.sexualContentFilterCategorySexual content in the input
content_filter_results.violenceContentFilterCategoryViolence content in the input
content_filter_results.jailbreakContentFilterDetectionWhether a jailbreak attempt was detected in the prompt

The ChatCompletionUsage Object

Token consumption breakdown for a completion.

interface ChatCompletionUsage {
  prompt_tokens:     number;
  completion_tokens: number;
  total_tokens:      number;
  completion_tokens_details: {
    reasoning_tokens:            number;
    audio_tokens:                number;
    accepted_prediction_tokens:  number;
    rejected_prediction_tokens:  number;
  };
  prompt_tokens_details: {
    cached_tokens: number;
    audio_tokens:  number;
  };
}
FieldTypeDescription
prompt_tokensnumberTokens in the input messages
completion_tokensnumberTokens generated by the model
total_tokensnumberSum of prompt_tokens + completion_tokens
completion_tokens_details.reasoning_tokensnumberTokens used for internal chain-of-thought reasoning (reasoning models only)
completion_tokens_details.accepted_prediction_tokensnumberSpeculative decoding: accepted tokens
prompt_tokens_details.cached_tokensnumberTokens served from the prompt cache (not re-processed)

How is this guide?

On this page