Skip to content

AiGatewayModelService

laktory.models.resources.databricks.AiGatewayModelService ¤

Bases: AiGatewayModelServiceBase

Databricks AI Gateway model service

Stable, Unity Catalog governed endpoint routing inference requests to one or more destinations (Databricks foundation models, provisioned throughput or external model provider services), with rate limits, fallbacks and inference tables.

Examples:

import io

from laktory import models

service_yaml = '''
parent: schemas/dev.ai
model_service_id: customer_support
comment: Routes customer support requests
config:
  routing:
    destinations:
    - name: primary
      destination_type: DESTINATION_TYPE_PAY_PER_TOKEN_FOUNDATION_MODEL
      pay_per_token_config:
        model: models/system.ai.databricks-gpt-5
      traffic_percentage: 100
'''
service = models.resources.databricks.AiGatewayModelService.model_validate_yaml(
    io.StringIO(service_yaml)
)
References
BASE DESCRIPTION
comment

User-provided description

TYPE: str | None | VariableType DEFAULT: None

config

Destinations, routing, rate limits, and payload logging configuration. Required on Create. On Update, provide this field when update_mask contains config or one of its subpaths

TYPE: AiGatewayModelServiceConfig | None | VariableType DEFAULT: None

model_service_id

Name for the model service, e.g. 'my_model_service'

TYPE: str | VariableType

parent

Parent Unity Catalog schema where the inference table is created, in the form schemas/{catalog}.{schema}. Required when configuring an inference table. After the inference table is created, this field cannot be changed

TYPE: str | VariableType

provider_config

Configure the provider for management through account provider

TYPE: AiGatewayModelServiceProviderConfig | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfig ¤

Bases: BaseModel

PARAMETER DESCRIPTION
inference_table

Inference table configuration for payload logging

TYPE: AiGatewayModelServiceConfigInferenceTable | None | VariableType DEFAULT: None

rate_limits

Rate limits applied to requests routed through this model service

TYPE: list[AiGatewayModelServiceConfigRateLimits] | None | VariableType DEFAULT: None

routing

Routing configuration: destinations and fallback

TYPE: AiGatewayModelServiceConfigRouting | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigInferenceTable ¤

Bases: BaseModel

PARAMETER DESCRIPTION
parent

Parent Unity Catalog schema where the inference table is created, in the form schemas/{catalog}.{schema}. Required when configuring an inference table. After the inference table is created, this field cannot be changed

TYPE: str | VariableType

table_name_prefix

Prefix used to form the inference table's registered name. AI Gateway appends _payload; for example, table_name_prefix = 'orders' creates orders_payload. If unset, the prefix defaults to the service name. Read table from the response for the resulting resource name. After the inference table is created, this field cannot be changed

TYPE: str | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRateLimits ¤

Bases: BaseModel

PARAMETER DESCRIPTION
key

Scope of the rate limit. Depending on this value, the limit applies to a principal, the service as a whole, or each user by default. Possible values are: RATE_LIMIT_KEY_SERVICE, RATE_LIMIT_KEY_SERVICE_PRINCIPAL, RATE_LIMIT_KEY_USER, RATE_LIMIT_KEY_USER_DEFAULT, RATE_LIMIT_KEY_USER_GROUP

TYPE: str | VariableType

principal

Principal this limit applies to: user email, group name, or service principal application ID. Required when key applies to a user, group, or service principal; otherwise it must be unset

TYPE: str | None | VariableType DEFAULT: None

renewal_period

Renewal period. Possible values are: RATE_LIMIT_RENEWAL_PERIOD_HOUR, RATE_LIMIT_RENEWAL_PERIOD_MINUTE

TYPE: str | VariableType

requests

Maximum requests allowed in one renewal period. Leave unset for no request limit. Set to 0 to deny all requests

TYPE: int | None | VariableType DEFAULT: None

tokens

Maximum tokens allowed in one renewal period. Leave unset for no token limit. Set to 0 to deny all requests

TYPE: int | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRouting ¤

Bases: BaseModel

PARAMETER DESCRIPTION
destinations

Primary routing destinations. At most 10 are allowed. At least one is required on Create. On Update, provide this list when replacing the full config or updating config.routing.destinations; other granular routing updates do not require resending destinations. The intermediate config.routing mask path is not supported

