{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/microsoft-azure-api-management/json-schema/microsoft-azure-api-management-ai-gateway-model-provider-resource-schema.json",
  "title": "AiGatewayModelProviderResource",
  "description": "An AI Gateway model provider resource.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/microsoft-azure-api-management-aigatewaymodelproviderresources-api-openapi.yml#/components/schemas/AiGatewayModelProviderResource",
  "type": "object",
  "properties": {
    "properties": {
      "$ref": "#/$defs/AiGatewayModelProviderProperties",
      "description": "The resource-specific properties for this resource."
    },
    "eTag": {
      "type": "string",
      "description": "If eTag is provided in the response body, it may also be provided as a header per the normal etag convention.  Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.",
      "readOnly": true
    }
  },
  "allOf": [
    {
      "$ref": "#/$defs/ProxyResource"
    }
  ],
  "$defs": {
    "AiGatewayApiKeyCredential": {
      "type": "object",
      "description": "API key credentials for an upstream service.",
      "properties": {
        "headerName": {
          "type": "string",
          "description": "Name of the HTTP header that carries the API key."
        },
        "value": {
          "type": "string",
          "format": "password",
          "description": "Secret API key value. This value is not returned by read operations.",
          "x-ms-mutability": [
            "update",
            "create"
          ],
          "x-ms-secret": true
        }
      },
      "required": [
        "headerName"
      ]
    },
    "AiGatewayCustomAuthentication": {
      "type": "object",
      "description": "Authentication configuration for a custom model provider.",
      "properties": {
        "kind": {
          "type": "string",
          "description": "Authentication type.",
          "enum": [
            "ApiKey"
          ],
          "x-ms-enum": {
            "modelAsString": false
          }
        },
        "apiKey": {
          "$ref": "#/$defs/AiGatewayApiKeyCredential",
          "description": "API key configuration."
        }
      },
      "required": [
        "kind",
        "apiKey"
      ]
    },
    "AiGatewayCustomProviderConfiguration": {
      "type": "object",
      "description": "Custom model provider configuration.",
      "properties": {
        "endpoint": {
          "type": "string",
          "format": "uri",
          "description": "Provider base endpoint."
        },
        "authentication": {
          "$ref": "#/$defs/AiGatewayCustomAuthentication",
          "description": "Authentication configuration."
        }
      },
      "required": [
        "endpoint",
        "authentication"
      ]
    },
    "AiGatewayFoundryAuthentication": {
      "type": "object",
      "description": "Authentication configuration for a Foundry model provider.",
      "properties": {
        "kind": {
          "$ref": "#/$defs/AiGatewayModelProviderAuthenticationKind",
          "description": "Authentication type."
        },
        "managedIdentity": {
          "$ref": "#/$defs/AiGatewayManagedIdentityAuthentication",
          "description": "Managed identity settings. Applicable when kind is ManagedIdentity."
        },
        "apiKey": {
          "$ref": "#/$defs/AiGatewayApiKeyCredential",
          "description": "API key configuration. Required when kind is ApiKey."
        }
      },
      "required": [
        "kind"
      ]
    },
    "AiGatewayFoundryProviderConfiguration": {
      "type": "object",
      "description": "Foundry model provider configuration.",
      "properties": {
        "endpoint": {
          "type": "string",
          "format": "uri",
          "description": "Foundry endpoint."
        },
        "resourceIds": {
          "type": "array",
          "description": "Cognitive Services account resource identifiers available to this provider.",
          "items": {
            "type": "string",
            "format": "arm-id",
            "description": "A type definition that refers the id to an Azure Resource Manager resource.",
            "x-ms-arm-id-details": {
              "allowedResources": [
                {
                  "type": "Microsoft.CognitiveServices/accounts"
                }
              ]
            }
          }
        },
        "authentication": {
          "$ref": "#/$defs/AiGatewayFoundryAuthentication",
          "description": "Authentication configuration."
        }
      },
      "required": [
        "resourceIds",
        "authentication"
      ]
    },
    "AiGatewayManagedIdentityAuthentication": {
      "type": "object",
      "description": "Managed identity settings for a model provider.",
      "properties": {
        "resource": {
          "type": "string",
          "description": "Token audience requested for managed identity authentication."
        },
        "clientId": {
          "type": "string",
          "description": "Client ID of a user-assigned managed identity."
        }
      }
    },
    "AiGatewayModelProviderAuthenticationKind": {
      "type": "string",
      "description": "Authentication type used by an AI model provider.",
      "enum": [
        "ManagedIdentity",
        "ApiKey"
      ],
      "x-ms-enum": {
        "name": "AiGatewayModelProviderAuthenticationKind",
        "modelAsString": true,
        "values": [
          {
            "name": "ManagedIdentity",
            "value": "ManagedIdentity",
            "description": "Authenticate using a managed identity."
          },
          {
            "name": "ApiKey",
            "value": "ApiKey",
            "description": "Authenticate using an API key."
          }
        ]
      }
    },
    "AiGatewayModelProviderKind": {
      "type": "string",
      "description": "The type of an AI model provider.",
      "enum": [
        "Foundry",
        "Custom"
      ],
      "x-ms-enum": {
        "name": "AiGatewayModelProviderKind",
        "modelAsString": true,
        "values": [
          {
            "name": "Foundry",
            "value": "Foundry",
            "description": "Azure AI Foundry provider."
          },
          {
            "name": "Custom",
            "value": "Custom",
            "description": "Custom model provider."
          }
        ]
      }
    },
    "AiGatewayModelProviderProperties": {
      "type": "object",
      "description": "Properties of an AI Gateway model provider.",
      "properties": {
        "kind": {
          "$ref": "#/$defs/AiGatewayModelProviderKind",
          "description": "Model provider type. This value cannot be changed after creation.",
          "x-ms-mutability": [
            "read",
            "create"
          ]
        },
        "name": {
          "type": "string",
          "description": "Display name of the model provider.",
          "x-ms-client-name": "displayName"
        },
        "description": {
          "type": "string",
          "description": "Description of the model provider."
        },
        "foundry": {
          "$ref": "#/$defs/AiGatewayFoundryProviderConfiguration",
          "description": "Foundry configuration. Required when kind is Foundry."
        },
        "custom": {
          "$ref": "#/$defs/AiGatewayCustomProviderConfiguration",
          "description": "Custom provider configuration. Required when kind is Custom."
        },
        "provisioningState": {
          "$ref": "#/$defs/AiGatewayProvisioningState",
          "description": "Provisioning state of the resource.",
          "readOnly": true
        }
      },
      "required": [
        "kind",
        "name"
      ]
    },
    "AiGatewayProvisioningState": {
      "type": "string",
      "description": "Provisioning state of an AI Gateway resource.",
      "enum": [
        "Succeeded",
        "Failed",
        "Canceled"
      ],
      "x-ms-enum": {
        "name": "AiGatewayProvisioningState",
        "modelAsString": true,
        "values": [
          {
            "name": "Succeeded",
            "value": "Succeeded",
            "description": "The resource is ready."
          },
          {
            "name": "Failed",
            "value": "Failed",
            "description": "The resource operation failed."
          },
          {
            "name": "Canceled",
            "value": "Canceled",
            "description": "The resource operation was canceled."
          }
        ]
      },
      "readOnly": true
    },
    "ProxyResource": {
      "type": "object",
      "title": "Proxy Resource",
      "description": "The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location",
      "allOf": [
        {
          "$ref": "#/$defs/Resource"
        }
      ]
    }
  }
}