{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/compoid-com/json-schema/compoid-com-completion-request-schema.json",
  "title": "CompletionRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/compoid-com-openapi.yml#/components/schemas/CompletionRequest",
  "properties": {
    "model": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model"
    },
    "prompt": {
      "anyOf": [
        {
          "items": {
            "type": "integer",
            "minimum": 0.0
          },
          "type": "array"
        },
        {
          "items": {
            "items": {
              "type": "integer",
              "minimum": 0.0
            },
            "type": "array"
          },
          "type": "array"
        },
        {
          "type": "string"
        },
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Prompt"
    },
    "echo": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Echo",
      "default": false
    },
    "frequency_penalty": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Frequency Penalty"
    },
    "logit_bias": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "number"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Logit Bias"
    },
    "logprobs": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Logprobs"
    },
    "max_tokens": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Max Tokens",
      "default": 16
    },
    "n": {
      "type": "integer",
      "title": "N",
      "default": 1
    },
    "presence_penalty": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Presence Penalty"
    },
    "seed": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 9.223372036854776e+18,
          "minimum": -9.223372036854776e+18
        },
        {
          "type": "null"
        }
      ],
      "title": "Seed"
    },
    "stop": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {
            "type": "string"
          },
          "type": "array",
          "maxItems": 4
        },
        {
          "type": "null"
        }
      ],
      "title": "Stop",
      "default": []
    },
    "stream": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Stream",
      "default": false
    },
    "stream_options": {
      "anyOf": [
        {
          "$ref": "#/$defs/StreamOptions"
        },
        {
          "type": "null"
        }
      ]
    },
    "suffix": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Suffix"
    },
    "temperature": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Temperature"
    },
    "top_p": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Top P"
    },
    "user": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "User"
    },
    "use_beam_search": {
      "type": "boolean",
      "title": "Use Beam Search",
      "default": false
    },
    "top_k": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Top K"
    },
    "min_p": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Min P"
    },
    "repetition_penalty": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Repetition Penalty"
    },
    "watermarking": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Watermarking"
    },
    "length_penalty": {
      "type": "number",
      "title": "Length Penalty",
      "default": 1.0
    },
    "stop_token_ids": {
      "anyOf": [
        {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Stop Token Ids",
      "default": []
    },
    "include_stop_str_in_output": {
      "type": "boolean",
      "title": "Include Stop Str In Output",
      "default": false
    },
    "ignore_eos": {
      "type": "boolean",
      "title": "Ignore Eos",
      "default": false
    },
    "min_tokens": {
      "type": "integer",
      "title": "Min Tokens",
      "default": 0
    },
    "skip_special_tokens": {
      "type": "boolean",
      "title": "Skip Special Tokens",
      "default": true
    },
    "spaces_between_special_tokens": {
      "type": "boolean",
      "title": "Spaces Between Special Tokens",
      "default": true
    },
    "truncate_prompt_tokens": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 9.223372036854776e+18,
          "minimum": -1.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Truncate Prompt Tokens"
    },
    "truncation_side": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "left",
            "right"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Truncation Side",
      "description": "Which side to truncate from when truncate_prompt_tokens is active. 'right' keeps the first N tokens. 'left' keeps the last N tokens."
    },
    "allowed_token_ids": {
      "anyOf": [
        {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Allowed Token Ids"
    },
    "prompt_logprobs": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Prompt Logprobs"
    },
    "logprob_token_ids": {
      "anyOf": [
        {
          "items": {
            "type": "integer"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Logprob Token Ids",
      "description": "Specific vocab token IDs to return logprobs for at each generated position, in addition to the sampled token. More efficient than requesting the full vocab when only a small fixed label set is needed (e.g. multilabel scoring where each label corresponds to a known vocab id). When set, this explicit token selection takes precedence over the natural top-k selected by `logprobs`. Requires `logprobs` to be set."
    },
    "bad_words": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Bad Words"
    },
    "prompt_embeds": {
      "anyOf": [
        {
          "type": "string",
          "contentMediaType": "application/octet-stream"
        },
        {
          "items": {
            "type": "string",
            "contentMediaType": "application/octet-stream"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Prompt Embeds"
    },
    "add_special_tokens": {
      "type": "boolean",
      "title": "Add Special Tokens",
      "description": "If true (the default), special tokens (e.g. BOS) will be added to the prompt.",
      "default": true
    },
    "response_format": {
      "anyOf": [
        {
          "$ref": "#/$defs/ResponseFormat"
        },
        {
          "$ref": "#/$defs/StructuralTagResponseFormat"
        },
        {
          "$ref": "#/$defs/LegacyStructuralTagResponseFormat"
        },
        {
          "type": "null"
        }
      ],
      "title": "Response Format",
      "description": "Similar to chat completion, this parameter specifies the format of output. Only {'type': 'json_object'}, {'type': 'json_schema'}, {'type': 'structural_tag'}, or {'type': 'text' } is supported."
    },
    "structured_outputs": {
      "anyOf": [
        {
          "$ref": "#/$defs/StructuredOutputsParams"
        },
        {
          "type": "null"
        }
      ],
      "description": "Additional kwargs for structured outputs"
    },
    "priority": {
      "type": "integer",
      "maximum": 9.223372036854776e+18,
      "minimum": -9.223372036854776e+18,
      "title": "Priority",
      "description": "The priority of the request (lower means earlier handling; default: 0). Any priority other than 0 will raise an error if the served model does not use priority scheduling.",
      "default": 0
    },
    "request_id": {
      "type": "string",
      "title": "Request Id",
      "description": "The request_id related to this request. If the caller does not set it, a random_uuid will be generated. This id is used through out the inference process and return in response."
    },
    "session_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Session Id",
      "description": "Stable session identity shared by related requests. Unlike request_id, this value is expected to remain stable across multiple requests in the same conversation or agent session."
    },
    "return_tokens_as_token_ids": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Return Tokens As Token Ids",
      "description": "If specified with 'logprobs', tokens are represented  as strings of the form 'token_id:{token_id}' so that tokens that are not JSON-encodable can be identified."
    },
    "return_token_ids": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Return Token Ids",
      "description": "If specified, the result will include token IDs alongside the generated text. In streaming mode, prompt_token_ids is included only in the first chunk, and token_ids contains the delta tokens for each chunk. This is useful for debugging or when you need to map generated text back to input tokens."
    },
    "routed_experts_prompt_start": {
      "type": "integer",
      "minimum": 0.0,
      "title": "Routed Experts Prompt Start",
      "description": "Skip the first N prompt tokens from returned routed-expert data.",
      "default": 0
    },
    "return_token_offsets": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Return Token Offsets",
      "description": "If true, return char-level (start, end) offsets for each token relative to the tokenized source string in the `token_offsets` field of the rendered response. Only supported on the `/v1/completions/render` and `/v1/chat/completions/render` endpoints; ignored on regular generation endpoints. Honored only for Fast (Rust-backed) tokenizers; otherwise `token_offsets` is null. For chat requests, offsets are relative to the templated prompt string (after applying the chat template). Multimodal inputs and pre-tokenized inputs always yield null.",
      "default": false
    },
    "mm_payload": {
      "type": "string",
      "enum": [
        "tensors",
        "none"
      ],
      "title": "Mm Payload",
      "description": "What the render response's `features` carry for multimodal items. 'tensors' serializes the processed tensors into `kwargs_data` and `mm_metadata`. 'none' sets both to null for callers that need only the token layout and item hashes, such as cache-aware routers. Do not send a 'none' response to `/inference/v1/generate` which reads a null `kwargs_data` as every item being cached. Only supported on the render endpoints. Ignored on regular generation endpoints.",
      "default": "tensors"
    },
    "return_mm_kwargs": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Return Mm Kwargs",
      "description": "Deprecated alias: false is the same as `mm_payload='none'`. Ignored when `mm_payload` is set.",
      "deprecated": true
    },
    "cache_salt": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 1024,
          "minLength": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Cache Salt",
      "description": "If specified, the prefix cache will be salted with the provided string to prevent an attacker to guess prompts in multi-user environments. The salt should be random, protected from access by 3rd parties, and long enough to be unpredictable (e.g., 43 characters base64-encoded, corresponding to 256 bit)."
    },
    "kv_transfer_params": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Kv Transfer Params",
      "description": "KVTransfer parameters used for disaggregated serving."
    },
    "ec_transfer_params": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ec Transfer Params",
      "description": "ECTransfer parameters used for encoder-cache disaggregated serving."
    },
    "vllm_xargs": {
      "anyOf": [
        {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              },
              {
                "type": "number"
              },
              {
                "items": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "integer"
                    },
                    {
                      "type": "number"
                    }
                  ]
                },
                "type": "array"
              }
            ]
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Vllm Xargs",
      "description": "Additional request parameters with (list of) string or numeric values, used by custom extensions."
    },
    "repetition_detection": {
      "anyOf": [
        {
          "$ref": "#/$defs/RepetitionDetectionParams"
        },
        {
          "type": "null"
        }
      ],
      "description": "Parameters for detecting repetitive N-gram patterns in output tokens. If such repetition is detected, generation will be ended early. LLMs can sometimes generate repetitive, unhelpful token patterns, stopping only when they hit the maximum output length (e.g. 'abcdabcdabcd...' or '\\emoji \\emoji \\emoji ...'). This feature can detect such behavior and terminate early, saving time and tokens."
    },
    "thinking_token_budget": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Thinking Token Budget",
      "description": "Maximum number of tokens allowed for thinking operations (reasoning models). Non-negative integer sets the limit; -1 means unlimited (treated as unset)."
    },
    "stream_interval": {
      "anyOf": [
        {
          "type": "integer",
          "minimum": 1.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Stream Interval",
      "description": "Number of tokens to batch into each streamed chunk. Raises the server's `--stream-interval` for this request. Values below the server setting are clamped up to it. The first and last chunks are always sent immediately. Ignored for non-streaming requests."
    }
  },
  "additionalProperties": true,
  "type": "object",
  "$defs": {
    "JsonSchemaResponseFormat": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Description"
        },
        "schema": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Schema"
        },
        "strict": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Strict"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "name"
      ],
      "title": "JsonSchemaResponseFormat"
    },
    "LegacyStructuralTag": {
      "properties": {
        "begin": {
          "type": "string",
          "title": "Begin"
        },
        "schema": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Schema"
        },
        "end": {
          "type": "string",
          "title": "End"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "begin",
        "end"
      ],
      "title": "LegacyStructuralTag"
    },
    "LegacyStructuralTagResponseFormat": {
      "properties": {
        "type": {
          "type": "string",
          "const": "structural_tag",
          "title": "Type"
        },
        "structures": {
          "items": {
            "$ref": "#/$defs/LegacyStructuralTag"
          },
          "type": "array",
          "title": "Structures"
        },
        "triggers": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Triggers"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "type",
        "structures",
        "triggers"
      ],
      "title": "LegacyStructuralTagResponseFormat"
    },
    "RepetitionDetectionParams": {
      "properties": {
        "max_pattern_size": {
          "type": "integer",
          "title": "Max Pattern Size",
          "default": 0
        },
        "min_pattern_size": {
          "type": "integer",
          "title": "Min Pattern Size",
          "default": 0
        },
        "min_count": {
          "type": "integer",
          "title": "Min Count",
          "default": 0
        }
      },
      "type": "object",
      "title": "RepetitionDetectionParams",
      "description": "Parameters for detecting repetitive N-gram patterns in output tokens."
    },
    "ResponseFormat": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "text",
            "json_object",
            "json_schema"
          ],
          "title": "Type"
        },
        "json_schema": {
          "anyOf": [
            {
              "$ref": "#/$defs/JsonSchemaResponseFormat"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "type"
      ],
      "title": "ResponseFormat"
    },
    "StreamOptions": {
      "properties": {
        "include_usage": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Include Usage",
          "default": false
        },
        "continuous_usage_stats": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Continuous Usage Stats",
          "default": false
        }
      },
      "additionalProperties": true,
      "type": "object",
      "title": "StreamOptions"
    },
    "StructuralTagResponseFormat": {
      "properties": {
        "type": {
          "type": "string",
          "const": "structural_tag",
          "title": "Type"
        },
        "format": {
          "title": "Format"
        }
      },
      "additionalProperties": true,
      "type": "object",
      "required": [
        "type",
        "format"
      ],
      "title": "StructuralTagResponseFormat"
    },
    "StructuredOutputsParams": {
      "properties": {
        "json": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Json"
        },
        "regex": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Regex"
        },
        "choice": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Choice"
        },
        "grammar": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Grammar"
        },
        "json_object": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Json Object"
        },
        "disable_any_whitespace": {
          "type": "boolean",
          "title": "Disable Any Whitespace",
          "default": false
        },
        "disable_additional_properties": {
          "type": "boolean",
          "title": "Disable Additional Properties",
          "default": false
        },
        "whitespace_pattern": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Whitespace Pattern"
        },
        "structural_tag": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Structural Tag"
        },
        "_backend": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Backend"
        },
        "_backend_was_auto": {
          "type": "boolean",
          "title": "Backend Was Auto",
          "default": false
        }
      },
      "type": "object",
      "title": "StructuredOutputsParams"
    }
  }
}