Security advisory — Malicious litellm versions 1.82.7 and 1.82.8 were removed from PyPI (potential API key exfiltration). Uninstall them, rotate exposed credentials, and upgrade to a safe release (e.g. 1.82.9+). Run pip show litellm to verify. PyPI · README

AI Gateway API

Base URL: http://localhost:8088 (GATEWAY_HTTP_ADDR)

AI Gateway API

Source: apps/gateway/internal/server/server.go (route registration: Router())

Base URL: http://localhost:8088 (GATEWAY_HTTP_ADDR)

OpenAI-compatible, plus enterprise control-plane extensions.


Public routes

MethodPathAuthDescription
GET/healthzNoneHealth check
POST/v1/chat/completionsJWT BearerChat (supports stream: true SSE)
POST/v1/embeddingsJWT BearerEmbeddings

Chat Completions

Headers

1Authorization: Bearer <portal_jwt>
2Content-Type: application/json

Optional routing headers (see routing.Decider):

  • Explicit provider header (config key provider_header)
  • local_route_header — force local / private-cloud / third-party

Body: standard OpenAI chat completions JSON.

Response

  • Non-streaming: OpenAI JSON + usage
  • Streaming: text/event-stream, SSE data lines
  • Policy block: business-error JSON (not upstream model refusal text), including the matched rule

Streaming hardening env vars

  • GATEWAY_STREAM_IDLE_TIMEOUT
  • GATEWAY_STREAM_SCANNER_MAX_BUFFER_MB

Internal routes

MethodPathAuthDescription
GET/internal/channel-statsGATEWAY_INTERNAL_TOKENChannel runtime stats

Upstream key resolution

OpenAICompatibleProvider order:

  1. <PROVIDER>_API_KEY (provider name uppercased, - → _)
  2. LLM_API_KEY as a generic fallback
  3. Unset → mock fallback (policy / audit / metering still run)

Keys configured in the Admin GUI are stored as a PG cipher. Gateway runtimeconfig polls about every ~5s; that source outranks env.


Config sources

ConfigEnv (remote)Env (local)
ProvidersGATEWAY_REMOTE_PROVIDERS_URLGATEWAY_ADMIN_PROVIDERS_FILE
QuotaGATEWAY_REMOTE_QUOTA_CONFIG_URLGATEWAY_QUOTA_CONFIG_FILE
Policy snapshotGATEWAY_REMOTE_POLICY_SNAPSHOT_URLGATEWAY_POLICY_SNAPSHOT_FILE
ChannelGATEWAY_REMOTE_CHANNELS_URLPG gateway_channels
Policy override—GATEWAY_POLICY_OVERRIDE_FILE

Remote fetch requires GATEWAY_INTERNAL_TOKEN to match admin.


Audit and metering outputs

OutputPath / table
Audit JSONLapps/gateway/.runtime/audit/audit-*.jsonl
Audit PGgateway_audit_events
Pending backfill.runtime/audit/.pg-pending
Metering PGusage_records
Metering JSONLGATEWAY_USAGE_LOG (when PG is absent)

Build and run

bash
1cd enterprise/apps/gateway
2go build -o bin/gateway ./cmd/gateway
3go run ./cmd/gateway

Docker:

bash
1cd enterprise
2docker build -f apps/gateway/Dockerfile -t agenticx-gateway:latest .

See ../gateway/overview.md and ../../apps/gateway/README.md.


Difference from Machi Desktop

Enterprise Gateway is a standalone Go process. Machi Desktop uses the embedded Python agx serve + LiteLLM. These are not the same implementation.

Made-with: Damon Li