# get_model_gateway

URL: https://codepanel.ai/docs/mcp-server/get_model_gateway

The CodePanel MCP tool that says whether agent runs' model calls go through the account's Cloudflare AI Gateway, without its token.

`get_model_gateway` reads the account's Cloudflare AI Gateway setting: whether agent runs' model calls on your own keys go through the gateway or straight to each provider. It needs the `read` scope.

## When to call it

- **Before relying on the gateway's cache or spend limit**, to see that it is `on`.
- **When a run's agent gets `gateway_refused`**, to see which gateway refused it.
- **To undo** [`set_model_gateway`](/docs/mcp-server/set_model_gateway): the values here are what it takes.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |


It only reads: the server marks it `readOnlyHint: true`, so clients that ask before a write can run it without asking.

## What it returns

`status`: `not_set`, `off`, `needs_token` (on, but calls go direct until the owner saves the gateway's token in the browser) or `on`. With `accountId`, `gatewayName`, `enabled`, `hasToken` (the token itself is never returned), `providers` (whose own-key calls take the gateway) and `message`, the next step in words.

A run's own counts are on [`get_run`](/docs/mcp-server/get_run) as `run.gateway`: `calls`, `fallbacks` (the gateway could not be reached, so the call went direct) and `cacheHits` (served from the gateway's cache, charged $0).

## The same step without MCP

| Surface | Form |
| --- | --- |
| HTTP API | `GET /autopilot/gateway` with the `read` scope |
| CLI | `codepanel gateway` |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Use it to see whether agent app model calls go through the account's Cloudflare AI Gateway or straight to each provider. Returns status (not_set|off|needs_token|on), accountId, gatewayName, enabled, hasToken (never the token), the providers routed through it, and message. A run's own counts are get_run's run.gateway: calls, fallbacks (gateway unreachable, sent direct) and cacheHits (answered from the gateway's cache, charged $0).

## Related

- [`set_model_gateway`](/docs/mcp-server/set_model_gateway): set it up, or turn it off.
- [Providers and keys](/docs/providers-and-keys): creating the gateway and saving its token.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
