{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://docs.mistral.ai/schemas/mistral/chat-completion.json", "title": "Mistral Chat Completion", "description": "A chat completion response generated by a Mistral language model, containing one or more message choices with token usage information.", "type": "object", "required": ["id", "object", "created", "model", "choices", "usage"], "properties": { "id": { "type": "string", "description": "Unique identifier for the chat completion" }, "object": { "type": "string", "enum": ["chat.completion"], "description": "Object type identifier" }, "created": { "type": "integer", "description": "Unix timestamp when the completion was created" }, "model": { "type": "string", "description": "The model used to generate the completion" }, "choices": { "type": "array", "description": "List of completion choices", "items": { "$ref": "#/$defs/Choice" } }, "usage": { "$ref": "#/$defs/Usage" } }, "$defs": { "Choice": { "type": "object", "description": "A single completion choice with a message and finish reason", "properties": { "index": { "type": "integer", "description": "Index of this choice in the list" }, "message": { "$ref": "#/$defs/Message" }, "finish_reason": { "type": "string", "enum": ["stop", "length", "tool_calls", "model_length"], "description": "Reason the model stopped generating tokens" } } }, "Message": { "type": "object", "description": "A message in the conversation", "required": ["role", "content"], "properties": { "role": { "type": "string", "enum": ["system", "user", "assistant", "tool"], "description": "The role of the message author" }, "content": { "type": "string", "description": "The text content of the message" }, "tool_calls": { "type": "array", "items": { "$ref": "#/$defs/ToolCall" }, "description": "Tool calls made by the assistant" }, "tool_call_id": { "type": "string", "description": "ID of the tool call this message responds to" } } }, "ToolCall": { "type": "object", "description": "A function call made by the model", "properties": { "id": { "type": "string", "description": "Unique identifier for the tool call" }, "type": { "type": "string", "enum": ["function"] }, "function": { "type": "object", "properties": { "name": { "type": "string", "description": "The function name" }, "arguments": { "type": "string", "description": "JSON-encoded function arguments" } } } } }, "Usage": { "type": "object", "description": "Token usage statistics for the completion", "properties": { "prompt_tokens": { "type": "integer", "minimum": 0, "description": "Number of tokens in the prompt" }, "completion_tokens": { "type": "integer", "minimum": 0, "description": "Number of tokens in the generated completion" }, "total_tokens": { "type": "integer", "minimum": 0, "description": "Total tokens consumed (prompt + completion)" } } } } }