- AI Gateway
- next
- Gateway Artifacts
LLM proxy¶
An LLM Proxy allows developers to create custom API endpoints that consume an LLM Provider, while inheriting administrator-enforced access control, budgeting and organization-wide policies defined at the provider level. Each proxy gets its own URL context (e.g., /assistant) and can have its own policies applied. This enables:
- Multiple AI applications to share a single LLM Provider
- A single OpenAI-compatible endpoint to route requests to multiple LLM providers. See Multi-provider routing.
- Per-application policies such as prompt management and guardrails
- Separation between platform administration and application development
This page is for AI developers, who own LLM proxies. It takes you through deploying one and routing a request through it.
Who configures this¶
AI developers own LLM proxies. A developer creates the proxy, names the LLM provider it consumes, and attaches the policies one application needs. The access control, budgeting, and organization-wide policies set on the provider still apply.
Prerequisites¶
- A running AI Gateway, with
ADMIN_USERNAMEandADMIN_PASSWORDexported in the shell you run these commands from. See Install the gateway. - A deployed LLM provider on that gateway. A proxy names the provider it consumes in
provider.id, and the gateway rejects a proxy that names one it can't find. See Create and configure an LLM provider.
Configure the proxy¶
The definition below deploys a proxy that consumes the openai-provider provider. Set provider.id to the metadata.name of a provider already deployed on your gateway — a value that doesn't match a deployed provider is the most common reason this request fails.
curl -X POST http://localhost:9090/api/management/v1/llm-proxies \
-H "Content-Type: application/yaml" \
-u "$ADMIN_USERNAME:$ADMIN_PASSWORD" \
--data-binary @- <<'EOF'
apiVersion: gateway.api-platform.wso2.com/v1
kind: LlmProxy
metadata:
name: openai-assistant
spec:
displayName: OpenAI Assistant
version: v1.0
context: /assistant
provider:
id: openai-provider
policies: []
EOF
Save the proxy definition to openai-assistant.yaml:
@'
apiVersion: gateway.api-platform.wso2.com/v1
kind: LlmProxy
metadata:
name: openai-assistant
spec:
displayName: OpenAI Assistant
version: v1.0
context: /assistant
provider:
id: openai-provider
policies: []
'@ | Set-Content -Path openai-assistant.yaml -Encoding utf8
Then post it:
Three values shape the proxy:
context— the URL prefix clients call, independent of the provider's own context. This proxy answers under/assistant.provider.id— the provider this proxy consumes, named by itsmetadata.name.policies— the policies that apply to this proxy alone. An empty list deploys the proxy with none of its own; the provider's policies still apply.
Test the proxy¶
Send a chat completion request to the proxy's context on the gateway:
The -k flag tells curl to skip Transport Layer Security (TLS) certificate verification. The router presents the self-signed listener certificate that setup.sh or setup.ps1 generates, and no certificate authority trusts it. Outside local testing, give the router a certificate from a trusted certificate authority and remove -k.
Policies¶
The routing policies that select a provider for a proxy, and the failover behavior that comes with them, are covered in Load balancing and failover.
Next steps¶
- Protect the proxy, which is the client-facing endpoint: Authenticate clients
- Send requests on one proxy to more than one provider: Multi-provider routing
- Return responses chunk by chunk: Stream responses
Related guides¶
- Set up a governed multi-model LLM proxy — distributes traffic across models behind one proxy, with per-team token budgets, PII masking, and semantic caching.
- Enforce a consistent AI persona with the prompt decorator policy — prepends a persona system message to every request on an LLM proxy, without changing client code.
- Configure Claude Code with AI Gateway — routes Claude Code through an Anthropic provider and an LLM proxy.
- Configure Gemini CLI with AI Gateway — routes Google Gemini CLI through a Gemini provider and an LLM proxy.
- Configure OpenAI Codex CLI with AI Gateway — routes OpenAI Codex CLI through an OpenAI provider and an LLM proxy.