Codex cloud

API keys for Codex cloud tasks, without long-lived keys in the container

Codex cloud runs each task in a container built from your repository. The setup script can use secrets, but the agent itself cannot. This page explains how Codex cloud environments treat secrets, and how Shipkey gives the agent phase access to APIs without a long-lived key.

How the Codex cloud environment works

For a cloud task, Codex creates a container from your repository, runs your setup script (and a maintenance script when a cached container resumes), then applies the environment's internet settings. Setup scripts run with internet access. For the agent phase, internet access is off by default and can be turned on with an allowlist of domains and HTTP methods.

What it gives you for secrets

Codex has two kinds of values. Environment variables are set for the whole task, including the agent phase. Secrets are stored with an extra layer of encryption and are only available to setup scripts: they are removed before the agent phase starts. So if the agent has to call an API while it works, that key ends up in a plain environment variable the agent can read.

From the product's documentation, as read in December 2026: developers.openai.com/codex: cloud environments

Where Shipkey fits

  • Give the agent phase a grant token instead of a key. It lasts hours, only works for the providers you allow, and can be revoked.
  • The real keys stay in your gateway, a Cloudflare Worker in your own account, and are swapped in at the edge.
  • A new container does not need a new approval: with the environment key you got at approval, it renews by itself for a few days.
  • The same gateway serves Claude Code, Cursor and Gemini CLI.

Set it up for Codex cloud

  1. 1.Deploy the Shipkey issuer and gateway, two Cloudflare Workers, in your own account, and register your passkey as the approver. Self-hosting guide

  2. 2.Add the Shipkey plugin to the agent and tell it your issuer's address.

  3. 3.Turn on agent internet access for the environment and add your issuer's and gateway's domains to its allowlist.

  4. 4.Approve the environment with your passkey when the agent shows the check code. From then on its commands go through your gateway.

Other cloud environments