{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/octen-ai/json-schema/octen-ai-answer-request-schema.json",
  "title": "AnswerRequest",
  "description": "Request body for the Answer API.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/octen-ai-answer-api-openapi.yml#/components/schemas/AnswerRequest",
  "type": "object",
  "required": [
    "messages"
  ],
  "properties": {
    "model": {
      "type": "string",
      "enum": [
        "openai/gpt-6-astra",
        "openai/gpt-5.6-sol",
        "openai/gpt-5.6-terra",
        "openai/gpt-5.6-luna",
        "openai/gpt-5.5-pro",
        "openai/gpt-5.5",
        "openai/gpt-5.4",
        "anthropic/claude-fable-5.1",
        "anthropic/claude-fable-5",
        "anthropic/claude-opus-5",
        "anthropic/claude-opus-4.8",
        "anthropic/claude-opus-4.6",
        "anthropic/claude-sonnet-5",
        "anthropic/claude-sonnet-4.6",
        "anthropic/claude-haiku-4.5",
        "google/gemini-3.8-flash",
        "google/gemini-3.5-flash",
        "google/gemini-3.5-flash-lite",
        "google/gemini-3.1-pro-preview",
        "google/gemini-3.1-flash-lite",
        "google/gemini-3-flash-preview",
        "moonshotai/kimi-k3",
        "moonshotai/kimi-k2.6",
        "moonshotai/kimi-k2.5",
        "minimax/minimax-m2.5",
        "qwen/qwen3.6-plus",
        "deepseek/deepseek-v4-pro",
        "deepseek/deepseek-v4-flash-0731"
      ],
      "default": "anthropic/claude-sonnet-4.6",
      "description": "The model to use for query decomposition and response synthesis."
    },
    "messages": {
      "type": "array",
      "description": "A list of messages comprising the conversation so far. User and assistant messages in chronological order for multi-turn conversations.",
      "items": {
        "$ref": "#/$defs/ChatMessage"
      }
    },
    "mode": {
      "type": "string",
      "enum": [
        "queries_only",
        "queries_and_search",
        "full"
      ],
      "default": "full",
      "description": "Controls the execution depth. `queries_only`: only decompose the message into sub-queries without performing searches; `queries_and_search`: decompose into sub-queries and return search results without LLM synthesis; `full`: decompose, search, and synthesize a final response using the LLM."
    },
    "max_queries": {
      "type": "integer",
      "minimum": 1,
      "maximum": 30,
      "default": 30,
      "description": "Maximum number of sub-queries to generate."
    },
    "web_search_options": {
      "allOf": [
        {
          "$ref": "#/$defs/WebSearchOptions"
        }
      ],
      "description": "Search options. Shares the same parameters and defaults as the Web Search API, except `highlight.max_tokens` defaults to 256. Queries are automatically generated from the messages."
    },
    "stream": {
      "type": "boolean",
      "default": false,
      "description": "Whether to enable streaming output. When `true`, returns `chat.completion.chunk` objects incrementally with types: `queries`, `search_done`, `content`, `finish`, and `usage`."
    }
  },
  "$defs": {
    "AssistantMessage": {
      "type": "object",
      "required": [
        "role"
      ],
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "assistant"
          ],
          "description": "The role of the message author. Always `assistant`."
        },
        "content": {
          "type": [
            "string",
            "null"
          ],
          "description": "The assistant's text content. May be `null` or omitted when the assistant only produces tool calls."
        },
        "tool_calls": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChatToolCall"
          },
          "description": "Tool calls generated by the model in a previous turn, replayed verbatim. Only valid when `role` is `assistant`."
        }
      }
    },
    "CacheControl": {
      "type": "object",
      "description": "Prompt caching marker. Sets a cache breakpoint so the stable prefix up to this block can be reused.",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "ephemeral"
          ],
          "description": "The cache control type. Always `ephemeral`."
        },
        "ttl": {
          "type": "string",
          "enum": [
            "5m",
            "1h"
          ],
          "default": "5m",
          "description": "Cache lifetime."
        }
      }
    },
    "ChatContentBlock": {
      "type": "object",
      "description": "A content block within a message.",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "text",
            "image",
            "image_url"
          ],
          "description": "The type of content block."
        },
        "text": {
          "type": "string",
          "description": "The text content. Required when `type` is `text`."
        },
        "image": {
          "type": "string",
          "description": "Base64-encoded image. Required when `type` is `image`."
        },
        "image_url": {
          "type": "object",
          "description": "Image URL object. Required when `type` is `image_url`.",
          "required": [
            "url"
          ],
          "properties": {
            "url": {
              "type": "string",
              "description": "The URL of the image."
            }
          }
        },
        "cache_control": {
          "$ref": "#/$defs/CacheControl"
        }
      }
    },
    "ChatMessage": {
      "oneOf": [
        {
          "$ref": "#/$defs/SystemMessage"
        },
        {
          "$ref": "#/$defs/DeveloperMessage"
        },
        {
          "$ref": "#/$defs/UserMessage"
        },
        {
          "$ref": "#/$defs/AssistantMessage"
        },
        {
          "$ref": "#/$defs/ToolMessage"
        }
      ]
    },
    "ChatToolCall": {
      "type": "object",
      "required": [
        "id",
        "type",
        "function"
      ],
      "description": "A custom function call generated by the model.",
      "properties": {
        "index": {
          "type": "integer",
          "description": "The index of this tool call in the array."
        },
        "id": {
          "type": "string",
          "description": "A unique identifier for this tool call. Referenced by the corresponding `tool` message's `tool_call_id`."
        },
        "type": {
          "type": "string",
          "enum": [
            "function"
          ],
          "description": "The type of tool call. Always `function`."
        },
        "function": {
          "$ref": "#/$defs/ChatToolCallFunction"
        }
      }
    },
    "ChatToolCallFunction": {
      "type": "object",
      "required": [
        "name",
        "arguments"
      ],
      "description": "The function invocation details within a tool call.",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the function to call."
        },
        "arguments": {
          "type": "string",
          "description": "The arguments to the function, as a JSON string generated by the model."
        }
      }
    },
    "DeveloperMessage": {
      "type": "object",
      "required": [
        "role",
        "content"
      ],
      "description": "A developer message. The OpenAI-protocol equivalent of `system` (sent by newer OpenAI SDKs); handled as `system`.",
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "developer"
          ],
          "description": "The role of the message author. Always `developer`."
        },
        "content": {
          "description": "The content. A plain string or an array of content blocks.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ChatContentBlock"
              }
            }
          ]
        }
      }
    },
    "FullContentOptions": {
      "type": "object",
      "description": "Controls whether to return the full raw content of each result page.",
      "properties": {
        "enable": {
          "type": "boolean",
          "default": false,
          "description": "If true, returns full_content for each result."
        },
        "max_tokens": {
          "type": "integer",
          "default": 2048,
          "minimum": 100,
          "maximum": 100000,
          "description": "Maximum tokens of full content included per result."
        }
      }
    },
    "HighlightOptions": {
      "type": "object",
      "description": "Controls highlight extraction from result pages.",
      "properties": {
        "enable": {
          "type": "boolean",
          "default": true,
          "description": "If true, returns query-relevant highlight in each result."
        },
        "max_tokens": {
          "type": "integer",
          "default": 512,
          "minimum": 100,
          "maximum": 20000,
          "description": "Max tokens returned per highlight."
        }
      }
    },
    "SystemMessage": {
      "type": "object",
      "required": [
        "role",
        "content"
      ],
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "system"
          ],
          "description": "The role of the message author. Always `system`."
        },
        "content": {
          "description": "The system prompt content. A plain string or an array of content blocks.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ChatContentBlock"
              }
            }
          ]
        }
      }
    },
    "ToolMessage": {
      "type": "object",
      "required": [
        "role",
        "tool_call_id",
        "content"
      ],
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "tool"
          ],
          "description": "The role of the message author. Always `tool`."
        },
        "tool_call_id": {
          "type": "string",
          "description": "The ID of the tool call this message responds to."
        },
        "content": {
          "type": "string",
          "description": "The tool output, typically a JSON string with the function result."
        }
      }
    },
    "UserMessage": {
      "type": "object",
      "required": [
        "role",
        "content"
      ],
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "user"
          ],
          "description": "The role of the message author. Always `user`."
        },
        "content": {
          "description": "The content of the message. A plain string or an array of content blocks.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/ChatContentBlock"
              }
            }
          ]
        }
      }
    },
    "WebSearchOptions": {
      "type": "object",
      "properties": {
        "count": {
          "type": "integer",
          "default": 5,
          "minimum": 1,
          "maximum": 100,
          "description": "Number of results to return."
        },
        "include_domains": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 60
          },
          "maxItems": 1200,
          "description": "A list of domains to specifically include in the search results. The `site:` query operator adds to this list."
        },
        "exclude_domains": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 60
          },
          "maxItems": 1200,
          "description": "A list of domains to specifically exclude from the search results. The `-site:` query operator adds to this list. If a domain appears in both `include_domains` and `exclude_domains`, `exclude_domains` takes precedence."
        },
        "include_text": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 30
          },
          "maxItems": 5,
          "description": "Strings that must appear in the result page text."
        },
        "exclude_text": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 30
          },
          "maxItems": 5,
          "description": "Strings that must not appear in the result page text."
        },
        "time_basis": {
          "type": "string",
          "enum": [
            "auto",
            "published",
            "crawled"
          ],
          "default": "auto",
          "description": "Determines which time field is used for time filtering. `published` uses time_published; `crawled` uses time_last_crawled. Results missing this field are excluded when filtering by time."
        },
        "time_range": {
          "type": "string",
          "enum": [
            "day",
            "week",
            "month",
            "year",
            "d",
            "w",
            "m",
            "y"
          ],
          "description": "Relative time window counting back from the current time based on `time_basis`. Mutually exclusive with `start_time`/`end_time` — if both are provided, `start_time`/`end_time` take precedence."
        },
        "start_time": {
          "type": "string",
          "format": "date-time",
          "description": "Start time for filtering results. ISO 8601 format."
        },
        "end_time": {
          "type": "string",
          "format": "date-time",
          "description": "End time for filtering results. ISO 8601 format."
        },
        "language": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "ar",
              "de",
              "en",
              "es",
              "fr",
              "hi",
              "id",
              "it",
              "ja",
              "ko",
              "nl",
              "pl",
              "pt",
              "ru",
              "th",
              "tr",
              "vi",
              "zh"
            ]
          },
          "default": [],
          "description": "A list of languages to restrict results to, as ISO 639-1 codes. By default, no language filter is applied."
        },
        "highlight": {
          "$ref": "#/$defs/HighlightOptions"
        },
        "full_content": {
          "$ref": "#/$defs/FullContentOptions"
        },
        "format": {
          "type": "string",
          "enum": [
            "markdown",
            "text"
          ],
          "default": "text",
          "description": "Controls the formatting of highlight outputs."
        },
        "safesearch": {
          "type": "string",
          "enum": [
            "off",
            "strict"
          ],
          "default": "strict",
          "description": "Controls filtering of explicit/adult content. `off` disables filtering; `strict` drops all adult content."
        },
        "include_images": {
          "type": "boolean",
          "default": false,
          "description": "Whether to include images in each result."
        }
      }
    }
  }
}