{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the response."
    },
    "model": {
      "type": "string",
      "description": "Specifies which model produced this response."
    },
    "choices": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "finish_reason": {
            "type": ["string", "null"],
            "enum": ["stop", "length", "tool_call", "function_call", "content_filter"],
            "description": "Reason for stopping the generation."
          },
          "message": {
            "type": "object",
            "properties": {
              "role": { "type": "string" },
              "content": { "type": ["string", "null"] },
              "tool_calls": {
                "type": ["array", "null"],
                "items": {
                  "type": "object",
                  "properties": {
                    "id": { "type": "string" },
                    "type": { "type": "string", "enum": ["function"] },
                    "function": {
                      "type": "object",
                      "properties": {
                        "name": { "type": "string" },
                        "arguments": { "type": "string" }
                      },
                      "required": ["name", "arguments"]
                    }
                  },
                  "required": ["id", "type", "function"]
                }
              }
            },
            "required": ["role", "content"]
          }
        },
        "required": ["finish_reason", "message"]
      }
    },
    "created": {
      "type": "integer",
      "description": "Unix timestamp when the response was created."
    },
    "usage": {
      "type": "object",
      "properties": {
        "prompt_tokens": { "type": "integer" },
        "completion_tokens": { "type": "integer" },
        "total_tokens": { "type": "integer" }
      },
      "required": ["prompt_tokens", "completion_tokens", "total_tokens"]
    }
  },
  "required": ["id", "model", "choices", "created", "usage"]
}
