{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/parallel-ai/json-schema/parallel-ai-chat-completion-schema.json",
  "title": "ChatCompletion",
  "description": "Chat completion response.",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/parallel-ai-chat-api-beta-api-openapi.yml#/components/schemas/ChatCompletion",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id",
      "description": "The id of the chat completion."
    },
    "choices": {
      "items": {
        "$ref": "#/$defs/Choice"
      },
      "type": "array",
      "title": "Choices"
    },
    "created": {
      "type": "integer",
      "title": "Created"
    },
    "model": {
      "type": "string",
      "title": "Model"
    },
    "object": {
      "type": "string",
      "const": "chat.completion",
      "title": "Object"
    },
    "moderation": {
      "anyOf": [
        {
          "$ref": "#/$defs/openai__types__chat__chat_completion__Moderation"
        },
        {
          "type": "null"
        }
      ]
    },
    "service_tier": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "auto",
            "default",
            "flex",
            "scale",
            "priority"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Service Tier"
    },
    "system_fingerprint": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "System Fingerprint"
    },
    "usage": {
      "anyOf": [
        {
          "$ref": "#/$defs/CompletionUsage"
        },
        {
          "type": "null"
        }
      ]
    },
    "basis": {
      "items": {
        "$ref": "#/$defs/FieldBasis"
      },
      "type": "array",
      "title": "Basis",
      "description": "Basis for the chat completion, including citations and reasoning supporting the output.",
      "default": []
    },
    "interaction_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Interaction Id",
      "description": "Identifier for this interaction. Pass as previous_interaction_id for follow-ups."
    }
  },
  "additionalProperties": true,
  "type": "object",
  "required": [
    "id",
    "choices",
    "created",
    "model",
    "object"
  ],
  "$defs": {
    "ChatCompletionTokenLogprob": {
      "additionalProperties": true,
      "properties": {
        "token": {
          "title": "Token",
          "type": "string"
        },
        "bytes": {
          "anyOf": [
            {
              "items": {
                "type": "integer"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Bytes"
        },
        "logprob": {
          "title": "Logprob",
          "type": "number"
        },
        "top_logprobs": {
          "items": {
            "$ref": "#/$defs/TopLogprob"
          },
          "title": "Top Logprobs",
          "type": "array"
        }
      },
      "required": [
        "token",
        "logprob",
        "top_logprobs"
      ],
      "title": "ChatCompletionTokenLogprob",
      "type": "object"
    },
    "Choice": {
      "additionalProperties": true,
      "properties": {
        "delta": {
          "$ref": "#/$defs/ChoiceDelta"
        },
        "finish_reason": {
          "anyOf": [
            {
              "enum": [
                "stop",
                "length",
                "tool_calls",
                "content_filter",
                "function_call"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Finish Reason"
        },
        "index": {
          "title": "Index",
          "type": "integer"
        },
        "logprobs": {
          "anyOf": [
            {
              "$ref": "#/$defs/ChoiceLogprobs"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        }
      },
      "required": [
        "delta",
        "index"
      ],
      "title": "Choice",
      "type": "object"
    },
    "ChoiceDelta": {
      "additionalProperties": true,
      "description": "A chat completion delta generated by streamed model responses.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Content"
        },
        "function_call": {
          "anyOf": [
            {
              "$ref": "#/$defs/ChoiceDeltaFunctionCall"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "refusal": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Refusal"
        },
        "role": {
          "anyOf": [
            {
              "enum": [
                "developer",
                "system",
                "user",
                "assistant",
                "tool"
              ],
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Role"
        },
        "tool_calls": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ChoiceDeltaToolCall"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Tool Calls"
        }
      },
      "title": "ChoiceDelta",
      "type": "object"
    },
    "ChoiceDeltaFunctionCall": {
      "additionalProperties": true,
      "description": "Deprecated and replaced by `tool_calls`.\n\nThe name and arguments of a function that should be called, as generated by the model.",
      "properties": {
        "arguments": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Arguments"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        }
      },
      "title": "ChoiceDeltaFunctionCall",
      "type": "object"
    },
    "ChoiceDeltaToolCall": {
      "additionalProperties": true,
      "properties": {
        "index": {
          "title": "Index",
          "type": "integer"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Id"
        },
        "function": {
          "anyOf": [
            {
              "$ref": "#/$defs/ChoiceDeltaToolCallFunction"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "type": {
          "anyOf": [
            {
              "const": "function",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Type"
        }
      },
      "required": [
        "index"
      ],
      "title": "ChoiceDeltaToolCall",
      "type": "object"
    },
    "ChoiceDeltaToolCallFunction": {
      "additionalProperties": true,
      "properties": {
        "arguments": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Arguments"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Name"
        }
      },
      "title": "ChoiceDeltaToolCallFunction",
      "type": "object"
    },
    "ChoiceLogprobs": {
      "additionalProperties": true,
      "description": "Log probability information for the choice.",
      "properties": {
        "content": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ChatCompletionTokenLogprob"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Content"
        },
        "refusal": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/ChatCompletionTokenLogprob"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Refusal"
        }
      },
      "title": "ChoiceLogprobs",
      "type": "object"
    },
    "Citation": {
      "description": "A citation for a task output.",
      "properties": {
        "title": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Title of the citation.",
          "title": "Title"
        },
        "url": {
          "description": "URL of the citation.",
          "title": "Url",
          "type": "string"
        },
        "excerpts": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Excerpts from the citation supporting the output. Only certain processors provide excerpts.",
          "title": "Excerpts"
        }
      },
      "required": [
        "url"
      ],
      "title": "Citation",
      "type": "object"
    },
    "CompletionTokensDetails": {
      "additionalProperties": true,
      "description": "Breakdown of tokens used in a completion.",
      "properties": {
        "accepted_prediction_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Accepted Prediction Tokens"
        },
        "audio_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Audio Tokens"
        },
        "reasoning_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Reasoning Tokens"
        },
        "rejected_prediction_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Rejected Prediction Tokens"
        }
      },
      "title": "CompletionTokensDetails",
      "type": "object"
    },
    "CompletionUsage": {
      "additionalProperties": true,
      "description": "Usage statistics for the completion request.",
      "properties": {
        "completion_tokens": {
          "title": "Completion Tokens",
          "type": "integer"
        },
        "prompt_tokens": {
          "title": "Prompt Tokens",
          "type": "integer"
        },
        "total_tokens": {
          "title": "Total Tokens",
          "type": "integer"
        },
        "completion_tokens_details": {
          "anyOf": [
            {
              "$ref": "#/$defs/CompletionTokensDetails"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        },
        "prompt_tokens_details": {
          "anyOf": [
            {
              "$ref": "#/$defs/PromptTokensDetails"
            },
            {
              "type": "null"
            }
          ],
          "default": null
        }
      },
      "required": [
        "completion_tokens",
        "prompt_tokens",
        "total_tokens"
      ],
      "title": "CompletionUsage",
      "type": "object"
    },
    "FieldBasis": {
      "description": "Citations and reasoning supporting one field of a task output.",
      "properties": {
        "field": {
          "description": "Name of the output field.",
          "title": "Field",
          "type": "string"
        },
        "citations": {
          "default": [],
          "description": "List of citations supporting the output field.",
          "items": {
            "$ref": "#/$defs/Citation"
          },
          "title": "Citations",
          "type": "array"
        },
        "reasoning": {
          "description": "Reasoning for the output field.",
          "title": "Reasoning",
          "type": "string"
        },
        "confidence": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Confidence level for the output field. Only certain processors provide confidence levels.",
          "title": "Confidence"
        }
      },
      "required": [
        "field",
        "reasoning"
      ],
      "title": "FieldBasis",
      "type": "object"
    },
    "ModerationInputModerationResults": {
      "additionalProperties": true,
      "description": "Successful moderation results for the request input or generated output.",
      "properties": {
        "model": {
          "title": "Model",
          "type": "string"
        },
        "results": {
          "items": {
            "$ref": "#/$defs/ModerationInputModerationResultsResult"
          },
          "title": "Results",
          "type": "array"
        },
        "type": {
          "const": "moderation_results",
          "title": "Type",
          "type": "string"
        }
      },
      "required": [
        "model",
        "results",
        "type"
      ],
      "title": "ModerationInputModerationResults",
      "type": "object"
    },
    "ModerationInputModerationResultsResult": {
      "additionalProperties": true,
      "description": "A moderation result produced for the response input or output.",
      "properties": {
        "categories": {
          "additionalProperties": {
            "type": "boolean"
          },
          "title": "Categories",
          "type": "object"
        },
        "category_applied_input_types": {
          "additionalProperties": {
            "items": {
              "enum": [
                "text",
                "image"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "title": "Category Applied Input Types",
          "type": "object"
        },
        "category_scores": {
          "additionalProperties": {
            "type": "number"
          },
          "title": "Category Scores",
          "type": "object"
        },
        "flagged": {
          "title": "Flagged",
          "type": "boolean"
        },
        "model": {
          "title": "Model",
          "type": "string"
        },
        "type": {
          "const": "moderation_result",
          "title": "Type",
          "type": "string"
        }
      },
      "required": [
        "categories",
        "category_applied_input_types",
        "category_scores",
        "flagged",
        "model",
        "type"
      ],
      "title": "ModerationInputModerationResultsResult",
      "type": "object"
    },
    "ModerationOutputModerationResults": {
      "additionalProperties": true,
      "description": "Successful moderation results for the request input or generated output.",
      "properties": {
        "model": {
          "title": "Model",
          "type": "string"
        },
        "results": {
          "items": {
            "$ref": "#/$defs/ModerationOutputModerationResultsResult"
          },
          "title": "Results",
          "type": "array"
        },
        "type": {
          "const": "moderation_results",
          "title": "Type",
          "type": "string"
        }
      },
      "required": [
        "model",
        "results",
        "type"
      ],
      "title": "ModerationOutputModerationResults",
      "type": "object"
    },
    "ModerationOutputModerationResultsResult": {
      "additionalProperties": true,
      "description": "A moderation result produced for the response input or output.",
      "properties": {
        "categories": {
          "additionalProperties": {
            "type": "boolean"
          },
          "title": "Categories",
          "type": "object"
        },
        "category_applied_input_types": {
          "additionalProperties": {
            "items": {
              "enum": [
                "text",
                "image"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "title": "Category Applied Input Types",
          "type": "object"
        },
        "category_scores": {
          "additionalProperties": {
            "type": "number"
          },
          "title": "Category Scores",
          "type": "object"
        },
        "flagged": {
          "title": "Flagged",
          "type": "boolean"
        },
        "model": {
          "title": "Model",
          "type": "string"
        },
        "type": {
          "const": "moderation_result",
          "title": "Type",
          "type": "string"
        }
      },
      "required": [
        "categories",
        "category_applied_input_types",
        "category_scores",
        "flagged",
        "model",
        "type"
      ],
      "title": "ModerationOutputModerationResultsResult",
      "type": "object"
    },
    "PromptTokensDetails": {
      "additionalProperties": true,
      "description": "Breakdown of tokens used in the prompt.",
      "properties": {
        "audio_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Audio Tokens"
        },
        "cached_tokens": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Cached Tokens"
        }
      },
      "title": "PromptTokensDetails",
      "type": "object"
    },
    "TopLogprob": {
      "additionalProperties": true,
      "properties": {
        "token": {
          "title": "Token",
          "type": "string"
        },
        "bytes": {
          "anyOf": [
            {
              "items": {
                "type": "integer"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Bytes"
        },
        "logprob": {
          "title": "Logprob",
          "type": "number"
        }
      },
      "required": [
        "token",
        "logprob"
      ],
      "title": "TopLogprob",
      "type": "object"
    },
    "openai__types__chat__chat_completion__Moderation": {
      "properties": {
        "input": {
          "anyOf": [
            {
              "$ref": "#/$defs/ModerationInputModerationResults"
            },
            {
              "$ref": "#/$defs/openai__types__chat__chat_completion__ModerationInputError"
            }
          ],
          "title": "Input"
        },
        "output": {
          "anyOf": [
            {
              "$ref": "#/$defs/ModerationOutputModerationResults"
            },
            {
              "$ref": "#/$defs/openai__types__chat__chat_completion__ModerationOutputError"
            }
          ],
          "title": "Output"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "input",
        "output"
      ],
      "title": "Moderation",
      "description": "Moderation results for the request input and generated output, if moderated\ncompletions were requested."
    },
    "openai__types__chat__chat_completion__ModerationInputError": {
      "properties": {
        "code": {
          "type": "string",
          "title": "Code"
        },
        "message": {
          "type": "string",
          "title": "Message"
        },
        "type": {
          "type": "string",
          "const": "error",
          "title": "Type"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "code",
        "message",
        "type"
      ],
      "title": "ModerationInputError",
      "description": "An error produced while attempting moderation."
    },
    "openai__types__chat__chat_completion__ModerationOutputError": {
      "properties": {
        "code": {
          "type": "string",
          "title": "Code"
        },
        "message": {
          "type": "string",
          "title": "Message"
        },
        "type": {
          "type": "string",
          "const": "error",
          "title": "Type"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "code",
        "message",
        "type"
      ],
      "title": "ModerationOutputError",
      "description": "An error produced while attempting moderation."
    }
  }
}