{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nativeport-ai/json-schema/nativeport-ai-inference-chat-request-schema.json",
  "title": "InferenceChatRequest",
  "description": "OpenAI Chat Completions-shaped, but deliberately narrower: only the field set every one of the\nfour backing providers can express in common is accepted (this schema's own property list —\nthe same set `GET /inference/v1/models` reports per model as `supported_parameters`). A field\noutside it is rejected with `400 unsupported_parameter` before any upstream call.\n",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nativeport-ai-openapi.yml#/components/schemas/InferenceChatRequest",
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "A canonical model id. Mandatory — there is no default and no fallback. See the [Inference API guide](/inference) for the `openai/<id>` / `anthropic/<id>` / `xai/<id>` / `huggingface/<owner>/<model>[:provider]` forms."
    },
    "messages": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InferenceChatMessage"
      }
    },
    "max_tokens": {
      "type": "integer",
      "minimum": 1,
      "description": "For a request resolving to an Anthropic model, mapped to that API's required `max_tokens` field; if neither this nor `max_completion_tokens` is set, the gateway injects Anthropic's configured default rather than letting the call 400 there alone."
    },
    "max_completion_tokens": {
      "type": "integer",
      "minimum": 1
    },
    "temperature": {
      "type": "number",
      "format": "double"
    },
    "top_p": {
      "type": "number",
      "format": "double"
    },
    "stop": {
      "$ref": "#/$defs/InferenceChatRequestStop"
    },
    "stream": {
      "type": "boolean",
      "description": "Selects the `text/event-stream` response form over a single JSON object."
    },
    "stream_options": {
      "$ref": "#/$defs/InferenceChatRequestStreamOptions"
    },
    "tools": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InferenceToolDefinition"
      }
    },
    "tool_choice": {
      "$ref": "#/$defs/InferenceToolChoice"
    },
    "parallel_tool_calls": {
      "type": "boolean"
    }
  },
  "required": [
    "model",
    "messages"
  ],
  "$defs": {
    "InferenceChatMessage": {
      "type": "object",
      "properties": {
        "role": {
          "$ref": "#/$defs/InferenceChatMessageRole"
        },
        "content": {
          "$ref": "#/$defs/InferenceChatMessageContent",
          "description": "Required for every role except `assistant` when it carries `tool_calls` instead. A plain\nstring, or an array of `text`/`image_url` parts (see `InferenceContentPart`) — image parts\nare validated the same way regardless of role, so vision-capability rejection also applies\nto a `tool` message's image content.\n"
        },
        "tool_calls": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/InferenceToolCall"
          },
          "description": "Only valid on an `assistant` message."
        },
        "tool_call_id": {
          "type": "string",
          "description": "Required on a `tool` message (naming the call this message answers); invalid on any other role."
        }
      },
      "required": [
        "role"
      ],
      "title": "InferenceChatMessage"
    },
    "InferenceChatMessageContent": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "$ref": "#/$defs/InferenceChatMessageContent1"
        }
      ],
      "description": "Required for every role except `assistant` when it carries `tool_calls` instead. A plain\nstring, or an array of `text`/`image_url` parts (see `InferenceContentPart`) — image parts\nare validated the same way regardless of role, so vision-capability rejection also applies\nto a `tool` message's image content.\n",
      "title": "InferenceChatMessageContent"
    },
    "InferenceChatMessageContent1": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InferenceContentPart"
      },
      "title": "InferenceChatMessageContent1"
    },
    "InferenceChatMessageRole": {
      "type": "string",
      "enum": [
        "system",
        "user",
        "assistant",
        "tool"
      ],
      "title": "InferenceChatMessageRole"
    },
    "InferenceChatRequestStop": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      ],
      "title": "InferenceChatRequestStop"
    },
    "InferenceChatRequestStreamOptions": {
      "type": "object",
      "properties": {
        "include_usage": {
          "type": "boolean",
          "description": "Emit one extra usage-only chunk (empty `choices`) immediately before `[DONE]`."
        }
      },
      "title": "InferenceChatRequestStreamOptions"
    },
    "InferenceContentPart": {
      "oneOf": [
        {
          "$ref": "#/$defs/InferenceTextContentPart"
        },
        {
          "$ref": "#/$defs/InferenceImageContentPart"
        }
      ],
      "title": "InferenceContentPart"
    },
    "InferenceImageContentPart": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "image_url"
          ]
        },
        "image_url": {
          "$ref": "#/$defs/InferenceImageContentPartImageUrl"
        }
      },
      "required": [
        "type",
        "image_url"
      ],
      "title": "InferenceImageContentPart"
    },
    "InferenceImageContentPartImageUrl": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "description": "A `https://` URL or a `data:` URI. Only honored for a model whose\n`GET /inference/v1/models` entry reports `capabilities.vision: true` — sent to any\nother model, the whole request is rejected preflight with `400 unsupported_parameter`.\n"
        }
      },
      "required": [
        "url"
      ],
      "title": "InferenceImageContentPartImageUrl"
    },
    "InferenceTextContentPart": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "text"
          ]
        },
        "text": {
          "type": "string"
        }
      },
      "required": [
        "type",
        "text"
      ],
      "title": "InferenceTextContentPart"
    },
    "InferenceToolCall": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "function"
          ]
        },
        "function": {
          "$ref": "#/$defs/InferenceToolCallFunction"
        }
      },
      "required": [
        "id",
        "type",
        "function"
      ],
      "title": "InferenceToolCall"
    },
    "InferenceToolCallFunction": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "arguments": {
          "type": "string",
          "description": "A JSON-encoded string of the call's arguments (not a nested object)."
        }
      },
      "required": [
        "name",
        "arguments"
      ],
      "title": "InferenceToolCallFunction"
    },
    "InferenceToolChoice": {
      "oneOf": [
        {
          "$ref": "#/$defs/InferenceToolChoice0"
        },
        {
          "$ref": "#/$defs/InferenceToolChoice1"
        }
      ],
      "description": "`\"auto\"`, `\"none\"`, `\"required\"`, or an object pinning one specific function tool.",
      "title": "InferenceToolChoice"
    },
    "InferenceToolChoice0": {
      "type": "string",
      "enum": [
        "auto",
        "none",
        "required"
      ],
      "title": "InferenceToolChoice0"
    },
    "InferenceToolChoice1": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "function"
          ]
        },
        "function": {
          "$ref": "#/$defs/InferenceToolChoiceOneOf1Function"
        }
      },
      "required": [
        "type",
        "function"
      ],
      "title": "InferenceToolChoice1"
    },
    "InferenceToolChoiceOneOf1Function": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ],
      "title": "InferenceToolChoiceOneOf1Function"
    },
    "InferenceToolDefinition": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "function"
          ]
        },
        "function": {
          "$ref": "#/$defs/InferenceToolDefinitionFunction"
        }
      },
      "required": [
        "type",
        "function"
      ],
      "title": "InferenceToolDefinition"
    },
    "InferenceToolDefinitionFunction": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9_-]{1,64}$"
        },
        "description": {
          "type": "string"
        },
        "parameters": {
          "type": "object",
          "additionalProperties": {
            "description": "Any type"
          },
          "description": "A JSON Schema object describing the function's arguments. Omitted means the function takes none."
        }
      },
      "required": [
        "name"
      ],
      "title": "InferenceToolDefinitionFunction"
    }
  }
}