{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mentionsapi-com/json-schema/mentionsapi-com-ask-request-schema.json",
  "title": "AskRequest",
  "description": "Exactly one of `prompt` or `messages` must be provided.",
  "x-generated": "2026-12-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mentionsapi-com-openapi.json#/components/schemas/AskRequest",
  "type": "object",
  "properties": {
    "prompt": {
      "type": "string",
      "minLength": 1,
      "maxLength": 10000,
      "description": "Legacy single-turn prompt."
    },
    "messages": {
      "type": "array",
      "minItems": 1,
      "maxItems": 50,
      "items": {
        "$ref": "#/$defs/ChatMessage"
      },
      "description": "Multi-turn conversation. Each provider proxy supports turn arrays natively."
    },
    "system_message": {
      "type": "string",
      "minLength": 1,
      "maxLength": 20000,
      "description": "Top-level system message. Ignored if `messages` contains a system turn."
    },
    "providers": {
      "type": "array",
      "minItems": 1,
      "maxItems": 4,
      "items": {
        "$ref": "#/$defs/ProviderId"
      }
    },
    "model": {
      "type": "object",
      "description": "Per-provider model override. Each value must be on the proxy allowlist.",
      "additionalProperties": {
        "type": "string",
        "minLength": 1,
        "maxLength": 100
      }
    },
    "params": {
      "type": "object",
      "properties": {
        "temperature": {
          "type": "number",
          "minimum": 0,
          "maximum": 2
        },
        "max_tokens": {
          "type": "integer",
          "minimum": 1,
          "maximum": 8000
        }
      }
    },
    "json_schema": {
      "$ref": "#/$defs/JsonSchemaSpec"
    },
    "cache_scope": {
      "type": "string",
      "enum": [
        "shared",
        "private"
      ],
      "default": "shared",
      "description": "`shared` allows cache hits across accounts; `private` namespaces by account."
    },
    "track_brands": {
      "type": "array",
      "maxItems": 10,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 80
      }
    },
    "web_search": {
      "type": "boolean",
      "default": true
    },
    "country": {
      "type": "string",
      "minLength": 2,
      "maxLength": 2,
      "description": "ISO 3166-1 alpha-2 country code."
    },
    "async": {
      "type": "boolean",
      "description": "When true, the call is deferred to a queue and delivered to `webhook_id`."
    },
    "webhook_id": {
      "type": "string",
      "format": "uuid",
      "description": "Required when `async: true`. Identifies the webhook endpoint that receives the ask.completed event."
    },
    "mode": {
      "type": "string",
      "enum": [
        "live",
        "standard"
      ],
      "default": "live",
      "description": "`live` = synchronous. `standard` = async delivery within 15 min, 30% cheaper."
    }
  },
  "$defs": {
    "ChatMessage": {
      "type": "object",
      "required": [
        "role",
        "content"
      ],
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "system",
            "user",
            "assistant"
          ]
        },
        "content": {
          "type": "string",
          "minLength": 1,
          "maxLength": 20000
        }
      }
    },
    "JsonSchemaSpec": {
      "type": "object",
      "required": [
        "name",
        "schema"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "schema": {
          "type": "object",
          "additionalProperties": true
        },
        "strict": {
          "type": "boolean"
        }
      }
    },
    "ProviderId": {
      "type": "string",
      "enum": [
        "openai",
        "anthropic",
        "gemini",
        "perplexity"
      ],
      "description": "The LLM provider that produced a result."
    }
  }
}