Skip to main content

AI Gateway Ports, Files and Tables

This page is a lookup reference for Elchi AI Gateway on an edge (client VM or Elchi OS appliance) and in the control plane. Paths and modes are the ones the installer and the Elchi OS image create. On Elchi OS the same names apply unless a row says otherwise.

Sockets​

All sockets live in /run/elchi-ai-gateway. systemd creates that directory at each start (RuntimeDirectory=elchi-ai-gateway, RuntimeDirectoryMode=2750, owner elchi:elchi, setgid). Envoy reaches the sockets because its user is in the elchi group.

SocketServed byEnvoy componentModeFlag / variable
extproc.sockAgent Router extproccluster elchi-ai-gateway: the AI ext_proc filter (router level) and the upstream ext_proc of every provider cluster0775 (set by the extproc)--extproc-addr / ELCHI_AI_GATEWAY_EXTPROC_ADDR, default unix:///run/elchi-ai-gateway/extproc.sock
authz.sockthe supervisorcluster elchi-ai-gateway-authz: both ext_authz phases, the MCP result scan, the AI HCMs' gRPC access log0660 (set by the supervisor)--authz-socket / ELCHI_AI_GATEWAY_AUTHZ_SOCKET, default /run/elchi-ai-gateway/authz.sock; empty disables it
mcp.sockthe extproc's MCP proxycluster elchi-aigw-mcp__proxy, the gateways' /mcp routesset by the extproc--mcp-addr / ELCHI_AI_GATEWAY_MCP_ADDR, default unix:///run/elchi-ai-gateway/mcp.sock; empty disables MCP

TCP ports​

PortBound byAddressPurposeExposure
9002supervisor127.0.0.1/healthz, /readyz, /configz, /metrics (and /debug/pprof with --pprof)Loopback only. Another address needs --allow-non-loopback.
9003supervisor127.0.0.1OTLP/gRPC receiver for the extproc's spans (the request log)Refuses to start on a non-loopback address
9064extprocevery interfaceextproc admin: metrics and health, no authenticationClosed to non-loopback traffic by the nftables table inet elchi_ai_gateway
10088Envoy (entry <listener>-mcp of every AI listener)127.0.0.1MCP egress: the extproc calls every MCP server through itOnly the gateway's processes connect, only Envoy's user answers (nftables). Present only while the project has MCP servers.
6060——The extproc's pprof portNever opened: the extproc always runs with DISABLE_PPROF=1

Your AI listeners' own ports (HTTPS and/or HTTP) are the ones you set on the listener. 10088 is refused as a listener port.

Directories and files on the edge​

