The model gateway

The configured model path is an in-cluster agentgateway proxy to Vertex AI. It centralizes provider credentials, model routing, usage attribution and policy enforcement for the platform’s runtime.

Model access

Each agent’s own ModelConfig points to the gateway’s OpenAI-compatible API. The request chooses the model from the supported catalog, which platform-api holds in memory and no tenant namespace stores; the gateway routes it to Vertex. The proxy uses its GKE Workload Identity for Google credentials. Provider authorization belongs to the dataplane identity.

The gateway is not a public browser API. Runtime egress and credential-provider rules, gateway authentication and authorization, and tenant attribution must agree. A private Service alone is not proof of actor identity, and a caller-supplied attribution header is not an authority to charge a tenant. Gateway policy must derive billing identity from trusted authentication context.

What telemetry proves

Access telemetry supplies attributed inference token usage through Cloud Logging and Pub/Sub to the platform’s evidence ledger. The dashboards count from the same records: model calls, tokens, cost and tool calls are log-based metrics over the gateway’s access log, so a dashboard total and an invoice line count the same calls. Scraped metrics show rates, latency and policy outcomes, not counts: the gateway creates a series at its first observation and the collector drops each series’ first point, so a count read from them misses a new agent’s first calls. They serve different purposes: a healthy request counter does not prove that every billable event reached Lago.

Served, refused, failed

The consoles count requests from the same access log. Each record carries the status the gateway answered with and, when the gateway ended the request itself, a reason (agentgateway’s ProxyResponseReason). A request is one of three kinds, never two:

Kind Reason on the record Counted as
Served none an error when the answer is a 5xx
Refused: the gateway decided not to send it on Guardrail, RateLimit, the authentication reasons (JwtAuth, APIKeyAuth, …), Authorization, Overload, NotFound, DirectResponse, and any reason a later gateway adds a refusal, whatever the status
Failed in the gateway NoHealthyBackend, Timeout, UpstreamFailure, Internal, ExtProc, MCP an error, unless it was answered with a 4xx

A failure answered with a 4xx is the upstream’s own answer passed on, so it is neither. A gRPC failure is answered HTTP 200 with a gRPC status, which is why the reason decides and the status does not.

The admin console’s Model gateway tab (AdminService.GetGatewayTelemetry) covers every route and keeps the kinds apart: refusals by reason, and errors, with the failures the gateway named listed by reason. The agent page’s Model calls card (StatsService.GetGatewayActivity) covers model calls only, the records that name a model, and lists each one the gateway ended, refused or failed, by reason. The gateway names the model once it has read the request and its policies have passed, and on a request guard’s refusal. A request it ends before that (no healthy backend, a failed authentication, an LLM rate limit) is in the tab’s figures and not on the card. A response guard replaces the answer and records no reason, so its refusals show only in the tab’s guardrail verdicts.

Gateway cost telemetry is a pricing cross-check, not a Google invoice. The gateway’s cost catalog and Lago’s plan are both rendered from one price book, so the cost the gateway records for a call is the customer’s token rate, not what Vertex AI charges the platform, and the customer charge is Lago’s invoice. The dashboards and consoles show that recorded cost as the token cost. See Metering and billing.

Tool-call records

The gateway also writes one access-log record for each call an agent makes to a tool server. That record is what the agent page’s Tool uses table is built from, so it carries more than a model-call record does: the call’s arguments, whether the tool reported a failure and what it said, and the run and call ids from the agent runtime’s W3C baggage. The tool’s result is not recorded; it stays in the run.

Arguments are customer content, and content is not kept in Cloud Logging. A log sink routes every tool-call record to Pub/Sub, where the platform stores it under its tenant and agent, and an exclusion on the default sink keeps the same records out of the log bucket. Sinks are evaluated independently, so a record is routed and never stored. The only copy is the agent’s own, served through SessionService.ListToolUses to the agent’s owner and deleted with the agent.

Model-call records carry no content at all: no prompt, completion or tool call is named in the gateway’s logging policy, and tests in the infrastructure repository pin both rules.

Limits and standing

Every model call carries the calling agent’s own gateway key. The gateway rejects a call without a registered key, and the key’s metadata attributes the call’s usage to the agent and its tenant.

The gateway enforces no money limit. There is no prepaid balance, no admission check against a spend figure and no hard stop: a call is never refused for what it costs. Its usage is billed on the tenant’s monthly Lago invoice; see Monthly invoices. The billing gates on new paid work, the card requirement and payment standing, are enforced by platform-api before the work starts, not per call at the gateway.

The gateway also routes brokerage traffic and broker MCP calls. Those routes use their own authentication, account ownership and market-policy checks; a working model call is not permission to place a paper order. See The paper brokerage.