
LLM Gateway
How it works
A request authenticates with a gateway key. Forge resolves the key’s identity
and access profile, validates the requested model and API surface, applies the
relevant policy and budget controls, selects an eligible route, and records the
result.
With a supported network integration or Forge for devices, Forge can
automatically route supported model traffic through the LLM Gateway. Teams get
one governed path without reconfiguring every application.
Traffic entry
Traffic reaches the LLM Gateway through three supported paths:
Network routing gives organizations agentless coverage from an existing
network control point. Forge for devices extends the same experience to
managed endpoints wherever they work. Direct configuration remains available
for teams that want to connect an application or service explicitly.
Providers
Forge maintains a catalog of supported providers and the API surfaces available for each one. Forge supports OpenAI, Anthropic, Azure OpenAI, Amazon Bedrock, Vertex AI, Mistral, Cohere, xAI, Databricks, OpenRouter, and custom OpenAI-compatible and Anthropic-compatible providers. Provider credentials can use a Forge-managed secret reference, a customer-managed credential, or no credential when the upstream connection does not require one. Plaintext credentials are accepted only when a provider is configured and are never returned by the API. Forge reports each provider’s configuration state and health separately. Configuration states includeconfigured, disabled, error, and deleted;
health can be healthy, degraded, unhealthy, down, or unknown.
API surfaces
Routes are scoped to an API surface so a caller cannot use an upstream capability merely because it can reach the provider.
The provider catalog is the source of truth for which surfaces a specific
provider supports.
When policy enforcement is enabled, OpenAI Responses requests must include the
complete provider-visible context in
input. Forge rejects
previous_response_id continuations because the referenced provider-side
history cannot be evaluated or transformed by the gateway. Monitor and
simulate modes may observe these continuations without claiming full-context
enforcement.Access profiles
An access profile is the reusable control plane for a class of gateway traffic. It defines what a caller assigned to the profile may request and what controls Forge applies. Access profiles configure:- Model selectors and provider selectors.
- Data classes used by policy evaluation.
- Prompt, pre-tool-use, and post-tool-use policy checkpoints.
- Privacy mode for retained gateway data.
- Enforcement mode and lifecycle state.
Profiles are versioned so changes to model access and enforcement can be
tracked. Identity assignment belongs to gateway keys: each key binds its
subject to one access profile.
Routing
A route matches an access profile, requested model pattern, and API surface, then directs the request to a provider. A route can preserve the requested model name or rewrite it to a different upstream model.Tiers and strategies
Routes with the same priority form a tier. Forge tries lower priority numbers first and moves to later tiers only when the earlier tiers have no eligible destination or their attempts fail. Later tiers are therefore the fallback path;fallback is not a strategy you select.
The strategy controls selection among eligible destinations within one tier:
Forge excludes degraded or unhealthy destinations during their cooldown and
uses eligible destinations in the same tier before moving to the next tier. A
successful later probe restores a destination to healthy. Buffered request
surfaces can fail over before a response is returned; Forge does not replay a
stream after its response has begun.
Routes can also set same-destination retries, cooldown periods, and
provider-specific request overrides. Provider-owned and secret-bearing fields
cannot be supplied through request overrides.
Route rollout states are
draft, monitor, simulate, enforce, paused,
and archived. Tool denials can use hard_block or rewrite_refusal.
Gateway keys
Gateway keys authenticate callers and connect each caller to an access profile. A key binds one subject of typeuser, group, app, agent,
service_account, or customer_tenant.
Token classes include personal, group, service_account, app, agent,
customer_tenant, and exchanged. Keys can expire and can be rotated,
transferred, revoked, disabled, re-enabled, or deleted. Their runtime state is
active, revoked, or expired.
Service accounts
Service accounts give non-human workloads a durable identity rather than sharing a person’s key. They can represent applications, agents, bots, and integrations. A service account records its owner, environment, rotation policy, and state. The owner can be a directory user, directory group, or app integration. States areactive, disabled, and archived.
Budgets
Budgets can be attached to an access profile, gateway key, or subject. A budget can enforce any combination of:- Spend in USD.
- Input tokens.
- Output tokens.
- Total tokens.
daily, weekly, monthly, rolling_24h,
rolling_7d, and rolling_30d. Calendar windows reset in UTC; rolling windows
move continuously. When either a configured spend or token limit is reached,
Forge blocks subsequent requests in that budget window.
Switch an app
Point the existing SDK at the Forge endpoint and replace the provider credential with a scoped gateway key.Session continuity
To group multiple model requests from one logical agent interaction, generate a high-entropy session hint and send the same value unchanged on every request in that interaction:X-Forge-Session-Id response
header contains Forge’s canonical session ID for observability. Treat that
response value as read-only: continue sending your original hint rather than
using the returned canonical ID as the next request’s hint.
User attribution
The gateway key authenticates the application or service account. When the application acts for an end user, it can also pass a verified identity token:Policy checkpoints
Profiles and routes can invoke policies at three points:
The profile and route enforcement modes determine whether a matching policy is
observed, simulated, enforced, or processed under break-glass behavior. Tool
denials can stop execution or return a rewritten refusal when that behavior is
configured on the route.
Observability
Forge records the requested and served model, selected provider and route, identity, policy outcomes, tokens, cost, latency, retries, fallbacks, errors, cache hits, and denied tool calls for routed traffic. Gateway analytics include:- Request and session volume.
- Input, output, and total tokens.
- Provider-reported or Forge-estimated cost.
- Policy hits and denied tool calls.
- Route health, errors, retries, fallback rate, and cache hits.
- Bypass findings for observed traffic that did not use the gateway.