GET

/v1/schemas/moonshot/chat/v1%2Fchat%2Fcompletions

kind inputactivity chathash 858b752c…extracted Nov 13, 2026version currentsource upstream spec ↗

Request body

0 properties · 0 required · 0 $defs

This schema isn’t a plain object with properties — showing the raw JSON instead.

application/json
{
  "provider": "moonshot",
  "activity": "chat",
  "endpointId": "v1/chat/completions",
  "kind": "input",
  "contentHash": "858b752c4bb7e650eebad0517b2b756206425c685edd6d3b7a04e0f4adbc219b",
  "specRevision": null,
  "provenance": {
    "sourceUrl": "https://platform.kimi.ai/docs/openapi.json",
    "sourceHash": "4c3f6ccf18b80965abeaec0995adb63c2175ff3bc39d3110370ff74cecf192ce",
    "fetchedAt": 1794546644,
    "extractorVersion": "2",
    "derivation": "upstream-spec",
    "verifiedAt": null
  },
  "createdAt": 1794546644,
  "supersededAt": null,
  "schema": {
    "oneOf": [
      {
        "$ref": "#/$defs/KimiK31ProChatRequest"
      },
      {
        "$ref": "#/$defs/KimiK3ChatRequest"
      },
      {
        "$ref": "#/$defs/KimiK27CodeChatRequest"
      },
      {
        "$ref": "#/$defs/KimiK26ChatRequest"
      }
    ],
    "discriminator": {
      "propertyName": "model",
      "mapping": {
        "kimi-k3.1-pro": "#/components/schemas/KimiK31ProChatRequest",
        "kimi-k3.1-pro-highspeed": "#/components/schemas/KimiK31ProChatRequest",
        "kimi-k3": "#/components/schemas/KimiK3ChatRequest",
        "kimi-k2.7-code": "#/components/schemas/KimiK27CodeChatRequest",
        "kimi-k2.7-code-highspeed": "#/components/schemas/KimiK27CodeChatRequest",
        "kimi-k2.6": "#/components/schemas/KimiK26ChatRequest"
      }
    },
    "$defs": {
      "ChatRequestBase": {
        "type": "object",
        "properties": {
          "logprobs": {
            "type": "boolean",
            "default": false,
            "description": "Whether to return log probabilities of the output tokens. If true, the log probability of each output token is returned in the logprobs field of the response message."
          },
          "top_logprobs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "description": "An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true when this parameter is used."
          },
          "prediction": {
            "type": "object",
            "description": "Configuration for a Predicted Output, which can greatly improve response times when large parts of the model response are known ahead of time (for example, regenerating a file with only minor changes).",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "content"
                ],
                "description": "The type of the predicted content. Currently only content is supported."
              },
              "content": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                ],
                "description": "The static predicted output content that should be matched when generating the model response, such as the content of a text file being regenerated. Accepts a string or an array of content parts (text parts only)."
              }
            }
          },
          "messages": {
            "type": "array",
            "description": "A list of messages in the conversation so far. Each element has the format {\"role\": \"user\", \"content\": \"Hello\"}. role supports system, user, assistant, or tool. content must not be empty. The content field can be a string or an array[object] (for multimodal input).",
            "items": {
              "$ref": "#/$defs/Message"
            }
          },
          "max_tokens": {
            "type": "integer",
            "deprecated": true,
            "description": "Deprecated, please refer to max_completion_tokens"
          },
          "max_completion_tokens": {
            "type": "integer",
            "description": "The maximum number of tokens to generate for the chat completion. The default varies by model: for Kimi K3-series models (kimi-k3.1-pro, kimi-k3.1-pro-highspeed, kimi-k3) it defaults to 131072 and can be set up to 1048576. If the result reaches the maximum number of tokens without ending, the finish reason will be \"length\"; otherwise, it will be \"stop\". This refers to the length of tokens you expect us to return, not the total length of input plus output. If the sum of the input token count (`prompt_tokens`) and `max_completion_tokens` exceeds the model context window, the API automatically lowers the generation limit for the current request to fit the remaining context space and continues processing the request. The input token count itself must be less than the model context window size."
          },
          "response_format": {
            "type": "object",
            "description": "Controls the model output format. Default is {\"type\": \"text\"} for plain text output. Set to {\"type\": \"json_object\"} to enable JSON mode, ensuring output is a valid JSON object (you must guide the model to output JSON in the prompt). Set to {\"type\": \"json_schema\"} to enable Structured Output, constraining output to match a specified JSON Schema (recommended, requires the json_schema field). If you encounter schema validation issues, please submit feedback at walle GitHub Issues (https://github.com/MoonshotAI/walle/issues).",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text",
                  "json_object",
                  "json_schema"
                ],
                "description": "Output format type. text: default, plain text output; json_object: ensures output is a valid JSON object; json_schema: constrains output to match a specified JSON Schema (recommended, requires the json_schema field)"
              },
              "json_schema": {
                "type": "object",
                "description": "Used when type is json_schema. Defines the JSON Schema that the output should conform to.",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Schema name for identification"
                  },
                  "strict": {
                    "type": "boolean",
                    "default": true,
                    "description": "Whether to strictly constrain output according to the schema. Defaults to true. When true, the schema must conform to the MFJS specification; non-conforming schemas will return errors or warnings. When false, only guarantees the output is a valid JSON object without enforcing internal structure."
                  },
                  "schema": {
                    "type": "object",
                    "description": "The JSON Schema object defining the structure the output should conform to. Must conform to MFJS (Moonshot Flavored JSON Schema) specification. You can use the walle CLI tool to validate: go install github.com/moonshotai/walle/cmd/walle@latest && walle -schema 'your_schema' -level strict",
                    "additionalProperties": true
                  }
                },
                "required": [
                  "name",
                  "schema"
                ]
              }
            }
          },
          "stop": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 5
              }
            ],
            "default": null,
            "description": "Stop words, which will halt the output when a full match is found. The matched words themselves will not be output. A maximum of 5 strings is allowed, and each string must not exceed 32 bytes"
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "Whether to return the response in a streaming fashion. Default is false."
          },
          "stream_options": {
            "type": "object",
            "description": "Options for streaming responses",
            "properties": {
              "include_usage": {
                "type": "boolean",
                "default": false,
                "description": "If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value. NOTE: If the stream is interrupted, you may not receive the final usage chunk which contains the total token usage for the request"
              }
            }
          },
          "tools": {
            "type": "array",
            "description": "A list of tools the model may call",
            "items": {
              "$ref": "#/$defs/ToolDefinition"
            }
          },
          "prompt_cache_key": {
            "type": "string",
            "default": null,
            "description": "Used to cache responses for similar requests to optimize cache hit rates. For Coding Agents, this is typically a session id or task id representing a single session; if the session is exited and later resumed, this value should remain the same. For Kimi Code Plan, this field is required to improve cache hit rates. For other agents involving multi-turn conversations, it is also recommended to implement this field"
          },
          "prompt_cache_options": {
            "type": "object",
            "description": "Context cache write options. When omitted, cache write is enabled by default (5m tier): the system automatically writes the request prefix to the 5m cache tier",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "implicit"
                ],
                "default": "implicit",
                "description": "Cache write mode. Only implicit is supported: automatically writes the request prefix to the cache"
              },
              "ttl": {
                "type": "string",
                "enum": [
                  "5m",
                  "1h"
                ],
                "default": "5m",
                "description": "Lifetime of the written cache. The 5m and 1h tiers are independent of each other. When a request with the same prefix hits the cache within its lifetime, the cache entry is refreshed with its original TTL"
              }
            }
          },
          "safety_identifier": {
            "type": "string",
            "description": "A stable identifier used to help detect users of your application that may be violating usage policies. The ID should be a string that uniquely identifies each user. It is recommended to hash the username or email address to avoid sending any identifying information"
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "auto",
                  "none",
                  "required"
                ],
                "description": "auto: the model decides whether to call tools; none: no tool calls; required: force a tool call"
              },
              {
                "type": "object",
                "description": "Force a specific tool call",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "function"
                    ]
                  },
                  "function": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "description": "The name of the function to call"
                      }
                    },
                    "required": [
                      "name"
                    ]
                  }
                },
                "required": [
                  "type",
                  "function"
                ]
              }
            ],
            "description": "Controls whether the model calls tools. `auto` (default): the model decides whether to call tools; `none`: no tool calls; `required`: force a tool call; or pass an object specifying a particular function to force that tool call."
          }
        },
        "required": [
          "messages"
        ]
      },
      "ChatRequestCommon": {
        "type": "object",
        "properties": {
          "logprobs": {
            "type": "boolean",
            "default": false,
            "description": "Whether to return log probabilities of the output tokens. If true, the log probability of each output token is returned in the logprobs field of the response message."
          },
          "top_logprobs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 20,
            "description": "An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true when this parameter is used."
          },
          "prediction": {
            "type": "object",
            "description": "Configuration for a Predicted Output, which can greatly improve response times when large parts of the model response are known ahead of time (for example, regenerating a file with only minor changes).",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "content"
                ],
                "description": "The type of the predicted content. Currently only content is supported."
              },
              "content": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                ],
                "description": "The static predicted output content that should be matched when generating the model response, such as the content of a text file being regenerated. Accepts a string or an array of content parts (text parts only)."
              }
            }
          },
          "max_tokens": {
            "type": "integer",
            "deprecated": true,
            "description": "Deprecated, please refer to max_completion_tokens"
          },
          "max_completion_tokens": {
            "type": "integer",
            "description": "The maximum number of tokens to generate for the chat completion. The default varies by model: for Kimi K3-series models (kimi-k3.1-pro, kimi-k3.1-pro-highspeed, kimi-k3) it defaults to 131072 and can be set up to 1048576. If the result reaches the maximum number of tokens without ending, the finish reason will be \"length\"; otherwise, it will be \"stop\". This refers to the length of tokens you expect us to return, not the total length of input plus output. If the sum of the input token count (`prompt_tokens`) and `max_completion_tokens` exceeds the model context window, the API automatically lowers the generation limit for the current request to fit the remaining context space and continues processing the request. The input token count itself must be less than the model context window size."
          },
          "response_format": {
            "type": "object",
            "description": "Controls the model output format. Default is {\"type\": \"text\"} for plain text output. Set to {\"type\": \"json_object\"} to enable JSON mode, ensuring output is a valid JSON object (you must guide the model to output JSON in the prompt). Set to {\"type\": \"json_schema\"} to enable Structured Output, constraining output to match a specified JSON Schema (recommended, requires the json_schema field). If you encounter schema validation issues, please submit feedback at walle GitHub Issues (https://github.com/MoonshotAI/walle/issues).",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "text",
                  "json_object",
                  "json_schema"
                ],
                "description": "Output format type. text: default, plain text output; json_object: ensures output is a valid JSON object; json_schema: constrains output to match a specified JSON Schema (recommended, requires the json_schema field)"
              },
              "json_schema": {
                "type": "object",
                "description": "Used when type is json_schema. Defines the JSON Schema that the output should conform to.",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Schema name for identification"
                  },
                  "strict": {
                    "type": "boolean",
                    "default": true,
                    "description": "Whether to strictly constrain output according to the schema. Defaults to true. When true, the schema must conform to the MFJS specification; non-conforming schemas will return errors or warnings. When false, only guarantees the output is a valid JSON object without enforcing internal structure."
                  },
                  "schema": {
                    "type": "object",
                    "description": "The JSON Schema object defining the structure the output should conform to. Must conform to MFJS (Moonshot Flavored JSON Schema) specification. You can use the walle CLI tool to validate: go install github.com/moonshotai/walle/cmd/walle@latest && walle -schema 'your_schema' -level strict",
                    "additionalProperties": true
                  }
                },
                "required": [
                  "name",
                  "schema"
                ]
              }
            }
          },
          "stop": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "maxItems": 5
              }
            ],
            "default": null,
            "description": "Stop words, which will halt the output when a full match is found. The matched words themselves will not be output. A maximum of 5 strings is allowed, and each string must not exceed 32 bytes"
          },
          "stream": {
            "type": "boolean",
            "default": false,
            "description": "Whether to return the response in a streaming fashion. Default is false."
          },
          "stream_options": {
            "type": "object",
            "description": "Options for streaming responses",
            "properties": {
              "include_usage": {
                "type": "boolean",
                "default": false,
                "description": "If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value. NOTE: If the stream is interrupted, you may not receive the final usage chunk which contains the total token usage for the request"
              }
            }
          },
          "tools": {
            "type": "array",
            "description": "A list of tools the model may call",
            "items": {
              "$ref": "#/$defs/ToolDefinition"
            }
          },
          "prompt_cache_key": {
            "type": "string",
            "default": null,
            "description": "Used to cache responses for similar requests to optimize cache hit rates. For Coding Agents, this is typically a session id or task id representing a single session; if the session is exited and later resumed, this value should remain the same. For Kimi Code Plan, this field is required to improve cache hit rates. For other agents involving multi-turn conversations, it is also recommended to implement this field"
          },
          "prompt_cache_options": {
            "type": "object",
            "description": "Context cache write options. When omitted, cache write is enabled by default (5m tier): the system automatically writes the request prefix to the 5m cache tier",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "implicit"
                ],
                "default": "implicit",
                "description": "Cache write mode. Only implicit is supported: automatically writes the request prefix to the cache"
              },
              "ttl": {
                "type": "string",
                "enum": [
                  "5m",
                  "1h"
                ],
                "default": "5m",
                "description": "Lifetime of the written cache. The 5m and 1h tiers are independent of each other. When a request with the same prefix hits the cache within its lifetime, the cache entry is refreshed with its original TTL"
              }
            }
          },
          "safety_identifier": {
            "type": "string",
            "description": "A stable identifier used to help detect users of your application that may be violating usage policies. The ID should be a string that uniquely identifies each user. It is recommended to hash the username or email address to avoid sending any identifying information"
          },
          "tool_choice": {
            "oneOf": [
              {
                "type": "string",
                "enum": [
                  "auto",
                  "none",
                  "required"
                ],
                "description": "auto: the model decides whether to call tools; none: no tool calls; required: force a tool call"
              },
              {
                "type": "object",
                "description": "Force a specific tool call",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "function"
                    ]
                  },
                  "function": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "description": "The name of the function to call"
                      }
                    },
                    "required": [
                      "name"
                    ]
                  }
                },
                "required": [
                  "type",
                  "function"
                ]
              }
            ],
            "description": "Controls whether the model calls tools. `auto` (default): the model decides whether to call tools; `none`: no tool calls; `required`: force a tool call; or pass an object specifying a particular function to force that tool call."
          }
        }
      },
      "KimiK26ChatRequest": {
        "title": "kimi-k2.6",
        "deprecated": true,
        "description": "No longer available to newly registered users. Users who registered before November 1, 2026, can continue using this model until its planned retirement at the end of December 2026.",
        "allOf": [
          {
            "$ref": "#/$defs/ChatRequestBase"
          },
          {
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "description": "Model ID",
                "enum": [
                  "kimi-k2.6"
                ],
                "default": "kimi-k2.6"
              },
              "thinking": {
                "type": "object",
                "description": "Controls whether thinking is enabled for the kimi-k2.6 model, and whether to fully preserve reasoning_content across multi-turn conversations. Optional parameter. Default value is {\"type\": \"enabled\"}.",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "enabled",
                      "disabled"
                    ],
                    "description": "Enable or disable thinking capability"
                  },
                  "keep": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "all",
                      null
                    ],
                    "description": "Controls whether reasoning_content from previous turns is preserved across a multi-turn conversation, i.e. whether to enable Preserved Thinking. Defaults to `null`, meaning historical thinking is NOT preserved.\n\n- `null` (default) or omitted: The server ignores reasoning_content from historical turns.\n- `\"all\"`: Preserves reasoning_content from historical turns and provides it to the model as part of the context, enabling Preserved Thinking. When using this, keep the reasoning_content from every historical assistant message in messages as-is. Recommended to use together with `type: \"enabled\"`.\n- Note: This parameter only affects reasoning_content from historical turns; it does not change whether the model produces/outputs thinking within the current turn (that is controlled by `type`). For best practices, see [Preserved Thinking](/guide/use-thinking-models#preserved-thinking)."
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "model"
            ]
          }
        ]
      },
      "KimiK27CodeChatRequest": {
        "title": "kimi-k2.7-code",
        "deprecated": true,
        "description": "No longer available to newly registered users. Users who registered before November 1, 2026, can continue using this model until its planned retirement at the end of December 2026.",
        "allOf": [
          {
            "$ref": "#/$defs/ChatRequestBase"
          },
          {
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "description": "Model ID. Either `kimi-k2.7-code` or its high-speed variant `kimi-k2.7-code-highspeed`; the two are the same model with identical parameters, while the high-speed variant outputs at approximately 180 Tokens/s (up to 260 Tokens/s in short-context scenarios).",
                "enum": [
                  "kimi-k2.7-code",
                  "kimi-k2.7-code-highspeed"
                ],
                "default": "kimi-k2.7-code"
              },
              "thinking": {
                "type": "object",
                "description": "Controls thinking for the kimi-k2.7-code model, and whether to fully preserve reasoning_content across multi-turn conversations. Optional parameter. Default value is {\"type\": \"enabled\", \"keep\": \"all\"}.\n\nDifferences from kimi-k2.6:\n- `type` only accepts `\"enabled\"`. Unlike kimi-k2.6, `\"disabled\"` is NOT supported — passing it returns an error. Thinking is always on for this model.\n- `keep` only accepts the valid value `\"all\"`; omitting it or passing `\"all\"` is treated as `\"all\"` on the server, while any other invalid value returns an error. Preserved Thinking is therefore always enabled for this model.",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "enabled"
                    ],
                    "description": "Enable thinking capability. For kimi-k2.7-code, only `\"enabled\"` is accepted; passing `\"disabled\"` returns an error. This differs from kimi-k2.6, which also supports `\"disabled\"`."
                  },
                  "keep": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "enum": [
                      "all",
                      null
                    ],
                    "description": "Controls whether reasoning_content from previous turns is preserved across a multi-turn conversation, i.e. whether to enable Preserved Thinking.\n\n- For kimi-k2.7-code this parameter only accepts the valid value `\"all\"`: passing `\"all\"`, passing `null`, or omitting it all behave identically and are treated as `\"all\"` on the server — reasoning_content from historical turns is always preserved; passing any other invalid value returns an error. This differs from kimi-k2.6, whose default is `null` (historical thinking NOT preserved unless you explicitly set `\"all\"`).\n- Because Preserved Thinking is always on, keep the reasoning_content from every historical assistant message in messages as-is.\n- Note: This parameter only affects reasoning_content from historical turns; it does not change whether the model produces/outputs thinking within the current turn (that is controlled by `type`). For best practices, see [Preserved Thinking](/guide/use-thinking-models#preserved-thinking)."
                  }
                },
                "required": [
                  "type"
                ],
                "additionalProperties": false
              }
            },
            "required": [
              "model"
            ]
          }
        ]
      },
      "KimiK31ProChatRequest": {
        "title": "kimi-k3.1-pro series",
        "allOf": [
          {
            "$ref": "#/$defs/KimiK3ChatRequestBase"
          },
          {
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "description": "Model ID",
                "enum": [
                  "kimi-k3.1-pro",
                  "kimi-k3.1-pro-highspeed"
                ],
                "default": "kimi-k3.1-pro"
              }
            },
            "required": [
              "model"
            ]
          }
        ]
      },
      "KimiK3ChatRequest": {
        "title": "kimi-k3",
        "allOf": [
          {
            "$ref": "#/$defs/KimiK3ChatRequestBase"
          },
          {
            "type": "object",
            "properties": {
              "model": {
                "type": "string",
                "description": "Model ID",
                "enum": [
                  "kimi-k3"
                ],
                "default": "kimi-k3"
              }
            },
            "required": [
              "model"
            ]
          }
        ]
      },
      "KimiK3ChatRequestBase": {
        "allOf": [
          {
            "$ref": "#/$defs/ChatRequestCommon"
          },
          {
            "type": "object",
            "properties": {
              "messages": {
                "type": "array",
                "description": "A list of conversation messages.",
                "items": {
                  "$ref": "#/$defs/KimiK3Message"
                }
              },
              "reasoning_effort": {
                "type": "string",
                "enum": [
                  "low",
                  "high",
                  "max"
                ],
                "default": "max",
                "description": "Kimi K3-series models always enable thinking with Preserved Thinking. Reasoning effort supports low, high, and max, with max as the default."
              }
            },
            "required": [
              "messages"
            ]
          }
        ]
      },
      "KimiK3DynamicToolMessage": {
        "type": "object",
        "description": "Declares tools available to subsequent conversation turns through the tools field. role must be system, and content must be omitted.",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system"
            ],
            "description": "The role of a dynamic tool loading message. Always system."
          },
          "tools": {
            "type": "array",
            "description": "Tools available for the model to call from this message onward",
            "items": {
              "$ref": "#/$defs/ToolDefinition"
            }
          }
        },
        "required": [
          "role",
          "tools"
        ],
        "additionalProperties": false
      },
      "KimiK3Message": {
        "oneOf": [
          {
            "title": "Standard message",
            "$ref": "#/$defs/Message"
          },
          {
            "title": "Dynamic tool message",
            "$ref": "#/$defs/KimiK3DynamicToolMessage"
          }
        ],
        "description": "Supports standard conversation messages and system messages for dynamically loading tools."
      },
      "Message": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "enum": [
              "system",
              "user",
              "assistant",
              "tool"
            ],
            "example": "user",
            "description": "The role of the message sender. Supports system, user, assistant, tool."
          },
          "content": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "title": "text",
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "text"
                          ]
                        },
                        "text": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "text"
                      ]
                    },
                    {
                      "title": "image_url",
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "image_url"
                          ]
                        },
                        "image_url": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "url": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "url"
                              ]
                            },
                            {
                              "type": "string"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "image_url"
                      ]
                    },
                    {
                      "title": "video_url",
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "video_url"
                          ]
                        },
                        "video_url": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "url": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "url"
                              ]
                            },
                            {
                              "type": "string"
                            }
                          ]
                        }
                      },
                      "required": [
                        "type",
                        "video_url"
                      ]
                    }
                  ]
                }
              }
            ],
            "example": "Hello",
            "description": "The content of the message. Can be a plain text string, or an array of objects with text/image_url/video_url types (for multimodal input)"
          },
          "name": {
            "type": "string",
            "default": null,
            "description": "Optional name for the message sender"
          },
          "partial": {
            "type": "boolean",
            "default": false,
            "description": "Enable Partial Mode by setting this to true in the last assistant message"
          }
        },
        "required": [
          "role",
          "content"
        ]
      },
      "ToolDefinition": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "function"
            ]
          },
          "function": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "Function name. Must follow the regex: ^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$",
                "pattern": "^[a-zA-Z_][a-zA-Z0-9-_]{0,127}$"
              },
              "description": {
                "type": "string",
                "description": "Description of what the function does"
              },
              "parameters": {
                "type": "object",
                "description": "Function parameters as JSON Schema. Must conform to the [MFJS (Moonshot Flavored JSON Schema) specification](https://github.com/MoonshotAI/walle/blob/main/docs/mfjs-spec.md).",
                "additionalProperties": true
              },
              "strict": {
                "type": "boolean",
                "default": true,
                "description": "Whether to strictly constrain tool call arguments according to the parameters schema. Defaults to true. When false, only guarantees the output is a valid JSON object without enforcing internal structure."
              }
            },
            "required": [
              "name",
              "parameters"
            ]
          }
        },
        "required": [
          "type",
          "function"
        ]
      }
    }
  }
}

Validate a payload

before you spend tokens
shell
$ curl -X POST https://modelschemas.com/v1/validate \
    -d '{"provider":"moonshot","endpointId":"v1/chat/completions","payload":{…}}'
→ {"valid": false, "errors": [{"path": "#", "keyword": "required", …}]}