> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.fabricgateway.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.fabricgateway.ai/_mcp/server.

# Restrict model and tool access

> Limit which models a connection serves, and which users can use a connection and its tools.

Fabric AI Gateway has two controls for who can use what. A model filter on an LLM connection limits which models it serves, for everyone. Access grants limit who can use a connection at all, and which paths or MCP tools they can call. This topic shows you how to set both, and how to combine them so different users get different models.

## Prerequisites

Before you begin, make sure you have the following:

* A connection and a route. For the steps, see [Connect an LLM provider](/configure/connections/llm-providers).
* Authentication on the route, such as Key Auth, so the gateway knows who each caller is. For the steps, see [Authenticate requests with Key Auth](/configure/authentication/key-auth).
* Permission to edit connections and to manage plugins. Grants are stored as Access Control plugin instances.

## Restrict the models a connection serves

To choose which models a connection serves, do the following:

1. In the sidebar, select **LLMs** > **Connections**, and then open the connection.
2. On the **Overview** tab, next to **Models**, select edit.
3. Choose one of the following, and then save:
   * **All current and future models** allows any model, including models the provider adds later.
   * **All current models** allows the models the provider offers today.
   * Select individual models to allow only those.

The gateway checks the model in each request against the list. The model comes from the `model` field, or from the URL path for providers such as Amazon Bedrock that put it there. If the model isn't on the list, the gateway returns `400` in the provider's error format, with a message such as `Model "gpt-4o" is not allowed for service "openai".` The request doesn't reach the provider.

If the connection restricts models and the gateway can't read a model from the request, for example because the body isn't valid JSON, it also returns `400`.

On a route with several connections, a connection that doesn't allow the model is skipped and the next one is tried. The client gets `400` only if no connection on the route allows it.

## Limit who can use a connection

A connection's access mode is **Open** or **Gated**. Anyone who can authenticate to a route can use an open connection. A gated connection serves only callers who hold a grant for it.

To gate a connection and grant access, do the following:

1. Open the connection. On the **Overview** tab, next to **Access**, select edit, choose **Gated**, and then save.
2. Select the **Access** tab, and then select **Add grant**.
3. For **Grant access to**, choose who the grant is for:
   * **User** gives one user access. Search for the user.
   * **Route** gives access to every authenticated caller of one route. Pick the route.
   * **Everyone** gives access to everyone who reaches this connection, on any route.
4. Optionally, narrow what the grant allows:
   * For an LLM or HTTP connection, turn on **Restrict methods** or **Restrict paths** and list the methods or path patterns.
   * For an MCP connection, turn on **Restrict tools** and list the tool names or patterns.
5. Select **Save grant**.

A grant with no restrictions allows everything on the connection, and the console marks it **Wide open**. Patterns use `*` to match any run of characters, including `/`, and matching is case-sensitive. Path patterns match the path the client called, before any route rewrite.

Grants only add access. There are no deny rules, so a caller can do anything that any of their grants allows.

Only the connection's access mode counts. An access mode set on a route has no effect, so gate the connection, not the route.

### What denied callers get

| Caller                                           | Response                            |
| ------------------------------------------------ | ----------------------------------- |
| Not authenticated, on a gated connection         | `401`                               |
| Authenticated, but no grant covers the request   | `403`                               |
| MCP `tools/call` for a tool the caller can't use | A JSON-RPC error with code `-32004` |

For MCP connections, the tool list that a caller sees leaves out the tools they can't call.

## Give different users different models

To give teams different sets of models from the same provider, do the following:

1. Create one connection for each set of models, and set each connection's model filter.
2. Gate each connection, and add grants for the users who should have each set.
3. Put the connections on the route that callers use, with the [LLM model router](/configure/routing/model-router).

The model router tries only the connections that the caller holds a grant for, and open connections. If the caller can't use any connection that serves the requested model, the gateway returns `403` with the message ``access denied for model `<name>` ``.

## Verify access

1. Send a request for a model that the connection doesn't allow. The gateway returns `400`.
2. Send a request with the gateway key of a user who has no grant on a gated connection. The gateway returns `403`.

## Next steps

* [Limit requests and tokens](/configure/access-and-limits/rate-limits)
* [Control spend with budgets](/configure/access-and-limits/budgets)
* [Manage users and invitations](/configure/organization/users)