Why should model calls pass through one gateway?
Why should model calls pass through one gateway?
If a company’s agents can call a model provider, why put another service between them? Direct access looks simpler. But once several teams run agents, whoever pays needs to know more than which provider sent an invoice. Which agent made the request? Who can stop a particular model? Where is the provider key? Those questions concern ownership as much as infrastructure.
Picture a procurement agent summarizing offers, an IT agent reviewing code and a finance agent explaining a spreadsheet. These are possible tasks, not a claim that today’s product completes them end to end. If every client holds its provider credential, rotating it becomes a workstation exercise. Provider billing may show aggregate consumption without identifying which agent caused it. A model change can leave different settings on different machines. The connection works, but the organization cannot easily understand its use.
A shared route without a shared persona
ADR-0004 in agentic-organization chooses an OpenAI-compatible gateway for workstation model traffic. The decision record rejects letting every workstation call the organization’s upstream endpoint directly: that approach loses a common place for logging and limits and distributes the provider key to laptops. It also considers operating a separate third-party gateway. Such a component may be useful, but connecting its requests to this product’s agent identity and audit records would still require work. The selected route puts a thin proxy in the backend and permits another compatible gateway behind it when appropriate.
The client authenticates to this proxy with a short-lived token tied to an agent persona, not with the upstream provider key. Server code resolves an active provider record and forwards the request. The current model resolver can use an explicitly configured provider or infer one from the model reference; if it cannot find an active record for the selected provider, it does not silently borrow a different provider’s key. Centralizing the route is therefore not a decision to make every team use the same model. It is a decision about where provider credentials, request identity and a control point live.
It is also important to say which calls this covers. The implementation in backend/api/gateway.py exposes chat completions, including streaming. An embeddings endpoint appears in the architectural decision but is not present in that gateway code. The gateway provides a control point for workstation agents configured to use it; it does not discover unrelated model calls made from an employee’s separate application. A policy attached to a route cannot constrain traffic that never takes that route. This is the same distinction between a written rule and an enforced boundary discussed in the earlier policy article.
Limits must be configured, not assumed
The code does more than relay an HTTP request. Before forwarding a chat request, backend/services/gateway_limits.py checks an allowed model list, a per-persona requests-per-minute limit and daily or monthly token quotas. The model allow-list can be narrowed by company setting, while the agent’s own configured model remains allowed. All these limits default to permissive settings. Merely installing the platform does not create a spending cap. Someone has to choose limits and understand how the counters behave before treating them as an operational boundary.
For a non-streaming response, the gateway reads usage from the provider’s response. On a streaming request, it asks the upstream for a usage event when the client has not already specified stream options and examines the stream for that event. The result depends on the upstream returning usage. The current usage update is best effort, and the rate-limit window lives in one process’s memory. A shared store for multiple server workers remains open work. Finance may reasonably ask for a budget threshold, but these implementation details mean the threshold should not be described as an infallible accounting lock. Test it under the deployment arrangement you intend to use.
The gateway records an audit event with agent identity, model, status, latency and available token counts. That makes a call more intelligible than an anonymous line on a provider bill. It also creates a data-handling question. In the current code, the audit payload includes a hash of the prompt and a preview of its beginning. ADR-0004 discusses a configurable retention policy, but the code still writes that preview without an evident per-company switch at this point. A team dealing with sensitive documents should not infer that the audit contains usage totals alone. Deciding who can inspect these records and what may enter a prompt is part of the rollout, not an afterthought.
What changes for each department?
Production may care most about a response arriving when a process needs it. A failed gateway is a real interruption, not an abstract trade-off. Procurement gains a clearer association between an offer-summary request and an agent, while still needing to decide whether the offer content can be sent to its selected upstream. Finance can define a consumption threshold, but should distinguish a best-effort counter from definitive billing. HR should ask whether a prompt preview could contain personal data. IT needs to test provider routing, gateway availability and what happens to rate limiting across workers. One central path does not make these departmental questions identical; it gives the teams a common place to investigate them.
Errors are another reason to inspect the boundary rather than advertise it. ADR-0004 notes that on the streaming path, a non-successful upstream status is not necessarily propagated as the same HTTP status to the client; the actual upstream status is captured in audit. The gateway code starts its streaming response before it can adjust the outer status based on the upstream reply. A client seeing a successful HTTP status must therefore not conclude that the upstream completed the requested work. Putting the backend on the critical path also adds latency and availability obligations. A gateway that is down can block the work it was meant to supervise.
Start with one agent. Locate its provider key, identify its audit identity and decide what happens during an outage. Configure allowed models and usage limits rather than accepting open defaults. Test streaming, non-streaming and failed upstream requests; compare the client’s view with counters and audit. This reveals which controls work today and which need further operating choices.
A central model gateway is not about imposing one AI workflow on every desk. It is about giving credentials, identity and usage a defined place while making the cost of that choice visible. ADR-0004 in agentic-organization records both the reason for that choice and its remaining limits. Mapping the actual path one of your agents takes to a model is a good way to see whether such a gateway would cover the traffic you care about.
Verification note: The design rationale and implementation limits in this article were checked against ADR-0004, the gateway and limit code, and the current known-limits documentation in the agentic-organization repository.