Skip to content

Self-hosted. Commercially licensed.

The Enterprise AI Gateway

Three gateways for models, MCP servers and agents, with the same keys, budgets, guardrails and logs for all of them.

Request the free install guide

Starter is free with no license key. A short form emails hello@spanway.ai from your mail app and we reply with the install guide for your setup.

Contact sales

Opens a short form that emails sales@spanway.ai from your mail app. No commitment.

Gateways

  • LLM Gateway

    One OpenAI-compatible API in front of 100+ providers, plus the Anthropic, Gemini and Bedrock formats.

  • MCP Gateway

    Register MCP servers once, or add one from the catalogue, and expose their tools with permissions.

  • Agent Gateway

    Route agent and A2A traffic with keys, budgets and traces, and run custom agents and workflows with Enterprise.

Controls

  • Budgets and rate limits

    Hard caps per key, user and team, enforced before the call, with standard headers on every rate limit 429. Organization caps come with Enterprise.

  • Guardrails

    Built-in PII, prompt injection and secret checks, plus third-party guardrails.

  • RBAC and usage tracking

    Roles for admins and developers, with spend tracked by key, team and org.

Operations

  • Logging

    Send request logs and metrics to Datadog, OpenTelemetry, Prometheus and Langfuse.

  • Authentication

    OIDC, SSO, two-factor sign-in and custom authentication hooks for every caller.

  • Observability

    Per-request cost, latency and routing decisions in your own database and in response headers, and agent traces in Lens.

How the gateway fits in

How Spanway fits into your stackApps and SDKs, coding agents such as Claude Code, Codex and OpenCode, and your own A2A agents and MCP clients all send their calls to the Spanway gateway. The gateway checks keys and single sign-on, routes with fallback, applies guardrails, budgets and rate limits, tracks cost and writes an audit log. It has three parts: the AI gateway for 100+ LLM providers, the MCP gateway for MCP servers and the agent gateway for A2A agents. The Admin UI, Lens for agent traces, Postgres for keys, spend and the audit log, and an optional Redis for shared limits and caching run beside the gateway. You can run all of it yourself, in your cloud, on-prem or air-gapped, or use Spanway Cloud, which runs the same release for you.Runs beside the gatewayClientsApps and SDKsClaude Code, Codex and OpenCodeYour A2A agents and MCP clientsSpanway gatewayOne endpoint for models, toolsand agentsKeys and SSORouting and fallbackGuardrailsBudgets and rate limitsAudit logCost trackingAI gatewayMCP gatewayAgent gatewayWhere calls go100+ LLM providersMCP serversA2A agentsAdmin UIKeys, teams,spend, evalsLensAgent tracesPostgresKeys, spendand audit logRedisOptional, forshared limitsSelf-hostedYour cloud, on-premor air-gappedSpanway CloudThe same release,run for you
Every app, coding agent and agent talks to one gateway. It checks who is calling, applies your rules and sends the call on to the right provider, tool or agent. Its data stays in your own Postgres, or in Spanway Cloud if we run it for you.

With one request in flight, one worker, a PostgreSQL database for spend tracking and no guardrails, caching or logging callbacks, the gateway added a median of 6.2 to 6.9 ms to a non-streamed chat completion, measured on an Apple M4 Max against a mock upstream that answers in under 1 ms. See the method

Quick start

Pull the image, list your model in config.yaml, export a master key and a provider key, and send your first request.

Pull and run

docker pull registry.spanway.ai/spanway/spanway-ai:<version>
export SPANWAY_MASTER_KEY="sk-$(openssl rand -hex 32)"
export ANTHROPIC_API_KEY="your-provider-key"
docker run -p 4000:4000 -v "$PWD/config.yaml:/app/config.yaml" -e SPANWAY_MASTER_KEY -e ANTHROPIC_API_KEY registry.spanway.ai/spanway/spanway-ai:<version> --config /app/config.yaml

Or let the setup wizard write the config

docker run --rm -it --user "$(id -u):$(id -g)" -p 4000:4000 -v "$PWD:/app/work" -w /app/work registry.spanway.ai/spanway/spanway-ai:<version> --setup

Or try everything in one container with a built-in database (dev mode, laptop only)

docker pull registry.spanway.ai/spanway/spanway-ai-dev:<version>
printf 'SPANWAY_MASTER_KEY=sk-%s\nSPANWAY_SALT_KEY=sk-%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > spanway-dev.env
docker run -d --name spanway-dev -p 127.0.0.1:4000:4000 --env-file spanway-dev.env -v spanway-dev:/var/lib/spanway/dev registry.spanway.ai/spanway/spanway-ai-dev:<version>

