AI Border Gateway capabilities
The full capability reference for AI Border Gateway.
Cortega configures every policy from the management console; you never hand-edit gateway config directly. This page is the reference for what AI Border Gateway does on every request.
For how to set these up, see the Guides. For the product overview, see AI Border Gateway.
Authentication: who is calling
Every request is tied to an identity before anything else runs.
- API keys. Cortega issues keys scoped to a team or an application. Each key carries its team and tenant, so usage, cost, and policy all resolve from the key.
- JWT / bearer tokens. Cortega validates tokens from your identity provider (JWKS, issuer, audience). Claims in the token map to a Cortega team.
- OIDC browser login. For the browser-facing surfaces, sign in through your identity provider.
- Basic auth. Username and password for simple internal callers, mapped to a team.
- MCP OAuth. For MCP clients, Cortega acts as an OAuth resource server: it validates tokens, serves the protected-resource metadata MCP clients discover, and works with Auth0, Keycloak, and Authentik.
- Multiple methods at once. When more than one method applies to a route, Cortega also enforces an "any valid identity" check, so a forged token that resolves to no identity is rejected.
Authorization: what the caller may do
- MCP tool governance. Grant a team access to specific MCP servers,
and within a server to specific tools. Checked on every
tools/call, and the tool list a client sees is filtered to what it may use. If a server has no policy, it is denied (fail closed). - Model access. A team only reaches the models it is authorized for; Cortega rewrites the request to the team's routing target.
Routing
- Providers and models. Register any number of LLM providers and models. A request names a model; Cortega resolves it to a configured model.
- Virtual models. Publish one model name and route it across several real models by weight, by failover priority, or by a condition on the request.
- Health-based failover. AI Border Gateway tracks each model's errors and latency and stops routing to a model that is failing or slow until it recovers.
- Same-request retry. A failed call retries against a configured set of retryable status codes, with backoff, before the caller sees an error.
- Model aliasing. Present a clean model name to callers while the upstream name and provider prefix are handled behind the scenes.
LLM API surface
AI Border Gateway speaks the major LLM wire formats, so existing SDKs work unchanged:
- OpenAI Chat Completions and Responses
- Anthropic Messages
- Native Gemini (
generateContent) - Embeddings, rerank, realtime, and the Anthropic token-count endpoint, per provider
Guardrails
Guardrails run on the request before it leaves Cortega and on the response before it returns to the caller. Apply them globally or bind them to a specific key, model, MCP server, or MCP tool. Several can run in sequence on the same traffic. MCP guardrails scan the arguments a tool is called with and the content it returns.
| Type | Phase | What it does |
|---|---|---|
| Regex | Request, response, or both | Built-in detectors (SSN, credit card, phone, email, CA SIN) plus your own patterns. Masks or blocks. No external call. |
| Presidio | Request, response, or both | Microsoft Presidio entity detection and anonymization, including custom recognizers. |
| Webhook | Request, response, or both | Calls your HTTP endpoint on Cortega's guardrail webhook contract. |
| OpenAI moderation | Request or response | Calls the OpenAI moderations API. |
| Local model | Request or response | Calls a classifier you host. No upstream credential. |
| Azure AI Content Safety | Request or response | Calls Azure AI Content Safety. |
| Google Model Armor | Request or response | Calls Google Model Armor. |
| Bedrock Guardrails | Request or response | Applies an AWS Bedrock guardrail. |
| State setter | Before every other guardrail on the message | Records a regex or JSONPath value into a named variable. Never blocks. |
| State checker | Request or response | Compares a variable a State setter recorded. Rejects, flags, or allow-lists. |
| Social engineering | Request | Authority impersonation, manufactured urgency, pretexting, incremental trust-building, fake verification. |
| Conversation risk | Request | Rates the conversation low, elevated, or high. Can raise the application's threat level. |
| Policy document (Cortega Policy Guardrails) | Response | Checks the answer against an approved Policy Documents group and can ask the model to correct it. |
| AI Verifier (Legal) | Response | Looks up legal citations and, when enabled, checks that the opinion supports the claim. Can ask the model to drop a bad citation. |
| AI Verifier (Documents) | Response | Checks contract statements against attached PDF, DOCX, PPTX, or text. Audit mode records verdicts. Enforce mode can block a failed answer. |
| Tool-call review | Response, and MCP tool calls | Checks proposed tool calls against a JSON allowlist of tools and argument values. Uses no model. |
Any guardrail can carry a run or skip condition on a state variable, so a
detector can run only after a State setter has flagged the message. A
threat level is a counter for one application name (X-Cortega-Application).
Tool-call review and Conversation risk can raise it. Another guardrail can
run only while that level is above zero.
The Guardrails guide has the settings, the threat-level countdown, and how to combine types on one route.
What an application configures, and what the gateway does
The application sends a model name and a gateway key (ck_). AI Border Gateway
applies that key's team:
- model authorization and the team's routing strategy (weight, failover, or a virtual model)
- health-based eviction and same-request retry
- the guardrails and budgets bound to that key, team, or model
- MCP server and tool authorization
Provider selection, provider credentials, and failover stay on the team. Changing the team's routing policy changes the next request from every application on that team.
An application can also issue those gateway keys. A Cortega API key
(crt_) with scope keys:write may list, create, and revoke keys in any
team of its tenant (GET and POST /api/v1/keys, DELETE /api/v1/keys/{id}).
The create body names the key and a team metadata row. The raw ck_
value is returned once. Rotate, expire, purge, and changing a key's team
stay on the Identities page in the console. The legal workspace calls
POST /api/v1/keys with scopes: ["llm:read"] and
DELETE /api/v1/keys/{id}. Those operations are on the
Analytics API under Gateway keys.
Cost controls
- Cost catalog. A price per model and token type, refreshed on a schedule, with your own overrides.
- Team budgets. A dollar budget per team, enforced before a call is allowed through, so an over-budget team gets a clear error, not a surprise invoice.
- Provider budgets. When a provider's monthly budget is exhausted, Cortega stops routing to it.
- Invoice-grade attribution. Every request is logged with its team, identity, key, application, model, provider, token counts, and cost, so spend breaks down by any of those.
Rate limiting
- A requests-per-second limit per gateway instance.
Observability
- Metrics. A Prometheus endpoint on every gateway instance.
- Full traffic log. Every LLM and MCP call, including calls Cortega blocks, is logged the same way into one observability view, with token counts, cost, latency, identity, and the matched guardrail.
- Prompt and response capture. Optionally record full prompt and completion content, including tool calls and reasoning, for audit.
Delivery and reliability
- Configuration is delivered to each gateway instance and applied locally, so AI Border Gateway keeps serving traffic from its last-delivered configuration even if the control plane is briefly unreachable.
- Run more than one gateway instance, optionally behind a load balancer.
- Configuration changes hot-reload without dropping in-flight requests.
Pass-through credentials
For providers that require it, a caller can supply its own upstream credential on the request. Cortega swaps it into the provider-native header and never forwards the Cortega header upstream. See the pass-through routing guide.
On behalf of a user (MCP)
For MCP servers, Cortega can exchange the caller's token for a backend-scoped token (OAuth token exchange, RFC 8693) or perform a Cross App Access (ID-JAG) exchange, so a tool is called as the end user without a separate interactive login. Also supported: static keys, and cloud workload identity for AWS, GCP, Azure, and GitHub Copilot.