a6-plugin-ai-proxy
Overview
The ai-proxy plugin turns APISIX into an AI gateway. Clients can send
requests in supported protocols to APISIX instead of handling provider
authentication and endpoint selection themselves. The plugin detects the
client protocol, selects a compatible provider endpoint, forwards the native
format or converts it when an adapter is available, and handles response
streaming.
When to Use
- Proxy Chat Completions, Responses API, Embeddings, Anthropic Messages, or Bedrock Converse requests to a compatible provider
- Centralize API keys at the gateway instead of distributing to clients
- Add observability (token counts, latency) to LLM calls
- Combine with
ai-prompt-template,ai-prompt-decorator, or content moderation plugins for a full AI gateway pipeline
Supported Providers
| Provider | Value | Endpoint Behavior |
|---|---|---|
| OpenAI | openai | Automatically selects /v1/chat/completions, /v1/responses, or /v1/embeddings on https://api.openai.com |
| DeepSeek | deepseek | https://api.deepseek.com/chat/completions |
| Azure OpenAI | azure-openai | Custom via override.endpoint |
| Anthropic | anthropic | Automatically selects /v1/chat/completions or /v1/messages on https://api.anthropic.com |
| AIMLAPI | aimlapi | https://api.aimlapi.com/v1/chat/completions |
| OpenRouter | openrouter | https://openrouter.ai/api/v1/chat/completions |
| Gemini | gemini | https://generativelanguage.googleapis.com/v1beta/openai/chat/completions |
| Vertex AI | vertex-ai | https://aiplatform.googleapis.com |
| Amazon Bedrock | bedrock | Region- and model-specific Bedrock Runtime endpoint |
| OpenAI-Compatible | openai-compatible | Custom via override.endpoint |
Plugin Configuration Reference
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
provider | string | Yes | — | One of the 10 supported providers |
auth | object | Yes | — | Authentication config (see below) |
options | object | No | — | Model and generation parameters |
options.model | string | No | — | Model name (provider-specific) |
options.temperature | number | No | — | Sampling temperature |
options.top_p | number | No | — | Nucleus sampling |
options.max_tokens | integer | No | — | Maximum tokens to generate |
options.stream | boolean | No |