Bases: NexosAPIResponse
Response model for the Nexos.ai Chat Completions API.
Represents the server response body for chat completion requests. Fields mirror
the public API schema.
Attributes:
| Name |
Type |
Description |
id |
str
|
A unique identifier for the chat completion.
|
object |
str
|
The object type, always "chat.completion".
|
created |
int
|
The Unix timestamp (in seconds) of when the chat completion was created.
|
model |
str
|
The model used for the chat completion.
|
choices |
list[ChatChoice]
|
A list of chat completion choices (length corresponds to the request's n). Each choice includes: - index: The position of the choice in the list. - finish_reason: Why generation stopped. One of: "stop", "length", "content_filter", "tool_calls", or "function_call" (deprecated). - message: The assistant message generated by the model, with: - role: Always "assistant". - content: The message content (nullable). - refusal: A refusal message when applicable (nullable). - tool_calls: Tool calls generated by the model (e.g., functions), each with: - id: Tool call ID. - type: Currently "function". - function: The function call details: - name: Function name. - arguments: JSON string arguments (validate before execution). - function_call: Deprecated; replaced by tool_calls. - audio: Present when audio output was requested; contains: - id: Unique identifier for this audio response. - expires_at: Unix timestamp (seconds) when the audio response expires. - data: Base64-encoded audio bytes in the requested format. - transcript: Transcript of the generated audio. - annotations: When applicable (e.g., web search), contains URL citations: - type: Always "url_citation". - url_citation: The URL citation object. - logprobs: Log probability information for the choice, including: - content: List of message content tokens with log probabilities (nullable). - refusal: List of refusal tokens with log probabilities (nullable).
|
usage |
UsageInfo | None
|
Usage statistics for the request, including: - prompt_tokens, completion_tokens, total_tokens. - completion_tokens_details: - accepted_prediction_tokens: Tokens from prediction that appeared in the completion. - audio_tokens: Audio input tokens generated by the model. - reasoning_tokens: Tokens generated for reasoning. - rejected_prediction_tokens: Predicted tokens not appearing in the completion (still billed). - prompt_tokens_details: - audio_tokens: Audio input tokens present in the prompt. - cached_tokens: Cached tokens present in the prompt.
|
system_fingerprint |
str | None
|
Fingerprint of the backend configuration that served the request. Use alongside the request seed to monitor determinism across backend changes.
|
service_tier |
Literal['scale', 'default'] | None
|
The service tier used to process the request, included only when the request specified a service_tier. One of: "scale", "default". Notes ----- - object is always "chat.completion". - function_call is deprecated; prefer tool_calls within the assistant message.
|
tool_calls
property
Extracts and returns a list of tool calls from the chat response choices.
Each tool call is represented as a dictionary.