{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/parasail-ai/main/json-schema/parasail-chat-completion-schema.json",
  "title": "Parasail Chat Completion",
  "description": "A chat completion response returned by Parasail's OpenAI-compatible /v1/chat/completions endpoint.",
  "type": "object",
  "required": ["id", "object", "created", "model", "choices"],
  "properties": {
    "id": { "type": "string" },
    "object": { "type": "string", "const": "chat.completion" },
    "created": { "type": "integer" },
    "model": { "type": "string" },
    "choices": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["index", "message", "finish_reason"],
        "properties": {
          "index": { "type": "integer" },
          "message": {
            "type": "object",
            "required": ["role", "content"],
            "properties": {
              "role": { "type": "string", "enum": ["system", "user", "assistant", "tool"] },
              "content": {
                "oneOf": [
                  { "type": "string" },
                  { "type": "array", "items": { "type": "object" } }
                ]
              }
            }
          },
          "finish_reason": { "type": "string" }
        }
      }
    },
    "usage": {
      "type": "object",
      "properties": {
        "prompt_tokens": { "type": "integer" },
        "completion_tokens": { "type": "integer" },
        "total_tokens": { "type": "integer" }
      }
    }
  }
}
