> ## Documentation Index
> Fetch the complete documentation index at: https://ngrok.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate from Portkey to the ngrok AI Gateway

> Move your apps from Portkey to the ngrok AI Gateway by mapping provider keys, API keys, configs, and guardrails, then changing a few lines of client code.

If your apps call models through Portkey, you're deciding whether to follow it into Palo Alto Networks' Prisma AIRS or move your traffic somewhere else.
Palo Alto bought Portkey in May 2026.
The Prisma AIRS edition runs from Strata Cloud Manager and bills in Palo Alto flex credits, while the original Portkey product is still sold with no published end date.

The [ngrok AI Gateway](https://ngrok.com/docs/ai-gateway/overview.md) is a hosted gateway at `gateway.ngrok.ai` that accepts OpenAI, Anthropic, and Gemini API requests, so your apps keep the SDKs they use today.
ngrok hosts and upgrades it, and its price is public: a processing fee of \$0.05 per million tokens, paid from [credits](https://ngrok.com/docs/ai-gateway/concepts/credits.md).
Pay for OpenAI, Anthropic, Google, and other supported models with those credits, or bring your own provider key for any built-in provider.
For agent traffic, [Firewall](https://ngrok.com/docs/ai-gateway/concepts/firewall.md) checks each tool call a model returns and blocks risky ones before your agent runs them.

> [!NOTE]
>
> The ngrok AI Gateway doesn't yet have a built-in Vertex AI provider, an MCP gateway, response caching, per-key budgets, or PII redaction.
> It reaches Claude on Amazon Bedrock through the Anthropic and AWS SDKs, but not through OpenAI Chat Completions.
> If your apps depend on those Portkey features, read [the list of features without an equivalent yet](#features-without-an-equivalent-yet) before you decide.

This guide moves an app that calls models through Portkey to the ngrok AI Gateway.
You recreate your Portkey setup in app.ngrok.ai, run both gateways side by side, then cut over.

Most of the work is on the gateway side.
Client code usually changes in three places: the base URL, the API key, and the `model` string.

## What you'll need

* Your Portkey account, with an Admin API key or Workspace API key that can read configs, providers, guardrails, and API keys.
* An ngrok.ai account at [app.ngrok.ai](https://app.ngrok.ai) with [credits](https://ngrok.com/docs/ai-gateway/concepts/credits.md).
* An [AI Gateway API key](https://ngrok.com/docs/ai-gateway/concepts/access-keys.md#credentials-overview), if you want to script the setup instead of using the dashboard.
* The source code of the apps you're moving.

## 1. Inventory your Portkey setup

Portkey splits its setup between your code and its dashboard.
A default config attached to an API key can route every request without any trace of it in your code, so check both places.

### Search your code

Search your repositories for the strings that tie them to Portkey:

```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
rg -n --hidden \
  -e 'portkey' -e 'PORTKEY_' -e 'x-portkey-' \
  -e 'createHeaders' -e 'with_options\(' \
  -e 'virtual_key' -e 'virtualKey' \
  -e '"@[a-z0-9-]+/'
```

Each match tells you what to change:

| Match | What to change |
| - | - |
| `api.portkey.ai`, `aigw.portkey.ai`, or `PORTKEY_GATEWAY_URL` | The base URL |
| `portkey_ai` or `portkey-ai` imports, `Portkey(`, and `createHeaders` | Portkey SDK calls, which become plain OpenAI or Anthropic SDK calls |
| `x-portkey-*` headers | See [Map Portkey headers](#map-portkey-headers) |
| `@slug/model` strings and `virtual_key` values | The providers each app calls, which become provider keys and `provider:model` names |
| Checks for HTTP `246` or `446` | Error handling that reads Portkey guardrail results |

### Export your Portkey objects

Save the objects that hold your routing and credentials with the [Portkey Admin API](https://docs.portkey.ai/docs/api-reference/admin-api/introduction).
Run this once for each Portkey workspace, with an API key for that workspace:

```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
for resource in configs integrations providers guardrails api-keys; do
  curl -s "https://api.portkey.ai/v1/$resource" \
    -H "x-portkey-api-key: $PORTKEY_API_KEY" \
    > "portkey-$resource.json"
done
```

Each file maps to something you create in ngrok.ai:

| Portkey objects | What they become in ngrok.ai |
| - | - |
| Integrations and AI Providers (formerly virtual keys), in `portkey-integrations.json` and `portkey-providers.json` | [Provider keys](https://ngrok.com/docs/ai-gateway/guides/attaching-provider-keys.md) |
| API keys, with their default config, budget, and rate limit, in `portkey-api-keys.json` | [Access keys](https://ngrok.com/docs/ai-gateway/concepts/access-keys.md) and [access key configurations](https://ngrok.com/docs/ai-gateway/guides/access-key-configurations.md) |
| Configs (`pc-…`), in `portkey-configs.json` | [Virtual models](https://ngrok.com/docs/ai-gateway/guides/virtual-models.md) |
| Guardrails (`pg-…`), in `portkey-guardrails.json` | [Firewall policies](https://ngrok.com/docs/ai-gateway/concepts/firewall.md), in part |

In `portkey-api-keys.json`, check each key's `defaults.config_id`.
A key with a default config routes every request through that config, even when the app's code never mentions it.

If you manage Portkey with its Terraform provider, your state file already holds all of these.

## 2. Add your provider keys

Each Portkey AI Provider, such as `@openai-prod`, holds one provider credential.
Add each credential as a provider key in ngrok.ai, on the [**Providers**](https://app.ngrok.ai/providers) page or with the API:

```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
curl -X POST https://api.ngrok.ai/provider-keys \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "providerId": "openai",
    "name": "openai-prod",
    "value": "<OPENAI_API_KEY>"
  }'
```

Name each key after its Portkey slug so you can match them up later.

You don't need a provider key for every provider.
For OpenAI, Anthropic, Google, xAI, and [other providers that support it](https://ngrok.com/docs/ai-gateway/reference/model-catalog.md#billing-and-provider-credentials), skip the provider key and [pay with credits](https://ngrok.com/docs/ai-gateway/guides/pay-with-credits.md).

If you used several Portkey providers for the same upstream, such as two OpenAI keys for more rate-limit headroom, add both keys.
You order them in the next step.

### Amazon Bedrock

In Portkey, each Bedrock provider covers one AWS region, such as `@bedrock-us-east-1` and `@bedrock-us-west-2`.
In ngrok.ai, each Bedrock provider key covers one region, so add one key for each region you use.

ngrok.ai authenticates to Bedrock with a Bedrock API key.
If your Portkey Bedrock providers use IAM access keys or an assumed role, generate a long-term Bedrock API key in each AWS account first, as described in [Amazon Bedrock](https://ngrok.com/docs/ai-gateway/providers/bedrock.md#setup).
Bedrock always uses your own key; you can't pay for it with credits.

A key you add in the dashboard uses `us-east-1`.
To add a key for another region, set `aws.region` with the API:

```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
curl -X POST https://api.ngrok.ai/provider-keys \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "providerId": "bedrock",
    "name": "bedrock-us-west-2",
    "value": "<BEDROCK_API_KEY>",
    "aws": { "region": "us-west-2" }
  }'
```

A `us.` model ID from Portkey, such as `us.anthropic.claude-haiku-4-5-20251001-v1:0`, works with a key in any region, because the key's region decides where the request goes.
When the model doesn't run in that region, the gateway uses the inference profile for the region's geography.
A key in `eu-west-1` keeps the request in the EU.
See [Regions](https://ngrok.com/docs/ai-gateway/providers/bedrock.md#regions).

### Providers that aren't built in

Connect any OpenAI- or Anthropic-compatible endpoint as a [custom provider](https://ngrok.com/docs/ai-gateway/concepts/custom-providers.md).
For Azure OpenAI, follow [the Azure OpenAI guide](https://ngrok.com/docs/ai-gateway/custom-providers/azure-openai.md), with one custom provider per deployment or region.
Vertex AI isn't a built-in provider yet; see [Features without an equivalent yet](#features-without-an-equivalent-yet).

## 3. Recreate your API keys

In Portkey, a workspace groups API keys, providers, and configs for one team.
ngrok.ai has no workspace layer.
Give each team or app its own access key, and use an access key configuration to control what that key can call.

1. On [**Keys**](https://app.ngrok.ai/keys) → **Configurations**, create one configuration for each Portkey workspace or API key that had its own provider access.
2. Under **Access**, allow only the providers and models that team used.
3. Under **Routing**, add a rule for each provider:
   choose **Bring your own API key** and attach the provider keys from the previous step in the order to try them, or choose **ngrok** to pay with credits.
4. Create one access key for each Portkey API key you're replacing, and assign its configuration.

The same configuration through the API:

```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
curl -X POST https://api.ngrok.ai/access-key-configurations \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "search-team",
    "access": {
      "providers": { "allow": ["openai", "anthropic"] }
    },
    "router": {
      "rules": [
        {
          "provider": "openai",
          "steps": [
            {
              "type": "user",
              "keySelectionStrategy": "ordered",
              "keys": [{ "id": "<PRIMARY_PROVIDER_KEY_ID>" }, { "id": "<BACKUP_PROVIDER_KEY_ID>" }]
            }
          ]
        }
      ]
    }
  }'
```

When the first OpenAI key hits a rate limit or an auth error, the gateway tries the second.
See [Multi-key failover](https://ngrok.com/docs/ai-gateway/guides/key-selection-failover.md).

Put your regional Bedrock keys in one `bedrock` rule the same way, in the order to try their regions.
A rate limit in one region moves the request to the next region's key.
A server error or timeout doesn't: it skips your other Bedrock keys and moves to the next model.
If a Portkey config fails over between Bedrock regions during an outage, list a model on another provider after the Bedrock model in a virtual model, as in [Try Amazon Bedrock before Anthropic](https://ngrok.com/docs/ai-gateway/providers/bedrock.md#try-amazon-bedrock-before-anthropic).

app.ngrok.ai shows each access key token once, when you create it.
Store each token, which starts with `ng-`, where the app reads its Portkey key today.

## 4. Turn fallback configs into virtual models

A Portkey config with `"mode": "fallback"` becomes a [virtual model](https://ngrok.com/docs/ai-gateway/guides/virtual-models.md): a name your apps send as `model`, which stands for an ordered list of models.

This Portkey config tries OpenAI, then Anthropic:

```json Portkey config theme={"theme":{"light":"css-variables","dark":"css-variables"}}
{
  "strategy": { "mode": "fallback", "on_status_codes": [429, 500, 503] },
  "targets": [
    { "override_params": { "model": "@openai-prod/gpt-5.1" } },
    { "override_params": { "model": "@anthropic-prod/claude-sonnet-4-6" } }
  ]
}
```

Create the equivalent virtual model:

```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
curl -X POST https://api.ngrok.ai/virtual-models \
  -H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "chat-default",
    "models": ["openai:gpt-5.1", "anthropic:claude-sonnet-4-6"]
  }'
```

Apps then send `"model": "chat-default"`.
To change the models later, edit the virtual model; apps don't change.

Some config fields work differently:

| Portkey config | In ngrok.ai |
| - | - |
| `on_status_codes` and `retry` | The gateway fails over on rate limits, auth errors, server errors, timeouts, and connection failures, and returns other 4xx errors right away. You can't change that list or the number of attempts. See [what triggers failover](https://ngrok.com/docs/ai-gateway/guides/error-handling.md). |
| A default config on an API key that overrides `model` | Apps that send a model like `gpt-4o` need a new `model` value, because a virtual model can't share a name with a model your account can call. |
| `loadbalance` and `conditional` strategies | The gateway doesn't split traffic by weight or route on metadata. Pick the order you want most requests to use, or give each route its own virtual model. |
| Per-request configs in `x-portkey-config` | Put the fallback list in the request body's [`models` array](https://ngrok.com/docs/ai-gateway/guides/configure-fallback-models). |

## 5. Recreate guardrails with Firewall

[Firewall](https://ngrok.com/docs/ai-gateway/concepts/firewall.md) checks what an app sends to a model and each tool call the model returns.
It covers some of what Portkey guardrails do:

| Portkey guardrail | Firewall equivalent |
| - | - |
| Regex match on input | Regex rule on request messages |
| Prompt injection or custom LLM check on input | Decision rule on request messages, written in plain language |
| Allow or deny tools in the request | Tool names rule on tool definitions |
| Checks on MCP tool calls | Tool names or regex rule on tool calls, such as `mcp__github__delete_*` |
| PII detection and redaction, output text checks, partner guardrails | None yet |

Attach a policy to the access key configuration for each team, or apply it to every key as your baseline.
Start in dry run mode to see what it would block on real traffic.
See [Guard agent tool calls with Firewall](https://ngrok.com/docs/ai-gateway/guides/firewall-policies.md).

Blocks look different to your app.
Portkey returns HTTP `446` when a guardrail denies a request.
Firewall returns HTTP `200` with an assistant message that explains the block and a `safeguard_results` field, so the model or agent can continue.
Update any error handling that checks for `246` or `446`.

## 6. Change your client code

Your apps keep their OpenAI or Anthropic SDK.
Change the base URL, the key, and the `model` string, and remove Portkey headers.

### OpenAI SDK with a Portkey key

```python Before theme={"theme":{"light":"css-variables","dark":"css-variables"}}
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.portkey.ai/v1",
    api_key=os.environ["PORTKEY_API_KEY"],
)

client.chat.completions.create(
    model="@openai-prod/gpt-5.1",
    messages=[{"role": "user", "content": "Hello"}],
)
```

```python After theme={"theme":{"light":"css-variables","dark":"css-variables"}}
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.ngrok.ai/v1",
    api_key=os.environ["NGROK_AI_ACCESS_KEY"],
)

client.chat.completions.create(
    model="openai:gpt-5.1",  # or a virtual model, such as "chat-default"
    messages=[{"role": "user", "content": "Hello"}],
)
```

### OpenAI SDK with createHeaders

Apps that pass Portkey settings through `createHeaders` send a provider key or a placeholder as `api_key`.
Replace it with your access key and drop the headers.

```typescript Before theme={"theme":{"light":"css-variables","dark":"css-variables"}}
import OpenAI from "openai";
import { PORTKEY_GATEWAY_URL, createHeaders } from "portkey-ai";

const client = new OpenAI({
  apiKey: "unused",
  baseURL: PORTKEY_GATEWAY_URL,
  defaultHeaders: createHeaders({
    apiKey: process.env.PORTKEY_API_KEY,
    virtualKey: "openai-prod",
    config: "pc-chat-default",
  }),
});
```

```typescript After theme={"theme":{"light":"css-variables","dark":"css-variables"}}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.NGROK_AI_ACCESS_KEY,
  baseURL: "https://gateway.ngrok.ai/v1",
});
```

The routing that `virtualKey` and `config` did now lives in the access key's configuration and in the virtual model your app sends as `model`.

### Portkey SDK

Replace `Portkey` with the OpenAI client.
`Portkey` accepts the same calls as the OpenAI SDK, so `client.chat.completions.create(...)` calls don't change.

```python Before theme={"theme":{"light":"css-variables","dark":"css-variables"}}
import os
from portkey_ai import Portkey

client = Portkey(
    api_key=os.environ["PORTKEY_API_KEY"],
    config="pc-chat-default",
)
```

```python After theme={"theme":{"light":"css-variables","dark":"css-variables"}}
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://gateway.ngrok.ai/v1",
    api_key=os.environ["NGROK_AI_ACCESS_KEY"],
)
```

Calls that only exist in the Portkey SDK, such as `portkey.prompts.completions.create` and `portkey.feedback`, have no equivalent.

### Anthropic SDK

```python Before theme={"theme":{"light":"css-variables","dark":"css-variables"}}
import os
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.portkey.ai",
    api_key="unused",
    default_headers={"x-portkey-api-key": os.environ["PORTKEY_API_KEY"]},
)
```

```python After theme={"theme":{"light":"css-variables","dark":"css-variables"}}
import os
import anthropic

client = anthropic.Anthropic(
    base_url="https://gateway.ngrok.ai",
    api_key=os.environ["NGROK_AI_ACCESS_KEY"],
)
```

Replace `@slug/claude-…` model names the same way as for the OpenAI SDK.
The Google Gen AI SDK follows the same pattern; see [Google Gen AI SDK](https://ngrok.com/docs/ai-gateway/sdks/google.md).

### Models on Amazon Bedrock

Portkey translates OpenAI Chat Completions requests for any Bedrock model.
The ngrok AI Gateway doesn't translate them for Claude or most other Bedrock models yet, so apps that reach Bedrock through the OpenAI SDK switch SDKs as well as base URLs:

| Bedrock models | Call them through ngrok.ai with |
| - | - |
| Claude Haiku 4.5, Sonnet 4.6, Opus 4.5, and Opus 4.6 | The Anthropic SDK and a model such as `bedrock:anthropic/claude-haiku-4-5`, or the AWS SDK's InvokeModel and the Bedrock model ID |
| Gemma 4 | The OpenAI SDK, in Chat Completions or Responses, and a model such as `bedrock:google/gemma-4-31b-it` |
| Every other Bedrock model in the catalog | The AWS SDK's Converse and the Bedrock model ID, such as `openai.gpt-oss-20b-1:0` |

This example moves an app's calls to Claude Haiku 4.5 on Bedrock from the OpenAI SDK to the Anthropic SDK:

```python Before theme={"theme":{"light":"css-variables","dark":"css-variables"}}
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.portkey.ai/v1",
    api_key=os.environ["PORTKEY_API_KEY"],
)

client.chat.completions.create(
    model="@bedrock-us-east-1/us.anthropic.claude-haiku-4-5-20251001-v1:0",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
```

```python After theme={"theme":{"light":"css-variables","dark":"css-variables"}}
import os
import anthropic

client = anthropic.Anthropic(
    base_url="https://gateway.ngrok.ai",
    api_key=os.environ["NGROK_AI_ACCESS_KEY"],
)

client.messages.create(
    model="bedrock:anthropic/claude-haiku-4-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
```

The `bedrock:` prefix keeps the request on Bedrock.
Without it, `anthropic/claude-haiku-4-5` goes to Anthropic first.
To try Bedrock first and fall back to Anthropic, list both in a virtual model; see [Try Amazon Bedrock before Anthropic](https://ngrok.com/docs/ai-gateway/providers/bedrock.md#try-amazon-bedrock-before-anthropic).

For the AWS SDK, point the client's `endpoint_url` at `https://gateway.ngrok.ai` and set `AWS_BEARER_TOKEN_BEDROCK` to your ngrok.ai access key, the token that starts with `ng-`.
See [Native Bedrock requests](https://ngrok.com/docs/ai-gateway/providers/bedrock.md#native-bedrock-requests).

### Map model names

| Portkey `model` | ngrok.ai `model` |
| - | - |
| `@openai-prod/gpt-5.1` | `openai:gpt-5.1`, or `gpt-5.1` to let the gateway pick any provider that serves it |
| `@anthropic-prod/claude-sonnet-4-6` | `anthropic:claude-sonnet-4-6` |
| `@bedrock-us-east-1/us.anthropic.claude-haiku-4-5-20251001-v1:0` | `bedrock:anthropic/claude-haiku-4-5`, sent with the Anthropic SDK |
| `@my-azure/gpt-4o` | `my-azure:gpt-4o`, where `my-azure` is your custom provider ID |
| `gpt-4o` routed by a config | The virtual model that replaced the config |

The gateway picks the provider key from the access key's configuration, not from the model string.
See [Choose a model](https://ngrok.com/docs/ai-gateway/guides/model-selection-strategies.md).

## 7. Run both gateways and cut over

Before you move an app, send one request with its new access key and read the headers:

```bash theme={"theme":{"light":"css-variables","dark":"css-variables"}}
curl -i https://gateway.ngrok.ai/v1/chat/completions \
  -H "Authorization: Bearer $NGROK_AI_ACCESS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "chat-default",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

```http theme={"theme":{"light":"css-variables","dark":"css-variables"}}
HTTP/2 200
ngrok-aig-request-id: rq_2abcDEF456
ngrok-aig-attempts: 1
ngrok-aig-model: gpt-5.1
```

`ngrok-aig-model` names the model that answered, the first one in `chat-default` here, and `ngrok-aig-attempts` counts the upstream attempts the gateway made.
An error names what blocked the request, such as a provider the key's configuration doesn't allow; see [Error codes](https://ngrok.com/docs/ai-gateway/reference/error-codes.md).

Then move traffic over:

1. Point one app, or one environment of it, at ngrok.ai and leave the rest on Portkey.
2. Check each response's `Ngrok-AIG-Model` header to confirm the model you expect answered, and `Ngrok-AIG-Removed-Params` for request fields a provider didn't accept.
3. Compare cost and token counts on the [**Activity**](https://app.ngrok.ai/activity) page, or with the [Usage API](https://ngrok.com/docs/ai-gateway/observability.md), against your Portkey logs.
4. Move the remaining apps.
5. Revoke the Portkey API keys once their traffic stops.

Until you revoke those keys, moving an app back to Portkey means restoring its old base URL, key, and `model` values.

Log each response's `Ngrok-AIG-Request-Id` in your app.
It's how you look up a request later; see [Why a request failed over](https://ngrok.com/docs/ai-gateway/guides/why-a-request-failed-over.md).

## Map Portkey headers

ngrok.ai doesn't read `x-portkey-*` headers.
Remove them, or replace them as follows:

| Portkey header | In ngrok.ai |
| - | - |
| `x-portkey-api-key` | Send your access key as `Authorization: Bearer`, or as `x-api-key` with the Anthropic SDK |
| `x-portkey-provider`, `x-portkey-virtual-key` | The access key's configuration, plus `provider:model` in the request |
| `x-portkey-config` | A virtual model, or the `models` array in the request body |
| `x-portkey-trace-id`, `x-portkey-span-*` | None. The gateway assigns each request an ID and returns it in the `Ngrok-AIG-Request-Id` response header; log it next to your own trace ID |
| `x-portkey-metadata` | None. With [request capture](https://ngrok.com/docs/ai-gateway/guides/account-settings.md#request-capture) on, the request details panel shows the headers you sent |
| `x-portkey-cache-*` | None. See [Features without an equivalent yet](#features-without-an-equivalent-yet) |
| `x-portkey-request-timeout` | Account-wide timeouts in [Account Settings](https://ngrok.com/docs/ai-gateway/guides/account-settings.md) |
| `x-portkey-forward-headers` | None |

## Features without an equivalent yet

| Portkey feature | What to do meanwhile |
| - | - |
| Claude and most other Bedrock models through Chat Completions | Call Claude with the Anthropic SDK and other Bedrock models with the AWS SDK. See [Models on Amazon Bedrock](#models-on-amazon-bedrock). |
| Bedrock models outside the catalog, and `global.` inference profiles | Use a model from the [Amazon Bedrock catalog](https://ngrok.com/docs/ai-gateway/reference/model-catalog.md#amazon-bedrock), with a regional ID such as `us.` or `eu.`. |
| Bedrock failover to another region on server errors and timeouts | Rate limits still move to the next region's key. For outages, list a model on another provider after the Bedrock model in a virtual model. |
| Vertex AI provider | Call Gemini models through the built-in [Google provider](https://ngrok.com/docs/ai-gateway/providers/google.md), and keep Model Garden routes on Portkey for now. |
| MCP gateway and MCP registry | Keep MCP traffic where it is. To block specific MCP tools in model traffic, use a Firewall tool names rule. |
| Simple and semantic caching | Cache in your app. |
| Per-key budgets and rate limits | Use account-wide [token limits](https://ngrok.com/docs/ai-gateway/guides/account-settings.md#token-limits) and track spend per key with the [Usage API](https://ngrok.com/docs/ai-gateway/observability.md), grouped by `accessKey`. |
| PII redaction and partner guardrails | Redact in your app before sending. |
| Weighted load balancing and conditional routing | Use an ordered virtual model, or a separate access key per route. |
| Workspaces and in-app roles | Use an access key and configuration per team. Dashboard sign-in supports [SSO](https://ngrok.com/docs/iam/sso.md). |
| Prompt templates | Keep prompts in your code. |
| Realtime and batch APIs | Call the provider directly. |
| OpenTelemetry or log export | ngrok.ai has no push export. Read usage events with the [Usage API](https://ngrok.com/docs/ai-gateway/observability.md). |
| Terraform provider | Script setup with the [AI Gateway API](https://ngrok.com/docs/ai-gateway/api-reference/overview.md) and its [OpenAPI spec](https://api.ngrok.ai/openapi.yaml). |

## Next steps

* [Virtual models](https://ngrok.com/docs/ai-gateway/guides/virtual-models.md): Change models for every app without changing code.
* [Access key configurations](https://ngrok.com/docs/ai-gateway/guides/access-key-configurations.md): Control what each key can call.
* [Firewall](https://ngrok.com/docs/ai-gateway/concepts/firewall.md): Check requests and tool calls.
* [Handle gateway errors](https://ngrok.com/docs/ai-gateway/guides/error-handling.md): Learn which failures the gateway retries.
* [AI Gateway API](https://ngrok.com/docs/ai-gateway/api-reference/overview.md): Automate the setup in this guide.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.