Infrastructure Overhead Cost Hidden Inside Every Self-Managed Claude Code or Codex Deploy
Model access is cheap; running the agents safely is where the money goes.

A bring-your-own API key cloud coding agent runner lets teams run Claude Code or Codex with their own API key from OpenAI or another model provider without managing the execution infrastructure. Self-managed deployments retain that responsibility, adding compute, isolation, credentials, gateways, attribution, and maintenance to the visible model price. An isolated cloud platform takes on those responsibilities, but the costs are still there.
What teams actually pay for when they buy Claude Code or Codex
The per-seat or per-token price buys access to the coding agent or its model. Codex plans start at $20/month for Codex Plus, while its CLI is open source under Apache-2.0. Procurement sees the access price. Engineering inherits the runtime.
That distinction also separates running an agent from serving a model. A team that uses an external model API still needs somewhere for the agent to edit files, run commands, and run tests. If it also operates inference infrastructure, that adds another responsibility. The visible price therefore covers only part of the deployment, and the remaining expense depends on what the team chooses to own.
Why self-managed agent deployments carry a structurally different cost profile than self-managed developer tools
Coding agents are autonomous loops with unpredictable resource use. They can request compute, open connections, write credentials, and retry failures without a person initiating each step. A retry is another opportunity to consume resources. Unlike a workflow whose safeguards depend on a developer pausing to make a decision, an agent workflow needs those safeguards enforced automatically.
Token consumption follows the same pattern. Each step re-sends the accumulated context, so volume grows with task complexity. One task can push 400K to 2M cumulative input tokens through the API.
Parallel execution multiplies these effects through more independent agent loops operating under the same infrastructure permissions and budget. The deployment must enforce spend limits, blast-radius boundaries, and audit trails that human workflows often leave to procedure. That enforcement is the reason the second cost layer exists.
Compute: the GPU and VM bill that runs whether agents are working or not
Within the self-managed compute bill, idle infrastructure is the primary expense. Every coding session needs a VM or container in which to run shell commands, edit files, and execute tests. The team pays for those environments for as long as they are provisioned.
For deployments that also run GPU inference, low utilization makes peak-sized capacity particularly expensive. A GPU node left running from Friday evening to Monday morning accumulates roughly 63 hours of charges without productive work. That weekend can cost more than a small team's entire monthly hosted-API bill. A team using an external API still needs a lifecycle for its execution VMs even without owning that inference capacity.
The remedy itself requires engineering work. Scale-to-zero, auto-stop, and spot nodes for batch work need explicit configuration in a provisioning layer such as OpenTofu/Terraform or an internal developer platform. Those controls are not part of the agent subscription. With parallel workspaces, incomplete cleanup leaves many environments idle.
Sandboxing: the isolation each agent session requires and what providing it costs
An execution environment must do more than provide compute. Each session that handles proprietary code needs isolation to keep a prompt injection, runaway loop, or bad write from reaching production systems or another tenant's code. That boundary has an operating cost. It must be provisioned before the session starts, maintained during execution, and torn down cleanly afterward.
MicroVM isolation gives each agent workload a dedicated kernel and is the baseline for production deployments handling proprietary code. With lighter container isolation, the blast radius is wider if an agent misbehaves. In a Kubernetes-based stack, supporting the workload involves dedicated node pools, with the NVIDIA GPU Operator when GPU inference is involved and KEDA or Knative for scale-to-zero. A vanilla cloud account does not arrive with that system configured.
Permissions must reinforce the runtime boundary. Provisioning must include environment-level RBAC that prevents a development agent from redeploying or stopping production inference. The expense is therefore both the capacity reserved for isolated sessions and the engineering needed to keep their boundaries intact.
Secrets management: why agents make credential hygiene a structural problem
A secret placed in agent context can be exposed or misused through prompt injection, so credentials need an architecture separate from the agent itself. The boundary belongs outside the model's context. The safe pattern is for the agent to call a scoped platform API while the platform holds the cloud credentials.
A GitHub PAT scoped only to issue creation and PR opening limits what that credential can authorize. A broad service-account key in agent context does not. Designing those scopes, distributing access, and enforcing the separation requires a maintained service.
The supporting controls also need ongoing operation. Secret scanning on every agent-generated PR, environment-level RBAC, and audit logs connecting credential use to a specific run and prompt all require engineering time. As agent use expands, these controls must continue to cover the sessions being created. Secrets management becomes a first-class infrastructure responsibility because context handling makes the credential boundary part of every run.
The gateway layer: spend control and rate limiting that the model API does not provide
Credential boundaries constrain authority, but they do not constrain model spending. Model APIs do not provide the per-agent spend limits and rate caps needed to contain each autonomous loop. A gateway supplies that missing enforcement point. Without it, a looping agent can consume the team's monthly API budget rather than merely the allowance intended for one task.
LiteLLM is a concrete example of the proxy layer teams can deploy for this purpose. The work includes configuring budgets, rate limits, and routing for the agents that share model access. Those policies need to reflect the deployment's agent boundaries. Bringing a key supplies access. It does not establish an operating policy.
The gateway also supports attribution through per-key routing. That makes it part of the evidence needed to answer what an agent run cost, although it does not allocate the underlying VM or GPU expense by itself. In a self-managed stack, the team still has to deploy this layer and keep it running. It is not supplied by the model subscription.
Cost attribution: why "who pays for this GPU" has no answer without a separate tool
Cloud billing records infrastructure consumption at a coarser level than an agent task. Account- or service-level totals do not identify which run, model, or team produced a spike. Ownership needs its own instrumentation before execution begins. Without that mapping, an expensive node can go unclaimed until the bill arrives.
OpenCost allocates spend by namespace, controller, label, and pod, including GPU time. Teams can use those dimensions to link infrastructure charges to workloads, but they still need to design labels and namespaces to show who owns what. The tool cannot substitute for that design. Gateway records and infrastructure allocation each help answer a different part of what a run cost.
The operational test is direct. If the answer to who pays for a GPU is that nobody labelled it, attribution needs fixing before an agent receives deployment authority. Labels, namespaces, and OpenCost or Kubecost configuration belong before the first production run.
Engineering hours: the ongoing operational tax that never appears in a pricing calculator
Across serving, gateway, provisioning, and attribution, selecting tools, configuring their boundaries, and keeping them working together is a platform-engineering project. Its labor cost grows with the number of agents, models, and environments in use.
Wrappers, governance tooling, redaction, and logging need engineering capacity as more developers and agents enter the system. A change to a model or serving layer can also require a response from the platform team. vLLM's v0.6.0 release changed throughput and latency characteristics significantly, illustrating why serving-layer upgrades require attention to capacity and performance.
Engineering time can consequently be the largest single cost in a self-managed deployment. Each layer needs an owner after launch, and the connections between layers need maintenance too. A pricing calculator can show rented capacity while leaving out the people responsible for making that capacity safe and useful.
How the hidden layer accumulates across a real deployment
Consider a deployment that runs agents in parallel to close more tickets at once. Additional sessions require more execution environments and isolation lifecycles, while concurrent model calls increase gateway load. Each run also needs scoped access and attributable spending. The same increase in adoption reaches every layer.
With automation, work moves from intake to execution without waiting for a person. When scheduled tasks, event-driven triggers, and Sentry alerts open agent sessions, guardrails must work even when no one is there to step in. OpenAI's Codex bug-triage documentation lists Sentry, Slack, Linear, and GitHub as installable bug-intake plugins. Each integration brings a credential boundary to scope, a session to isolate, and a cost to attribute.
Scaling environments down reduces idle compute, but the provisioning controls must remain consistent with session isolation. Attribution depends on labels and routing that connect the workspace to its model usage. Credential controls must cover sessions created by automated intake as well as those started by hand.
Engineering must keep the components working, both on their own and together. As adoption grows, the hidden layer compounds through those dependencies rather than ending when the initial deployment is complete.
How do teams run Claude Code or Codex in the cloud without managing their own infrastructure?
An isolated cloud runner moves the execution stack into the platform's responsibility. The underlying infrastructure still has a cost. What changes is who provisions it, operates its safeguards, and maintains the connections between its layers.
A platform taking responsibility for the hidden layer must also provide the gateway, secrets architecture, attribution tooling, and maintenance that a self-managed team would otherwise own. The agent receives access through an API call or a pull request, never an IAM user or service-account key.
Integration and governance determine how much work actually moves. Platform-provided entry points can include Slack, Linear, GitHub, GitLab, the dashboard, the API, schedules, and webhooks. SOC 2, SCIM, audit logs, and self-hosting are also product criteria, rather than capabilities to assume from the phrase “cloud runner.” A hosted VM alone does not resolve the entire operating burden.
Teams with specific regulatory or data-residency requirements may still choose self-management. The lesson for those teams is to build serving, gateway, provisioning, and attribution deliberately and budget engineering hours explicitly. For teams choosing a cloud platform, the comparison is between complete operating responsibilities.