PathOwnerModeContent
/etc/elchi/bin/elchi-ai-gatewayroot:elchi0755The supervisor binary
/etc/elchi/elchi-ai-gateway/root:elchi0750The gateway's configuration directory. Read-only to the service.
/etc/elchi/elchi-ai-gateway/config.yamlelchi:elchi0600Operator-owned process settings, read once at start: project, ClickHouse DSN, request log, telemetry, extproc pin. Holds the ClickHouse credentials.
/etc/elchi/elchi-ai-gateway/conf.d/elchi:elchi0750The configuration the agent delivers, hot-reloaded. Never edit by hand on a managed edge.
conf.d/00-providers.yamlelchi:elchi0600Providers with credentials, spec limits, prices, sensitive-data policy, request-log recipient, MCP servers and session seed
conf.d/00-consumers.yamlelchi:elchi0600Consumers with key hashes. Present only when the project has consumers.
conf.d/gw-<gateway>.yamlelchi:elchi0600One file per gateway
conf.d/*.tmpelchi:elchiThe agent's staging files during a push. The gateway ignores them.
/etc/elchi/elchi-ai-gateway/firewall.nftroot0644Plain Linux: the nftables table the installer writes
/usr/lib/elchi/elchi-ai-gateway.nftrootElchi OS: the same table, plus the cgroup-based MCP egress chain
/var/lib/elchi/ai-gateway/elchi:elchi0700The service's only writable path
/var/lib/elchi/ai-gateway/<version>/extprocelchi0750A downloaded or placed extproc binary. The two most recent versions are kept.
/var/lib/elchi/ai-gateway/<version>/extproc.version_stringelchi0640The binary's config version string (the "version gate")
/var/lib/elchi/ai-gateway/<version>/extproc.sha256elchi0640The checksum verified at download, re-checked on every start
/var/lib/elchi/ai-gateway/last-good.jsonelchi0600The last accepted configuration. Restored when conf.d is unusable at start.
/var/lib/elchi/ai-gateway/fileid.seedelchi0600Files/Batch API id encryption seed, generated on first start, never on the command line
/run/elchi-ai-gateway/bundle/index.yamlelchi0600The extproc's config bundle index (version, uuid, checksum, parts)
/run/elchi-ai-gateway/bundle/parts/<sha>elchi0600 (directory 0700)The rendered configuration, content-addressed. It carries provider credentials, so it lives on tmpfs.
/run/elchi-ai-gateway/env, proxy.envElchi OS only: environment written at each start (the extproc version and index, and the egress proxy)

systemd units​

UnitWhereWhat
elchi-ai-gateway.servicePlain Linux (written by the installer) and Elchi OS (in the image)The supervisor. User=elchi, Restart=always, RestartSec=5, TimeoutStopSec=60, KillMode=mixed (SIGTERM reaches only the supervisor, which stops the extproc with a 20 s grace). ExecStartPre runs elchi-ai-gateway validate on conf.d (non-fatal).
elchi-ai-gateway-firewall.serviceBothOneshot, before network-pre.target. Loads the nftables table at boot, whether or not the gateway runs.
elchi-ai-gateway.service.d/10-oom.confElchi OSOOMScoreAdjust=-300: the gateway sits in the request path of every AI listener

On plain Linux the unit passes its settings as flags (--config-dir, --config-file, --extproc-addr, --http-addr, --log-format json, --log-level info). On Elchi OS it passes them as ELCHI_AI_GATEWAY_* variables. An operator-pinned older gateway ignores an unknown variable, but would stop at start on an unknown flag.

The journal identifier is elchi-ai-gateway (journalctl -u elchi-ai-gateway). On Elchi OS: show ai-gateway, logs ai-gateway, restart ai-gateway.

Environment variables and flags​

Precedence: flag > ELCHI_AI_GATEWAY_* variable > config.yaml > built-in default. The extproc never inherits these variables.

VariableFlagDefaultMeaning
ELCHI_AI_GATEWAY_INSTANCE_ID--instance-id<hostname>-ai-gatewayStamped on logs, usage and request rows
ELCHI_AI_GATEWAY_CONFIG_DIR--config-dir/etc/elchi/elchi-ai-gateway/conf.dThe hot-reloaded configuration
ELCHI_AI_GATEWAY_CONFIG_FILE--config-file(none)config.yaml, read once at start
ELCHI_AI_GATEWAY_BUNDLE_DIR--bundle-dir/run/elchi-ai-gateway/bundleWhere the extproc reads its config bundle. Keep it on tmpfs.
ELCHI_AI_GATEWAY_LAST_GOOD_PATH--last-good-path<extproc-base-dir>/last-good.jsonThe persisted last accepted configuration
ELCHI_AI_GATEWAY_FILE_ID_SEED_FILE--file-id-seed-file<extproc-base-dir>/fileid.seedThe Files/Batch id seed
ELCHI_AI_GATEWAY_USAGE_GATEWAY_HEADER--usage-gateway-headerx-elchi-ai-gatewayThe header naming the gateway (set by Envoy)
ELCHI_AI_GATEWAY_HTTP_ADDR--http-addr127.0.0.1:9002Status HTTP server
ELCHI_AI_GATEWAY_ALLOW_NON_LOOPBACK--allow-non-loopbackfalseAllow --http-addr beyond loopback
ELCHI_AI_GATEWAY_PPROF--pproffalse/debug/pprof on the status server
ELCHI_AI_GATEWAY_ENTRA_DISABLE_INSTANCE_DISCOVERY--entra-disable-instance-discoveryfalseSkip Entra ID authority validation (a private authority set with AZURE_AUTHORITY_HOST)
ELCHI_AI_GATEWAY_EXTPROC_ADDR--extproc-addrunix:///run/elchi-ai-gateway/extproc.sockThe extproc's socket
ELCHI_AI_GATEWAY_MCP_ADDR--mcp-addrunix:///run/elchi-ai-gateway/mcp.sockThe MCP proxy's socket. Empty disables MCP.
ELCHI_AI_GATEWAY_MCP_WRITE_TIMEOUT--mcp-write-timeout15mLongest an MCP answer or SSE stream may take
ELCHI_AI_GATEWAY_MCP_EGRESS_ADDR--mcp-egress-addrhttp://127.0.0.1:10088The MCP egress. Must be 127.0.0.1.
ELCHI_AI_GATEWAY_AUTHZ_SOCKET--authz-socket/run/elchi-ai-gateway/authz.sockConsumer authorization. Empty disables it.
ELCHI_AI_GATEWAY_AUTHZ_REFRESH_INTERVAL--authz-refresh-interval1mHow often the quota counters re-read the other edges' usage from ClickHouse
ELCHI_AI_GATEWAY_EXTPROC_ADMIN_PORT--extproc-admin-port9064The extproc's admin port
ELCHI_AI_GATEWAY_EXTPROC_VERSION--extproc-version(none)The extproc release to download from the archive, e.g. v1.3.0
ELCHI_AI_GATEWAY_EXTPROC_BINARY--extproc-binary(none)A pre-placed binary (offline installs; no download)
ELCHI_AI_GATEWAY_EXTPROC_BINARY_SHA256--extproc-binary-sha256(none)Its expected checksum
ELCHI_AI_GATEWAY_EXTPROC_VERSION_STRING--extproc-version-string(none)Override the version the extproc's config gate demands
ELCHI_AI_GATEWAY_EXTPROC_FORCE_DOWNLOAD--extproc-force-downloadfalseDownload again even when cached
ELCHI_AI_GATEWAY_EXTPROC_BASE_DIR--extproc-base-dir/var/lib/elchi/ai-gatewayBinary store, seed, last-good
ELCHI_AI_GATEWAY_EXTPROC_INDEX_URL--extproc-index-urlhttps://archive.elchi.io/index.jsonThe archive index (point it at a mirror when air-gapped)
ELCHI_AI_GATEWAY_EXTPROC_KILL_TIMEOUT--extproc-kill-timeout20sSIGTERM → SIGKILL grace. Must exceed the extproc's fixed 15 s drain.
ELCHI_AI_GATEWAY_EXTPROC_LOG_LEVEL--extproc-log-level--log-levelThe extproc's log level. Bodies are always redacted.
ELCHI_AI_GATEWAY_ENDPOINT_PREFIXES--endpoint-prefixes(upstream default)e.g. anthropic:/ serves the native Anthropic API at /v1/messages
ELCHI_AI_GATEWAY_WATCH_DEBOUNCE--watch-debounce300msQuiet period before a conf.d change reloads
ELCHI_AI_GATEWAY_USAGE_SCRAPE_INTERVAL--usage-scrape-interval30sHow often token metrics are scraped for usage
ELCHI_AI_GATEWAY_USAGE_PROJECT--usage-project(none)Project id stamped on rows
ELCHI_AI_GATEWAY_USAGE_CLICKHOUSE_DSN--usage-clickhouse-dsn(none)ClickHouse for usage, request log and the other tables. Empty disables them all.
ELCHI_AI_GATEWAY_USAGE_CLICKHOUSE_TABLE--usage-clickhouse-tableelchi_ai_gateway_usageUsage table
ELCHI_AI_GATEWAY_USAGE_CLICKHOUSE_TTL_DAYS--usage-clickhouse-ttl-days90Usage retention. Raised to at least 32.
ELCHI_AI_GATEWAY_REQUESTS_ENABLED--requests-enabledtrueRequest-log kill switch
ELCHI_AI_GATEWAY_REQUESTS_TABLE--requests-tableelchi_ai_gateway_requestsRequest-log table
ELCHI_AI_GATEWAY_MCP_CALLS_TABLE--mcp-calls-tableelchi_ai_gateway_mcp_callsMCP call-log table
ELCHI_AI_GATEWAY_UPSTREAM_TABLE--upstream-tableelchi_ai_gateway_upstreamProvider-answers table
ELCHI_AI_GATEWAY_DECISIONS_TABLE--decisions-tableelchi_ai_gateway_decisionsDecision-log table
ELCHI_AI_GATEWAY_REQUESTS_RECEIVER_ADDR--requests-receiver-addr127.0.0.1:9003The loopback span receiver
ELCHI_AI_GATEWAY_REQUESTS_FORWARD_ENDPOINT--requests-forward-endpoint(none)An external OTLP/gRPC endpoint receiving policy-filtered spans
ELCHI_AI_GATEWAY_REQUESTS_FORWARD_INSECURE--requests-forward-insecurefalseForward without TLS
ELCHI_AI_GATEWAY_REQUESTS_FORWARD_HEADERS--requests-forward-headers(none)k=v,k2=v2
ELCHI_AI_GATEWAY_METRICS_OTLP_ENDPOINT--metrics-otlp-endpoint(none)Push the extproc's GenAI metrics over OTLP/gRPC
ELCHI_AI_GATEWAY_METRICS_OTLP_INSECURE--metrics-otlp-insecurefalsePush without TLS
ELCHI_AI_GATEWAY_METRICS_OTLP_CA_CERT--metrics-otlp-ca-cert(none)CA certificate file
ELCHI_AI_GATEWAY_METRICS_OTLP_HEADERS--metrics-otlp-headers(none)k=v,k2=v2
ELCHI_AI_GATEWAY_LOG_LEVEL--log-levelinfodebug, info, warn, error
ELCHI_AI_GATEWAY_LOG_FORMAT--log-formatjsonjson or text
ELCHI_AI_GATEWAY_LOG_SOURCE--log-sourcefalseSource file:line in logs
ELCHI_AI_GATEWAY_SHUTDOWN_TIMEOUT--shutdown-timeout30sGraceful shutdown budget

elchi-ai-gateway validate <dir> checks a configuration directory without starting anything. Exit 0 = valid (or empty), 1 = invalid (the error on stderr), 2 = usage error. Warnings go to stderr as warning: ….

ClickHouse tables​

The gateway creates these tables in the database of its DSN and adds new columns on upgrade. The control plane reads the same names. An edge whose DSN is empty writes nothing.

TableOne row perTTLRead by
elchi_ai_gateway_usagescrape interval × edge × gateway × provider × model × consumer × token type: tokens, requests, durations, time to first tokenusage.clickhouse_ttl_days, default 90, at least 32 (the monthly quotas sum a whole month)Usage page, cost, consumer quotas across edges
elchi_ai_gateway_usage_1hUTC hour × project × gateway × provider × model × consumer × token type (SummingMergeTree, filled by a materialized view)same as usageUsage page over days, weeks, months
elchi_ai_gateway_requestsLLM request: ids, status, error, duration, token breakdown, and (at capture level full) encrypted contentper row: the gateway's retentionDays (default 7, 1–365)Request log
elchi_ai_gateway_requests_1hUTC hour × project × gateway × provider × model × consumer × status × latency bucket90 daysUsage summary: error rate and latency percentiles
elchi_ai_gateway_upstreamminute × edge × gateway × provider × class × HTTP code × retried: count30 daysProvider status (Providers tab)
elchi_ai_gateway_decisionsDenial or flagged request: phase, status, code, sensitive types and counts (never values)90 daysSensitive data tab, usage summary
elchi_ai_gateway_mcp_callsMCP call: gateway, consumer, server, method, tool, status, class, durationusage.clickhouse_ttl_days, default 90, at most 365MCP calls tab, MCP call quotas
elchi_ai_gateway_mcp_calls_1hUTC hour × gateway × consumer × server × method × tool × class × latency bucket90 daysHourly rollup of the call log, written by the gateway
elchi_ai_gateway_rollups(rollup, since): when each hourly rollup startednoneThe control plane reads a rollup only for the whole hours after its earliest note

The rollups are never backfilled. For hours before a rollup existed, the control plane reads the raw table.

Generated Envoy resources​

All of these carry general.metadata.managed_by: elchi-ai-gateway. You can view them but not edit them. Names starting with elchi-aigw- or elchi-ai-gateway are reserved.

Defaults (seeded per project, per Envoy version):

NameKindPurpose
elchi-ai-gatewayClusterThe extproc socket (extproc.sock), HTTP/2
elchi-ai-gatewayHTTP filter (ExternalProcessor)The AI ext_proc filter, fail-closed
elchi-ai-gateway-credentialHTTP filter (HeaderToMetadata)First AI filter: moves x-elchi-provider-key into metadata
elchi-ai-gateway-headerHTTP filter (HeaderMutation)Sets the gateway header per virtual host
elchi-ai-gateway-authzClusterThe authorization socket (authz.sock)
elchi-ai-gateway-authz-keyHTTP filter (ExtAuthz)The key phase, before the extproc
elchi-ai-gateway-authz-modelHTTP filter (ExtAuthz)The model phase, after the extproc
elchi-ai-gateway-mcp-guardHTTP filter (ExternalProcessor)The MCP result scan, inert until a route turns it on
elchi-ai-gateway-alsAccess log (gRPC)The AI HCMs' access log to the authorization socket

Generated by every deploy:

NameKindPurpose
elchi-aigw-<provider>ClusterOne per provider
elchi-aigw-<provider>-tlsUpstream TLS contextIts TLS
elchi-aigw-m-<gateway>-<hash>ClusterA model several providers serve (a pool)
elchi-aigw-upstream-hpoHttpProtocolOptionsThe provider clusters' upstream filter chain
elchi-aigw-upstream-extproc, elchi-aigw-upstream-cl, elchi-aigw-upstream-codecUpstream HTTP filtersThat chain: ext_proc, content-length, codec
elchi-aigw-retry-previous-hosts, elchi-aigw-retry-prio-<n>Retry extensionsPool failover
elchi-aigw-gw-<gateway>-headerHeaderMutation per routeSets x-elchi-ai-gateway: <gateway>
elchi-aigw-gw-<gateway>-authz-modelExtAuthz per routeThe model phase reading the body (sensitive data)
elchi-aigw-gw-<gateway>-mcp-authz, elchi-aigw-gw-<gateway>-mcp-guardPer routeA gateway's own MCP phase and result scan
elchi-aigw-authz-key-off, elchi-aigw-authz-model-off, elchi-aigw-extproc-offPer route (disabled)Turn a filter off where it does not apply
elchi-aigw-l-<listener>RouteA listener's route: a virtual host per gateway bound to it
elchi-aigw-unclaimedVirtual hostA listener with no default gateway: 404 gateway_not_found
elchi-aigw-mcp_<server> (_tls, _hpo, _cred, _inject, _generic)Cluster, TLS, HPO, GenericSecret, credential injectorOne MCP server and its shared credential
elchi-aigw-mcp__proxy, elchi-aigw-mcp__authz, elchi-aigw-mcp__h2m, elchi-aigw-mcp__als, elchi-aigw-mcp__egressCluster, per-route, filter, access log, routeThe MCP proxy and the egress

Per AI listener (created by the listener call, named after it): the listener <listener>, its HCM <listener>-hcm, <listener>-redirect-hcm for a plain-HTTP port in redirect mode, and <listener>-mcp-hcm with the loopback entry <listener>-mcp while the project has MCP servers. That is why listener names may not end in -mcp or -redirect.

Route names inside a gateway's virtual host, as access logs show them in %ROUTE_NAME%: <gateway>/models/openai, <gateway>/models/anthropic, <gateway>/unrouted, <gateway>/model/<model>, <gateway>/not-served.

Metadata keys and headers​

KeyWhereMeaning
aigateway.envoy.io → per_route_rule_backend_nameProvider endpoint metadataThe provider whose credential the extproc injects. Reserved: a user resource cannot write this namespace.
aigateway.envoy.io → upstream_hostProvider endpoint metadata (DNS hosts)The host AWS SigV4 signs
aigateway.envoy.io → aigw_route_nameRoute metadataThe gateway a route belongs to
io.envoy.ai_gatewayDynamic metadataThe extproc's own (cost, content_length)
io.elchi.aigw.credential → provider_keyDynamic metadataA client's own provider key (credentialOverride)
io.elchi.aigw.mcp → consumer, gateway, server, method, toolDynamic metadata on the MCP egressThe MCP call log's fields
general.metadata.managed_by: elchi-ai-gatewayEvery generated resourceGenerated, read-only
ai_gateway_versionClient registration metadataThe gateway version an edge reports. Edges without it get no configuration. Versions below v0.4.0 hold MCP back.
x-elchi-authz-phasegRPC metadata to the authorizationkey or model
aigw_phase: mcpext_authz context extensions on /mcp routesThe MCP phase
x-elchi-ai-gatewayRequest headerThe gateway name, always set by Envoy
x-elchi-consumerRequest headerThe admitted consumer, set only by the authorization. A client's copy is removed.
x-ai-eg-modelRequest headerThe model, set by the extproc. A client's copy is removed.
x-elchi-provider-keyRequest headerA client's own provider key, moved to metadata and removed
x-elchi-mcp-token, x-elchi-mcp-token-<server>Request headerA user's own MCP server token