TYPE: list[AiGatewayModelServiceConfigRoutingDestinations] | None | VariableType DEFAULT: None

fallback

Fallback routing applied after a primary destination fails. Fallback destinations are tried in the listed order

TYPE: AiGatewayModelServiceConfigRoutingFallback | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingDestinations ¤

Bases: BaseModel

PARAMETER DESCRIPTION
destination_type

Backing-model category. Provide the matching type-specific configuration and leave the other type-specific configurations unset. Possible values are: DESTINATION_TYPE_EXTERNAL_FOUNDATION_MODEL, DESTINATION_TYPE_PAY_PER_TOKEN_FOUNDATION_MODEL, DESTINATION_TYPE_PROVISIONED_THROUGHPUT_FOUNDATION_MODEL

TYPE: str | VariableType

external_model_config

Configuration for an external model reached through a model provider service

TYPE: AiGatewayModelServiceConfigRoutingDestinationsExternalModelConfig | None | VariableType DEFAULT: None

name

Resource name of the model service. Format: model-services/{catalog}.{schema}.{model_service}. Each {...} component is capped at 255 characters individually. Server-derived on Create from parent + model_service_id; required and immutable on Update/Get/Delete

TYPE: str | VariableType

pay_per_token_config

Configuration for a pay-per-token Databricks foundation model

TYPE: AiGatewayModelServiceConfigRoutingDestinationsPayPerTokenConfig | None | VariableType DEFAULT: None

provisioned_throughput_config

Configuration for a provisioned-throughput Databricks foundation model

TYPE: AiGatewayModelServiceConfigRoutingDestinationsProvisionedThroughputConfig | None | VariableType DEFAULT: None

traffic_percentage

Percentage of primary traffic sent to this destination, from 0 to 100. Required when there is more than one primary destination, in which case the primary percentages must sum to 100; a single primary destination receives all traffic. Fallback destinations are ordered and do not use this field

TYPE: int | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingDestinationsExternalModelConfig ¤

Bases: BaseModel

PARAMETER DESCRIPTION
model_provider_service

Resource name of the governed ModelProviderService that owns provider auth and provider-specific configuration. The referenced ModelProviderService also carries the provider type, so this message does not surface it directly. Format: model-provider-services/{catalog}.{schema}.{model_provider_service}. Each {...} component is capped at 255 characters individually

TYPE: str | VariableType

target

Routing target for the destination: the provider-side model selected from the referenced ModelProviderService's targets catalog, plus the unified API types the platform should translate to/from at request time

TYPE: AiGatewayModelServiceConfigRoutingDestinationsExternalModelConfigTarget | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingDestinationsExternalModelConfigTarget ¤

Bases: BaseModel

PARAMETER DESCRIPTION
model

UC model FQN of the model served by the backing endpoint (e.g., system.ai.databricks-claude-opus-4-6). Resolved from Model Serving at Create/Update time

TYPE: str | VariableType

native_api_types

Provider-native API types supported by this model, such as openai/v1/chat/completions. At least one value is required. AI Gateway uses these values to translate requests and responses. At most 64 entries of 256 characters each are allowed

TYPE: list[str] | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingDestinationsPayPerTokenConfig ¤

Bases: BaseModel

PARAMETER DESCRIPTION
model

UC model FQN of the model served by the backing endpoint (e.g., system.ai.databricks-claude-opus-4-6). Resolved from Model Serving at Create/Update time

TYPE: str | VariableType


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingDestinationsProvisionedThroughputConfig ¤

Bases: BaseModel

PARAMETER DESCRIPTION
model_serving_endpoint

Name of the backing Model Serving endpoint serving the provisioned- throughput foundation model, in the form serving-endpoints/{name}. The same Unity Catalog model can be served on multiple Model Serving endpoints with different throughput, regions, or configurations. The caller selects the endpoint to which this destination routes. The endpoint must exist at create time

TYPE: str | VariableType


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingFallback ¤

Bases: BaseModel

PARAMETER DESCRIPTION
destinations

Primary routing destinations. At most 10 are allowed. At least one is required on Create. On Update, provide this list when replacing the full config or updating config.routing.destinations; other granular routing updates do not require resending destinations. The intermediate config.routing mask path is not supported