Or on Kubernetes

helm install spanway oci://registry.spanway.ai/spanway/charts/spanway-helm --version <version>

Send a request

curl http://localhost:4000/v1/chat/completions \
  -H "Authorization: Bearer sk-your-virtual-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-5-5", "messages": [{"role": "user", "content": "Hello"}]}'

Each release publishes the container images, the Helm charts and the clients under one version number, so what you deploy matches the gateway you run. The release notes (opens in a new tab) list what each version changed. Request the install guide for your setup, or read the docs (opens in a new tab) for the full configuration reference.

01

Deploy in any environment

Self-hosted, on-prem, or in your cloud. The gateway is a container in front of your own Postgres and Redis, so it runs wherever those already do.

  • On-prem
  • Multi-cloud
  • Kubernetes
  • Helm
  • Terraform
  • Air-gapped

See every way to deploy, from three commands on a laptop to Helm and Terraform in production.

02

Three gateways, one set of controls

Keys, budgets, guardrails and audit logs are defined once and apply whether the request is going to a model, a tool or an agent.

LLM Gateway

Your apps call one endpoint in the format they already speak and the gateway talks to each provider. Load balancing and fallbacks keep requests flowing when a deployment is slow or down, caching skips repeat calls, and every request is priced and attributed to a key.

  • One API to 100+ providers
  • OpenAI, Anthropic Messages, Gemini and Bedrock formats
  • Load balancing and fallbacks
  • Response, semantic and provider prompt caching
  • Spend tracking per key, team and org

MCP Gateway

Register an MCP server once and expose it to agents and apps through the gateway. Each key and team gets its own list of allowed tools, the gateway handles OAuth on both sides, and every tool call is recorded.

  • Register MCP servers once
  • A catalogue of connectors that start read-only
  • Per-key and per-team tool permissions
  • OAuth to upstream servers and for MCP clients
  • Per-user credentials
  • Audit of tool calls

Agent Gateway

