{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/johnsessentials-com/json-schema/johnsessentials-com-oaichat-request-schema.json",
  "title": "OAIChatRequest",
  "x-generated": "2026-11-13",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/johnsessentials-com-openapi.json#/components/schemas/OAIChatRequest",
  "properties": {
    "max_tokens": {
      "minimum": 1,
      "type": "integer"
    },
    "messages": {
      "items": {
        "$ref": "#/$defs/OAIMessage"
      },
      "minItems": 1,
      "type": "array"
    },
    "model": {
      "description": "`johns-agent` (default — runs our orchestrator with the full tool\ncatalogue). `johns-fast` and `johns-smart` are accepted aliases\nreserved for low-latency / high-quality routes; today they and\nany other value (e.g. `gpt-4o`) route through the same\nhealth-ordered provider pool. Treat `model` as a\nforward-compatible hint — your code keeps working unchanged.\n",
      "type": "string"
    },
    "stop": {
      "description": "string | string[]"
    },
    "stream": {
      "default": false,
      "type": "boolean"
    },
    "temperature": {
      "maximum": 2,
      "minimum": 0,
      "type": "number"
    },
    "tool_choice": {
      "description": "\"auto\" | \"none\" | { \"type\": \"function\", \"function\": { \"name\": \"x\" } }"
    },
    "tools": {
      "description": "When present, BYPASSES our orchestrator and calls the LLM\nprovider directly with your tool definitions. Response will\ninclude `tool_calls` in the OpenAI shape; you execute the\ntools on your side. ~40× cheaper per request than the\norchestrator path.\n",
      "items": {
        "$ref": "#/$defs/OAITool"
      },
      "type": "array"
    },
    "user": {
      "description": "End-user identifier for abuse tracking.",
      "type": "string"
    }
  },
  "required": [
    "model",
    "messages"
  ],
  "type": "object",
  "$defs": {
    "OAIFunctionDef": {
      "properties": {
        "description": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "parameters": {
          "description": "JSON Schema for the function's arguments.",
          "type": "object"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "OAIMessage": {
      "properties": {
        "content": {
          "description": "string OR array of content parts."
        },
        "name": {
          "type": "string"
        },
        "role": {
          "enum": [
            "system",
            "user",
            "assistant",
            "tool"
          ],
          "type": "string"
        },
        "tool_call_id": {
          "type": "string"
        },
        "tool_calls": {
          "items": {
            "$ref": "#/$defs/OAIToolCall"
          },
          "type": "array"
        }
      },
      "required": [
        "role"
      ],
      "type": "object"
    },
    "OAITool": {
      "properties": {
        "function": {
          "$ref": "#/$defs/OAIFunctionDef"
        },
        "type": {
          "enum": [
            "function"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "function"
      ],
      "type": "object"
    },
    "OAIToolCall": {
      "properties": {
        "function": {
          "properties": {
            "arguments": {
              "description": "JSON-encoded string per OpenAI's wire shape — NOT an object.",
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "name",
            "arguments"
          ],
          "type": "object"
        },
        "id": {
          "type": "string"
        },
        "type": {
          "enum": [
            "function"
          ],
          "type": "string"
        }
      },
      "required": [
        "id",
        "type",
        "function"
      ],
      "type": "object"
    }
  }
}