w.ai_gateway: AI Gateway¶
- class databricks.sdk.service.catalog.AiGatewayAPI¶
Govern AI workloads in Unity Catalog. This API manages the Unity Catalog securables that bring centralized access control, lineage, and auditing to AI-serving entities: model services (governed access to foundation models and external LLMs), model provider services (governed resources for external model providers), and MCP services (governed Model Context Protocol servers).
- create_mcp_service(mcp_service: McpService, parent: str, mcp_service_id: str) McpService¶
Creates an MCP service in a Unity Catalog schema. An MCP (Model Context Protocol) service is a governed securable that registers an MCP server and exposes its tools for discovery, access control, and invocation. Specify its name in
mcp_service_id.You must be the owner of the parent schema or have the
CREATE_SERVICEandUSE_SCHEMAprivileges on the parent schema andUSE_CATALOGon the parent catalog. You also needUSE_CONNECTIONon the connection the MCP service references.- Parameters:
mcp_service –
McpServiceThe MCP service to create. Do not setname; the server derives it fromparentandmcp_service_id.source_connectionis required.parent – str Name of the parent schema. Format:
schemas/{catalog}.{schema}. Each{...}component is capped at 255 characters individually.mcp_service_id – str Name for the MCP service, e.g. “my_mcp_service”.
- Returns:
- create_mcp_service_user_mapped_credential(name: str, login: McpServiceUserMappedCredentialLogin) McpServiceUserMappedCredential¶
Logs the caller in to an MCP service: creates their per-user OAuth credential, or re-authenticates it if one already exists. The request body carries the OAuth exchange fields.
You must be the owner of the MCP service or have
EXECUTEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema.- Parameters:
name – str Resource name of the MCP service. Format:
mcp-services/{catalog}.{schema}.{mcp_service}.
- Returns:
- create_model_provider_service(model_provider_service: ModelProviderService, parent: str, model_provider_service_id: str) ModelProviderService¶
Creates a model provider service in a Unity Catalog schema. A model provider service stores authentication and request configuration for an external model provider, such as OpenAI, Azure OpenAI, or Amazon Bedrock. Model services reference it to invoke the provider. Specify its name in
model_provider_service_id.You must be the owner of the parent schema or have the
CREATE_SERVICEandUSE_SCHEMAprivileges on the parent schema andUSE_CATALOGon the parent catalog. Inline credentials additionally requireCREATE_CONNECTIONon the parent schema. When using a Unity Catalog service credential, you must haveACCESSon that credential.- Parameters:
model_provider_service –
ModelProviderServiceThe model provider service to create. Do not setname; the server derives it fromparentandmodel_provider_service_id.parent – str Name of the parent schema. Format:
schemas/{catalog}.{schema}. Each{...}component is capped at 255 characters individually.model_provider_service_id – str Name for the model provider service, e.g. “openai_prod”.
- Returns:
- create_model_service(model_service: ModelService, parent: str, model_service_id: str) ModelService¶
Creates a model service in a Unity Catalog schema. A model service is a governed AI Gateway endpoint that routes inference requests to one or more model destinations. Specify its name in
model_service_id.You must be the owner of the parent schema or have the
CREATE_SERVICEandUSE_SCHEMAprivileges on the parent schema andUSE_CATALOGon the parent catalog. For every destination, you also needUSE_CATALOGandUSE_SCHEMAon its parent andEXECUTEon the referenced Unity Catalog model or model provider service. A provisioned-throughput destination additionally requiresCAN_MANAGEon its Model Serving endpoint. Configuring an inference table additionally requiresCREATE_TABLE.- Parameters:
model_service –
ModelServiceThe model service to create. Do not setname; the server derives it fromparentandmodel_service_id.parent – str Name of the parent schema. Format:
schemas/{catalog}.{schema}. Each{...}component is capped at 255 characters individually.model_service_id – str Name for the model service, e.g. “my_model_service”.
- Returns:
- delete_mcp_service(name: str [, etag: Optional[str]])¶
Deletes the MCP service identified by its resource name. Optionally supply an
etagto make the delete conditional on the MCP service not having changed since it was read.You must be the owner of the MCP service or have
MANAGEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema.- Parameters:
name – str Resource name of the MCP service. Format:
mcp-services/{catalog}.{schema}.{mcp_service}. Each{...}component is capped at 255 characters individually.etag – str (optional) Optimistic concurrency token from the most recent read. When set, the delete succeeds only if the resource has not changed. Leave unset for an unconditional delete. For REST requests, URL-encode the base64 string returned by the API when setting the
etagquery parameter.
- delete_mcp_service_user_mapped_credential(name: str) DeleteMcpServiceUserMappedCredentialResponse¶
Revokes (deletes) the caller’s per-user OAuth credential for an MCP service (logout).
You must be the owner of the MCP service or have
EXECUTEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema.- Parameters:
name – str Resource name of the MCP service. Format:
mcp-services/{catalog}.{schema}.{mcp_service}.- Returns:
- delete_model_provider_service(name: str [, etag: Optional[str]])¶
Deletes the model provider service identified by its resource name. Optionally supply an
etagto make the delete conditional on the model provider service not having changed since it was read.You must be the owner of the model provider service or have
MANAGEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema.- Parameters:
name – str Resource name of the model provider service. Format:
model-provider-services/{catalog}.{schema}.{model_provider_service}. Each{...}component is capped at 255 characters individually.etag – str (optional) Optimistic concurrency token from the most recent read. When set, the delete succeeds only if the resource has not changed. Leave unset for an unconditional delete. For REST requests, URL-encode the base64 string returned by the API when setting the
etagquery parameter.
- delete_model_service(name: str [, etag: Optional[str]])¶
Deletes the model service identified by its resource name. Optionally supply an
etagto make the delete conditional on the model service not having changed since it was read.You must be the owner of the model service or have
MANAGEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema.- Parameters:
name – str Resource name of the model service. Format:
model-services/{catalog}.{schema}.{model_service}. Each{...}component is capped at 255 characters individually.etag – str (optional) Optimistic concurrency token from the most recent read. When set, the delete succeeds only if the resource has not changed. Leave unset for an unconditional delete. For REST requests, URL-encode the base64 string returned by the API when setting the
etagquery parameter.
- get_mcp_service(name: str) McpService¶
Returns the MCP service identified by its resource name.
You must be the owner of the MCP service or have
EXECUTE,READ_METADATA, orMANAGEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema.- Parameters:
name – str Resource name of the MCP service. Format:
mcp-services/{catalog}.{schema}.{mcp_service}. Each{...}component is capped at 255 characters individually.- Returns:
- get_mcp_service_user_mapped_credential(name: str) McpServiceUserMappedCredential¶
Returns the caller’s per-user OAuth login state for an MCP service. Read
provisioning_info.state:ACTIVEmeans the caller is logged in and the credential is usable; any other state (for example a failed or still-provisioning login) means the login has not completed and the caller should log in again. If the caller has no credential yet, the RPC returnsNOT_FOUND.You must be the owner of the MCP service or have
EXECUTEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema.- Parameters:
name – str Resource name of the MCP service. Format:
mcp-services/{catalog}.{schema}.{mcp_service}.- Returns:
- get_model_provider_service(name: str) ModelProviderService¶
Returns the model provider service identified by its resource name.
You must be the owner of the model provider service or have
EXECUTE,READ_METADATA, orMANAGEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema.- Parameters:
name – str Resource name of the model provider service. Format:
model-provider-services/{catalog}.{schema}.{model_provider_service}. Each{...}component is capped at 255 characters individually.- Returns:
- get_model_service(name: str) ModelService¶
Returns the model service identified by its resource name.
You must be the owner of the model service or have
EXECUTE,READ_METADATA, orMANAGEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema.- Parameters:
name – str Resource name of the model service. Format:
model-services/{catalog}.{schema}.{model_service}. Each{...}component is capped at 255 characters individually.- Returns:
- list_mcp_services([, page_size: Optional[int], page_token: Optional[str], parent: Optional[str], view: Optional[ListMcpServicesRequestView]]) Iterator[McpService]¶
Lists the MCP services in a Unity Catalog schema. Provide
parentasschemas/{catalog}.{schema}. Results are paginated; pass the returnednext_page_tokento fetch subsequent pages.Requires
USE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema. Only MCP services the caller can access (as owner or throughEXECUTE,READ_METADATA, orMANAGE) are returned.- Parameters:
page_size – int (optional) Maximum number of MCP services to return. Defaults to 100 when unset or 0; the maximum is 100. Use
page_tokento retrieve additional pages.page_token – str (optional) Opaque pagination token from the previous response.
parent – str (optional) Parent schema to list within, in the form
schemas/{catalog}.{schema}. Required. Each{...}component is capped at 255 characters individually.view –
ListMcpServicesRequestView(optional) Fields to return for each service.FULLincludes source-connection details and rate-limit principal names.BASIComits the source connection and omits principal names from rate limits. Defaults toBASICwhen unset.
- Returns:
Iterator over
McpService
- list_model_provider_services([, page_size: Optional[int], page_token: Optional[str], parent: Optional[str], view: Optional[ListModelProviderServicesRequestView]]) Iterator[ModelProviderService]¶
Lists the model provider services in a Unity Catalog schema. Provide
parentasschemas/{catalog}.{schema}. Results are paginated; pass the returnednext_page_tokento fetch subsequent pages.Requires
USE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema. Only model provider services the caller can access (as owner or throughEXECUTE,READ_METADATA, orMANAGE) are returned.- Parameters:
page_size – int (optional) Maximum number of provider services to return. Defaults to 100 when unset or 0; the maximum is 100. Use
page_tokento retrieve additional pages.page_token – str (optional) Opaque pagination token from the previous response.
parent – str (optional) Parent schema to list within, in the form
schemas/{catalog}.{schema}. Required. Each{...}component is capped at 255 characters individually.view –
ListModelProviderServicesRequestView(optional) Fields to return for each service.FULLincludes resolved service-credential and inference-table details and rate-limit principal names.BASIComits those details and principal names from rate limits. Defaults toBASICwhen unset.
- Returns:
Iterator over
ModelProviderService
- list_model_services([, page_size: Optional[int], page_token: Optional[str], parent: Optional[str], view: Optional[ListModelServicesRequestView]]) Iterator[ModelService]¶
Lists the model services in a Unity Catalog schema. Provide
parentasschemas/{catalog}.{schema}. Results are paginated; pass the returnednext_page_tokento fetch subsequent pages.Requires
USE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema. Only model services the caller can access (as owner or throughEXECUTE,READ_METADATA, orMANAGE) are returned.- Parameters:
page_size – int (optional) Maximum number of model services to return. Defaults to 100 when unset or 0; the maximum is 100. Use
page_tokento retrieve additional pages.page_token – str (optional) Opaque pagination token from the previous response.
parent – str (optional) Parent schema to list within, in the form
schemas/{catalog}.{schema}. Required. Each{...}component is capped at 255 characters individually.view –
ListModelServicesRequestView(optional) Fields to return for each service.FULLincludes destinations, inference-table details, and rate-limit principal names.BASIComits destinations and inference-table details and omits principal names from rate limits. Defaults toBASICwhen unset.
- Returns:
Iterator over
ModelService
- update_mcp_service(name: str, mcp_service: McpService, update_mask: FieldMask [, etag: Optional[str]]) McpService¶
Updates an MCP service. Only the fields named in
update_maskare changed; the resource name is immutable. Optionally supply anetagto make the update conditional on the MCP service not having changed since it was read.You must be the owner of the MCP service or have
MANAGEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema. When changingconfig.source_connection.name, the MCP service owner must also haveUSE_CONNECTIONon the new connection.- Parameters:
name – str Resource name of the MCP service. Format:
mcp-services/{catalog}.{schema}.{mcp_service}. Each{...}component is capped at 255 characters individually. Server-derived on Create fromparent+mcp_service_id; required and immutable on Update/Get/Delete.mcp_service –
McpServiceThe MCP service with the updated field values.nameidentifies the resource (mcp-services/{catalog}.{schema}.{mcp_service}); only fields listed inupdate_maskare applied.update_mask – FieldMask Fields to update. Use
configto replace the entire configuration. The replacement must include every required field; any optional field you omit is cleared. To preserve sibling fields, use one or more granular paths:comment,config.source_connection.name,config.include_tool_selectors, orconfig.rate_limits.etag – str (optional) Optimistic concurrency token from the most recent read. When set, the update succeeds only if the resource has not changed. Leave unset for an unconditional update. For REST requests, URL-encode the base64 string returned by the API when setting the
etagquery parameter.
- Returns:
- update_model_provider_service(name: str, model_provider_service: ModelProviderService, update_mask: FieldMask [, etag: Optional[str]]) ModelProviderService¶
Updates a model provider service. Only the fields named in
update_maskare changed; the resource name and provider type are immutable. Optionally supply anetagto make the update conditional on the model provider service not having changed since it was read.You must be the owner of the model provider service or have
MANAGEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema.Updating
config.providercannot change the provider type or switch between Unity Catalog service-credential authentication and inline authentication.- Parameters:
name – str Resource name of the provider service. Format:
model-provider-services/{catalog}.{schema}.{model_provider_service}. Each{...}component is capped at 255 characters individually. Server-derived on Create fromparent+model_provider_service_id; required and immutable on Update/Get/Delete.model_provider_service –
ModelProviderServiceThe model provider service with the updated field values.nameidentifies the resource (model-provider-services/{catalog}.{schema}.{model_provider_service}); only fields listed inupdate_maskare applied.update_mask – FieldMask Fields to update. Use
configto replace the entire configuration. The replacement must include every required field; any optional field you omit is cleared. To preserve sibling fields, use one or more granular paths:comment;config.providerto replace the active provider-specific value (for example,config.openai; the mask path remainsconfig.provider);config.allow_all_targets,config.targets,config.forward_headers,config.forward_query_parameters,config.forward_unmanaged_paths,config.rate_limits, orconfig.inference_table. The provider type is immutable.etag – str (optional) Optimistic concurrency token from the most recent read. When set, the update succeeds only if the resource has not changed. Leave unset for an unconditional update. For REST requests, URL-encode the base64 string returned by the API when setting the
etagquery parameter.
- Returns:
- update_model_service(name: str, model_service: ModelService, update_mask: FieldMask [, etag: Optional[str]]) ModelService¶
Updates a model service. Only the fields named in
update_maskare changed; the resource name is immutable. Optionally supply anetagto make the update conditional on the model service not having changed since it was read.You must be the owner of the model service or have
MANAGEon it, plusUSE_CATALOGon the parent catalog andUSE_SCHEMAon the parent schema. When changing destinations, both you and the model service owner needUSE_CATALOGandUSE_SCHEMAon each destination’s parent andEXECUTEon the referenced Unity Catalog model or model provider service. A provisioned-throughput destination additionally requiresCAN_MANAGEfor you andCAN_QUERYfor the model service owner. Adding an inference table additionally requiresCREATE_TABLE.- Parameters:
name – str 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 fromparent+model_service_id; required and immutable on Update/Get/Delete.model_service –
ModelServiceThe model service with the updated field values.nameidentifies the resource (model-services/{catalog}.{schema}.{model_service}); only fields listed inupdate_maskare applied.update_mask – FieldMask Fields to update. Use
configto replace the entire configuration. The replacement must include every required field; any optional field you omit is cleared. To preserve sibling fields, use one or more granular paths:comment,config.routing.destinations,config.routing.fallback.destinations,config.rate_limits, orconfig.inference_table. Intermediate paths such asconfig.routingandconfig.routing.fallbackare not supported.etag – str (optional) Optimistic concurrency token from the most recent read. When set, the update succeeds only if the resource has not changed. Leave unset for an unconditional update. For REST requests, URL-encode the base64 string returned by the API when setting the
etagquery parameter.
- Returns: