ai-gateway
v1.5.0 open-sourceUnified AI Gateway for 30+ LLMs (OpenAI, Anthropic, Bedrock, Azure etc) with Caching, Guardrails, A/B test & cost controls. Go-native Fastest & Scalable AI Gateway LiteLLM & Kong AI Gateway alternative.
import (
_ "your-org/your-plugin"
"github.com/ferro-labs/ai-gateway/run"
)
func main() {
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()
if err := run.Run(ctx); err != nil {
log.Fatal(err)
}
}
curl -s https://gateway.internal/health | jq '{version, commit, built}'
gw.RegisterProviderAs(openaiProvider, "openai-team-a")
gw.RegisterProviderAs(openaiProvider, "openai-team-b")
targets:
- id: my-azure-preview
provider: azure-openai
base_url: https://my-resource.openai.azure.com
models:
- gpt-4o-2026-preview
- gpt-4o-mini-regional
batch_target: openai-prod
targets:
- id: openai-prod
provider: openai
api_key: ${OPENAI_API_KEY} Summary
Unified AI Gateway for 30+ LLMs (OpenAI, Anthropic, Bedrock, Azure etc) with Caching, Guardrails, A/B test & cost controls. Go-native Fastest & Scalable AI Gateway LiteLLM & Kong AI Gateway alternative.
Release history
- v1.5.0
ai-gateway v1.5.0 makes the gateway importable as a Go library via new run.Main() and run.Run() APIs
└──▷ GET THIS VERSION$ git clone --branch v1.5.0 https://github.com/ferro-labs/ai-gateway.git # already have the repo? check out this version: $ git checkout v1.5.0
└──▷ USE ITEmbed the gateway in a Go service so it shuts down cleanly when a parent context is cancelled — useful for test harnesses or multi-component binaries.import ( _ "your-org/your-plugin" "github.com/ferro-labs/ai-gateway/run" ) func main() { ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) defer cancel() if err := run.Run(ctx); err != nil { log.Fatal(err) } }- ›Adds run.Main() and run.Run(ctx, opts...) in the new public
runpackage, letting Go programs embed the fullferrogwserver —run.Runreturns startup and listen errors instead of exiting, and honours context cancellation for graceful shutdown identical to SIGTERM. - ›Custom binaries can now be built by blank-importing plugins and calling run.Main(), enabling a plugin-composition workflow without forking the gateway binary.
- ›Adds run.Main() and run.Run(ctx, opts...) in the new public
- v1.4.2
ai-gateway v1.4.2 adds provider registration aliases, an embeddable HTTP facade, and build provenance on GET
/health└──▷ GET THIS VERSION$ git clone --branch v1.4.2 https://github.com/ferro-labs/ai-gateway.git # already have the repo? check out this version: $ git checkout v1.4.2
└──▷ TRY ITConfirm exactly which build is serving traffic without shelling into the container — useful after a rolling deploy.$ curl -s https://gateway.internal/health | jq '{version, commit, built}'
Bind two sets of provider credentials to distinct routing targets so tenants can be isolated by alias rather than by separate gateway instances.gw.RegisterProviderAs(openaiProvider, "openai-team-a") gw.RegisterProviderAs(openaiProvider, "openai-team-b")
- ›Adds
Gateway.RegisterProviderAsto register one provider under a distinct routing target, allowing multiple credentials for the same canonical provider while preserving all optional capabilities (streaming, embeddings, images, rerank, moderation, audio, discovery, batch, Responses, and generic pass-through). - ›Exposes
httpgatewaypackage to embedding applications, giving embedders access to Files/Batches, Responses, and generic pass-through handlers while keeping their own authentication and tenant policy middleware. - ›
GET /healthnow returnsversion,commit, andbuiltbuild metadata alongside provider status, sourced frominternal/version(defaults:dev/none/unknownfor unstamped local builds).
- ›Adds
- v1.4.0
ai-gateway v1.4.0 adds native rerank, moderation, audio, Files, Batches, and Responses API routing with full gateway lifecycle support.
└──▷ GET THIS VERSION$ git clone --branch v1.4.0 https://github.com/ferro-labs/ai-gateway.git # already have the repo? check out this version: $ git checkout v1.4.0
└──▷ USE ITDeclare a preview or self-hosted model ID so it appears in routing and/v1/models without waiting for catalog updates.targets: - id: my-azure-preview provider: azure-openai base_url: https://my-resource.openai.azure.com models: - gpt-4o-2026-preview - gpt-4o-mini-regionalEnable the OpenAI Batches API by pointing the gateway at a batch-capable backend so/v1/files* and/v1/batches* resolve without a 501.batch_target: openai-prod targets: - id: openai-prod provider: openai api_key: ${OPENAI_API_KEY}- ›Adds
POST /v1/rerank(Cohere v2 contract) as a natively routed surface supporting cohere, together, deepinfra, nvidia-nim, and bedrock — withtop_nnormalised across providers (0caps to no results, negative values are rejected). - ›Adds
POST /v1/moderations(OpenAI contract) as a natively routed surface supporting openai and mistral. - ›Adds
POST /v1/audio/transcriptionsandPOST /v1/audio/translations(multipart upload, 25 MiB cap) as natively routed surfaces supporting openai, azure-openai, groq, together, sambanova, deepinfra, mistral, and fireworks. - ›Adds
POST /v1/audio/speech(JSON in, binary audio out;inputcapped at 4096 characters) as a natively routed surface supporting openai, azure-openai, groq, together, deepinfra, and mistral. - ›Adds
targets[].modelsfield to declare models a target serves that are absent from the catalog or live discovery — new catalog IDs, regional/preview names, or self-hosted deployments — making them available in routing andGET /v1/models.
+8 moreshow less
- ›Adds
batch_targetconfig key to forward/v1/files*and/v1/batches*transparently to a configured backend (openai, azure-openai, groq, novita, qwen); returns 501 whenbatch_targetis unset. - ›Adds
POST /v1/responses(Responses API) as a governed, priced surface with plugins, guardrails, circuit breaker, concurrency, and request log; stateful sub-routes pin toresponses_targetand return 501 when it is unset. - ›All four new natively routed surfaces (rerank, moderations, audio, responses) carry the full gateway lifecycle — targets, routing strategy, plugins, circuit breaker, per-target concurrency, metrics, and request logging — replacing the generic pass-through.
- ›Extends image generation support to gemini (via
generateContent), deepinfra, and together; extends embeddings support to azure-foundry. - ›Adds a Tracing page to the dashboard over the gateway's OpenTelemetry output.
- ›Adds a
deploy/compose stack running the gateway, a collector, a tracing backend, and a mock upstream for end-to-end observability without a provider key. - ›Agentic MCP tool loops now run
before_requestplugins (guardrails, rate limiters) on every turn, not only the first —transformandlogging/metricsplugin types are deliberately excluded from per-turn execution. - ›Unifies routing internals across chat, streaming, embeddings, and image generation so retry (
targets[].retry), circuit breaking, error classification, metrics, and request logging behave identically on every surface.
└──▷ BREAKING ON UPGRADE- !
targets[].retrywas previously honoured only underfallbackrouting mode; it is now honoured under all modes, so a target that always fails will produceattemptsupstream calls where it previously produced one. - !
render.yamlnow setsGATEWAY_ENV=production, enabling startup checks that refuse to boot whenALLOW_UNAUTHENTICATED_PROXY=trueorCORS_ORIGINScontains*; a Render service carrying either setting will fail its next deploy. - !Outbound HTTP clients no longer follow upstream 3xx redirects — the redirect is returned to the caller as-is; requests that previously succeeded via redirect will now fail until the provider base URL is updated to the redirect target.
- !Withheld config map keys in
GET /admin/configare no longer returned verbatim; each entry is now replaced with[REDACTED_KEY_<n>](sorted, stable index). APUTbody containing placeholder key names is rejected. Affected maps:mcp_servers[].env,mcp_servers[].headers,observability.exporters[].config,observability.tracing.headers, and undeclared plugin settings.
- ›Adds