TYPE: list[AiGatewayModelServiceConfigRoutingFallbackDestinations] | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingFallbackDestinations ¤

Bases: BaseModel

PARAMETER DESCRIPTION
destination_type

Backing-model category. Provide the matching type-specific configuration and leave the other type-specific configurations unset. Possible values are: DESTINATION_TYPE_EXTERNAL_FOUNDATION_MODEL, DESTINATION_TYPE_PAY_PER_TOKEN_FOUNDATION_MODEL, DESTINATION_TYPE_PROVISIONED_THROUGHPUT_FOUNDATION_MODEL

TYPE: str | VariableType

external_model_config

Configuration for an external model reached through a model provider service

TYPE: AiGatewayModelServiceConfigRoutingFallbackDestinationsExternalModelConfig | None | VariableType DEFAULT: None

name

Resource name of the model service. Format: model-services/{catalog}.{schema}.{model_service}. Each {...} component is capped at 255 characters individually. Server-derived on Create from parent + model_service_id; required and immutable on Update/Get/Delete

TYPE: str | VariableType

pay_per_token_config

Configuration for a pay-per-token Databricks foundation model

TYPE: AiGatewayModelServiceConfigRoutingFallbackDestinationsPayPerTokenConfig | None | VariableType DEFAULT: None

provisioned_throughput_config

Configuration for a provisioned-throughput Databricks foundation model

TYPE: AiGatewayModelServiceConfigRoutingFallbackDestinationsProvisionedThroughputConfig | None | VariableType DEFAULT: None

traffic_percentage

Percentage of primary traffic sent to this destination, from 0 to 100. Required when there is more than one primary destination, in which case the primary percentages must sum to 100; a single primary destination receives all traffic. Fallback destinations are ordered and do not use this field

TYPE: int | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingFallbackDestinationsExternalModelConfig ¤

Bases: BaseModel

PARAMETER DESCRIPTION
model_provider_service

Resource name of the governed ModelProviderService that owns provider auth and provider-specific configuration. The referenced ModelProviderService also carries the provider type, so this message does not surface it directly. Format: model-provider-services/{catalog}.{schema}.{model_provider_service}. Each {...} component is capped at 255 characters individually

TYPE: str | VariableType

target

Routing target for the destination: the provider-side model selected from the referenced ModelProviderService's targets catalog, plus the unified API types the platform should translate to/from at request time

TYPE: AiGatewayModelServiceConfigRoutingFallbackDestinationsExternalModelConfigTarget | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingFallbackDestinationsExternalModelConfigTarget ¤

Bases: BaseModel

PARAMETER DESCRIPTION
model

UC model FQN of the model served by the backing endpoint (e.g., system.ai.databricks-claude-opus-4-6). Resolved from Model Serving at Create/Update time

TYPE: str | VariableType

native_api_types

Provider-native API types supported by this model, such as openai/v1/chat/completions. At least one value is required. AI Gateway uses these values to translate requests and responses. At most 64 entries of 256 characters each are allowed

TYPE: list[str] | None | VariableType DEFAULT: None


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingFallbackDestinationsPayPerTokenConfig ¤

Bases: BaseModel

PARAMETER DESCRIPTION
model

UC model FQN of the model served by the backing endpoint (e.g., system.ai.databricks-claude-opus-4-6). Resolved from Model Serving at Create/Update time

TYPE: str | VariableType


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceConfigRoutingFallbackDestinationsProvisionedThroughputConfig ¤

Bases: BaseModel

PARAMETER DESCRIPTION
model_serving_endpoint

Name of the backing Model Serving endpoint serving the provisioned- throughput foundation model, in the form serving-endpoints/{name}. The same Unity Catalog model can be served on multiple Model Serving endpoints with different throughput, regions, or configurations. The caller selects the endpoint to which this destination routes. The endpoint must exist at create time

TYPE: str | VariableType


laktory.models.resources.databricks.aigatewaymodelservice.AiGatewayModelServiceProviderConfig ¤

Bases: BaseModel

PARAMETER DESCRIPTION
workspace_id

Workspace ID which the resource belongs to. This workspace must be part of the account which the provider is configured with

TYPE: str | None | VariableType DEFAULT: None