Kgateway · Schema

kgateway AIBackend

AIBackend configures AI provider backends with support for LLM providers such as OpenAI, Azure OpenAI, Gemini, and Mistral, including priority-based routing groups.

Gateways

Properties

Name Type Description
apiVersion string API version for the AIBackend resource.
kind string Resource kind.
metadata object Standard Kubernetes object metadata.
spec object AIBackendSpec defines the desired state of an AIBackend.
View JSON Schema on GitHub

JSON Schema

ai-backend.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/api-evangelist/kgateway/blob/main/json-schema/ai-backend.json",
  "title": "kgateway AIBackend",
  "description": "AIBackend configures AI provider backends with support for LLM providers such as OpenAI, Azure OpenAI, Gemini, and Mistral, including priority-based routing groups.",
  "type": "object",
  "properties": {
    "apiVersion": {
      "type": "string",
      "const": "gateway.kgateway.dev/v1alpha1",
      "description": "API version for the AIBackend resource."
    },
    "kind": {
      "type": "string",
      "const": "AIBackend",
      "description": "Resource kind."
    },
    "metadata": {
      "type": "object",
      "description": "Standard Kubernetes object metadata.",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the AIBackend resource."
        },
        "namespace": {
          "type": "string",
          "description": "Namespace of the AIBackend resource."
        },
        "labels": {
          "type": "object",
          "additionalProperties": { "type": "string" }
        },
        "annotations": {
          "type": "object",
          "additionalProperties": { "type": "string" }
        }
      },
      "required": ["name"]
    },
    "spec": {
      "type": "object",
      "description": "AIBackendSpec defines the desired state of an AIBackend.",
      "properties": {
        "provider": {
          "type": "object",
          "description": "Configuration for the LLM provider.",
          "properties": {
            "type": {
              "type": "string",
              "description": "The type of LLM provider.",
              "enum": ["openai", "azure", "gemini", "mistral"]
            },
            "openai": {
              "type": "object",
              "properties": {
                "model": {
                  "type": "string",
                  "description": "Model name to use."
                },
                "authToken": { "$ref": "#/$defs/AuthToken" }
              }
            },
            "azure": {
              "type": "object",
              "properties": {
                "endpoint": { "type": "string" },
                "deploymentName": { "type": "string" },
                "apiVersion": { "type": "string" },
                "authToken": { "$ref": "#/$defs/AuthToken" }
              }
            },
            "gemini": {
              "type": "object",
              "properties": {
                "model": { "type": "string" },
                "authToken": { "$ref": "#/$defs/AuthToken" }
              }
            }
          }
        },
        "groups": {
          "type": "array",
          "description": "List of groups in priority order where each group defines a set of LLM providers.",
          "items": {
            "type": "object",
            "properties": {
              "priority": {
                "type": "integer",
                "description": "Priority of this group (lower is higher priority)."
              },
              "backends": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "backendRef": {
                      "type": "object",
                      "properties": {
                        "name": { "type": "string" },
                        "namespace": { "type": "string" }
                      }
                    },
                    "weight": {
                      "type": "integer",
                      "description": "Weight for load balancing within the group."
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "AuthToken": {
      "type": "object",
      "properties": {
        "secretRef": {
          "type": "object",
          "properties": {
            "name": { "type": "string" },
            "namespace": { "type": "string" }
          }
        }
      }
    }
  }
}