Skip to main content

Create and manage model APIs (model services)

Create, share, and manage your own model APIs (model services) in Unity Catalog.

tip

The system-provided model APIs in the system.ai schema are ready to query with no setup. Create your own model API only when you want to govern additional models or expose a custom endpoint.

Requirements

  • A Databricks workspace in a Unity AI Gateway supported region.
  • Unity Catalog enabled for your workspace. See Enable a workspace for Unity Catalog.
  • To create a model service, you must have:
    • USE CATALOG, USE SCHEMA, and CREATE SERVICE on the catalog and schema where you create the model service.
    • EXECUTE on each model that the model service references as a destination.
    • EXECUTE, USE CATALOG, and USE SCHEMA on each model provider service that the model service references as a destination.
    • USE CATALOG, USE SCHEMA, and CREATE TABLE on the catalog and schema where the inference table is created, if you enable inference logging.

Create a model service

You can create a model service in the Unity AI Gateway UI or in Catalog Explorer, or programmatically with the REST API, the Databricks SDKs, the Databricks CLI, or Terraform.

Model services and model provider services share a single name namespace within a Unity Catalog schema. You can't use a name for a model service if a model provider service in the schema already uses it, and vice versa.

  1. Do one of the following:
    • In the workspace sidebar, click AI Gateway, then click Create.
    • In Catalog Explorer, go to the schema where you want to create the model service, then click Create > Service > Model service.
  2. Enter a name for the model service, and select the catalog and schema to create it in. If you start from Catalog Explorer, Catalog Explorer prefills the catalog and schema.
  3. Select the primary destination to serve. This destination can be a Databricks-hosted model that you have EXECUTE on and that Unity AI Gateway can serve, or a model provider service that you have EXECUTE, USE CATALOG, and USE SCHEMA on.
  4. Click Create.

After you create the model service, Databricks opens its overview page, where you can get started or configure additional features such as inference logging.

Grant access to a model service

By default, only the model service owner can query it. To let others query a model service, grant them EXECUTE on it, plus USE CATALOG and USE SCHEMA on its catalog and schema. If the model service logs to an inference table, grant SELECT on the table to let them read the logged requests and responses.

  1. Open the model service in Catalog Explorer, or go to AI Gateway and select the service.
  2. Go to the Permissions tab.
  3. Click Grant.
  4. Select the users, groups, or service principals to give access to.
  5. Select the EXECUTE privilege.
  6. Click Grant.

For more about granting and discovering access, see Discover and govern access to model APIs (model services).

Configure features on a model service

You configure features such as rate limits, inference logging, and guardrails on the model service from the Unity AI Gateway UI, the same way you configure them on an Unity AI Gateway endpoint. See:

Inference logging

When you enable inference logging, Databricks creates a new, empty Unity Catalog table with a predefined schema at the location you specify. Note the following:

  • You must have USE CATALOG, USE SCHEMA, and CREATE TABLE on the target catalog and schema.
  • The creator of the model service is the owner of the inference table. No other users have access unless you grant it.
  • If a table already exists at the specified location, creating the model service fails.
  • The inference table has an independent lifecycle from the model service. If you drop the table, the model service keeps working but stops logging.

For more about inference tables, see Log requests and responses to inference tables.

Update a model service

You must be an owner or have MANAGE.

Edit the model service's configuration from the Unity AI Gateway UI or Catalog Explorer. Changes apply in place.

Delete a model service

You must be an owner or have MANAGE. System-provided model services in system.ai cannot be deleted.

Open the model service in the Unity AI Gateway UI or Catalog Explorer and select Delete from the kebab menu.

Next steps