Route traffic to agents, including A2A agent cards and agent endpoints, with the same keys and budgets as model calls, and disable an agent at the gateway without redeploying it. With Enterprise, each agent can also get session limits, an identity provider binding and a kill switch, and the gateway can run custom agents and multi-step workflows itself.

  • A2A and agent endpoints
  • A free agent registry with spend per agent
  • Agent traces in Lens and the run ledger
  • Session budgets and iteration limits, with Enterprise
  • Custom agents and the workflow runner, with Enterprise
  • Apps can call the gateway in the OpenAI, Anthropic Messages, Gemini generateContent or Bedrock Converse format, so Claude Code and Gemini SDK clients work unchanged and Bedrock Converse clients only change the endpoint and key. The Responses API includes background mode and compaction, and with the deployment check turned on follow-up calls stay on the deployment that stored the conversation. Supported endpoints
  • The MCP gateway handles OAuth to upstream servers and acts as an OAuth server for MCP clients, lets each user store their own upstream credential once, turns OpenAPI specs into tools, groups tools into toolsets and filters them semantically per task. MCP gateway
  • Identity comes from your directory. SCIM provisions users and teams, JWTs authenticate services, keys can be limited to a route allow-list, and with Enterprise the gateway, keys, teams and organizations can each refuse addresses outside an IP or CIDR allow-list. IP and route allow-lists
  • Routing goes beyond load balancing with tag and team based routing, wildcard model names, retry and fallback settings per key or team, semantic and complexity auto routing, adaptive routing, quality routing, provider preferences, saved routing presets and savings reports backed by shadow evals. Routing
  • Every response says why it was routed where it was. One header names the strategy, preset or retry cause, another counts the provider calls the request took, and on request the gateway lists every deployment it skipped and why, such as a cooldown, a full context window or a data policy. The same list is kept with the request log. Routing decision headers
  • Budget tiers keep a team working all month. Map frontier, balanced and economy tiers to routing presets for a team or organization, and requests that ask for @tier move to cheaper models as the budget used crosses the percentages you set, such as 75 and 90, then move back up when the budget resets. Every shift is audited, alerted and shown in the routing headers. Budget tiers
  • Parallel request caps work per key, team, user, team member, customer and model, so one busy team cannot hold every running slot, and MCP tools can be capped one by one. Every per-minute, concurrency, MCP and batch limit 429 carries RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset, Retry-After and a header that names the limit that was hit, so clients back off on their own. Rate limits
  • The request inspector takes the body you would send to chat completions and answers with the model and deployments it would use, the policies and guardrail verdicts, the cache status, the estimated cost and the budgets it would count against, without calling a model or moving a counter. Request inspector
  • A guardrail policy can be attached in audit mode first. It records what it would have blocked or redacted while every request passes unchanged, and policy replay runs a team's or key's recent stored requests through it, so you switch to enforce knowing what will change. Audit mode and policy replay
  • Data policy routing keeps a request, key, team or organization on deployments that keep nothing or never train on your data, and can keep code from coding tools on zero retention or self-hosted models. Data policy routing
  • Fit to context trims long conversations to the chosen model's window, and structured output repair fixes JSON that is almost right before your app sees it. Fit to context
  • Budgets can be set per provider, deployment or tag, and the router sends traffic around a provider once it reaches its cap. Provider budget routing
  • Provider prompt caching cuts the cost of long, repeated prompts, and routing keeps requests on the deployment whose cache is already warm. Prompt caching
  • Ingest a file or URL into a vector store, then retrieve, rerank and answer in one call, with the same keys and spend tracking. Vector stores on OpenAI, Azure, Bedrock, Vertex AI, PG Vector, Milvus and S3 Vectors sit behind one search API. RAG query
  • Give any model web search through one /v1/search endpoint, backed by the search provider you choose. Web search
  • Pass-through routes forward provider-native API calls with spend tracking, custom routes reach any HTTP service, and guardrails can run on pass-through traffic, targeted at fields with JSONPath. Pass-through endpoints
  • Prompt templates are stored and versioned on the gateway and referenced by id from requests. Production only changes by promotion, and with Enterprise evals a promotion needs a passed eval of that exact version. Compare any two versions, share text across prompts with partials, get Slack or email alerts when a prompt changes, and keep prompts in a GitLab or Bitbucket repository. Prompt management
  • With Enterprise, evals start from production. Sample real requests or agent sessions into a dataset, run it against new models or prompt versions, gate pull requests on the result, and grade a sample of live traffic with alerts when the pass rate drops. Evals
  • With Enterprise, agent governance adds session budgets, iteration limits, required trace ids, identity provider binding and a kill switch that disables the agent, blocks or deletes its keys, stops its workflow steps and then calls your agent's stop webhook. Disabling an agent by hand stays free. Agent governance
  • Every agent run can be traced by Lens, which runs next to the gateway, and teams read their own traces through /v1/traces. Agent tracing
  • The global control plane gives one Admin UI over several independent gateways, one per region or business unit, each keeping its own database. Global control plane
  • Admission control caps the requests each worker handles at once, queues the rest briefly and sheds overload with a 503 instead of letting latency grow. Admission control
  • With one request in flight, one worker, a PostgreSQL database for spend tracking and no guardrails, caching or logging callbacks, the gateway added a median of 6.2 to 6.9 ms to a non-streamed chat completion, measured on an Apple M4 Max against a mock upstream that answers in under 1 ms. Benchmark method
  • Deploy with the Helm charts, the Terraform stacks for AWS, GCP and Azure, or in air-gapped mode where the optional update fetches are switched off. Helm charts

03

Every endpoint, one key

Chat is only the start. The same key and access controls cover every endpoint family the gateway serves, and model calls on each are priced and attributed to that key.

See every supported endpoint

04

Developer tools

Manage the gateway from code, from the command line or from an API client.

  • TypeScript client

    A typed client for the management API, generated from the gateway's OpenAPI document.

  • Python client

    A typed Python client for the management API, with Pydantic models generated from the gateway's OpenAPI document.

  • Postman collection

    A generated collection and environment with the base URL and key as variables.

  • spanwayctl CLI

    Sign in with SSO from the browser, manage keys and point Claude Code at the gateway.

  • Setup wizard

    Run the image with --setup and the wizard picks providers, checks OpenAI, Anthropic and Gemini keys, writes a config file into your working directory and starts the gateway.

05

Run it yourself. Start today.

Start the gateway, track and cap spend on every request, and add SSO, audit logs and custom SLAs when it goes org-wide.

Request the free install guide

Starter is free with no license key. A short form emails hello@spanway.ai from your mail app and we reply with the install guide for your setup.

Contact sales

Opens a short form that emails sales@spanway.ai from your mail app. No commitment.