Developing a training task usually means running the agent more than once. You change the instructions, fix something in the environment, adjust the grader, and run it again to see what happens.

Those iterations have a model cost. If a rollout uses $2–$4 in API tokens, twenty attempts add up to $40–$80 before you include the compute. The exact amount depends on the model and the length of the trajectory, but the practical question is straightforward: if you already pay for a ChatGPT subscription, can you use its Codex allowance for those runs?

Yes. Codex supports signing in with your ChatGPT account for subscription access, including when the CLI runs on a remote machine. OpenAI documents both subscription and API-key authentication.

That gives us a useful setup: Modal runs the task environment, Harbor manages the rollout, and Codex uses the subscription to work on the task.

The model still runs on OpenAI’s infrastructure. Modal provides the machine where the agent reads files, edits code, compiles the project, and runs commands. You don’t need a GPU on Modal just because the task uses a language model.

There are two ways to get Codex signed in.

  1. Authorize the remote machine with a device code.

    In the environment where Codex will run, start:

    codex login --device-auth
    

    Codex provides a browser link and a one-time code. Open the link on your computer, sign in, and enter the code to authorize the remote session. Device-code login may need to be enabled in your account or workspace settings.

    This is convenient when the remote machine doesn’t have a browser. The code authorizes the login; it isn’t the credential you keep passing to future rollouts.

  2. Reuse a login you already have locally.

    Sign into Codex on your computer:

    codex login
    codex login status
    

    With file-backed credential storage, Codex saves the session in ~/.codex/auth.json. Harbor can supply that file to Codex inside the remote task environment.

    If Codex uses your operating system’s credential store, configure file-backed storage in ~/.codex/config.toml, then sign in again:

    cli_auth_credentials_store = "file"
    

Both approaches are covered in OpenAI’s headless-login instructions. Our current tooling uses the saved-login approach.

Once you have a working Harbor task, the rollout command is fairly small. This example assumes Codex, Harbor, and Modal are installed and your Modal account is configured. Replace ./tasks/my-task with your task directory and <available-codex-model> with a model your account can use.

env -u OPENAI_API_KEY \
    -u CODEX_API_KEY \
    -u CODEX_ACCESS_TOKEN \
  harbor run \
    --path ./tasks/my-task \
    -e modal \
    --agent codex \
    --model "<available-codex-model>" \
    --agent-env "CODEX_AUTH_JSON_PATH=$HOME/.codex/auth.json" \
    --n-concurrent 1 \
    --n-attempts 1 \
    --max-retries 0

The important setting is CODEX_AUTH_JSON_PATH. It tells Harbor which saved Codex login to supply to the agent. Harbor uploads the file into the task environment and makes it available to Codex. The command also removes API-key overrides so the authentication choice is explicit.

Starting with one attempt makes the result easier to inspect. Confirm that the agent actually worked on the task, read the trajectory, and check the grader’s result before increasing the number of runs. Harbor describes this subscription workflow in its task-development guide.

In our workspace, we wrapped this flow so we don’t have to move credentials around manually for each attempt. The wrapper retrieves the saved login from secure storage, checks authentication, lets Codex refresh the session if needed, and launches a single Harbor rollout on Modal. It keeps the run output and removes the temporary local credential file afterward.

We’ve completed a smoke rollout through that path. That establishes that the connection works; it doesn’t yet give us a measured savings figure across a large collection of tasks.

There is one operational detail that matters when you turn this into a repeatable workflow: the saved login changes over time.

Codex can refresh its credentials during a run. If an ephemeral machine disappears afterward, you need to preserve the updated file for the next run. Repeatedly restoring an old copy can eventually produce authentication failures. OpenAI’s guidance is to let Codex handle refreshes, save the resulting credentials, and serialize jobs that share a credential copy. Credential persistence guide

Our wrapper currently saves refreshes made before launch, but doesn’t recover a refresh made inside the remote trial. That is a remaining improvement for unattended runs. For the article’s basic workflow, keep the credential file in secure storage and start with a single development rollout.

The cost comparison also needs to separate model usage from compute:

Cost What changes
Model usage through Codex Uses the subscription’s available allowance when signed in through ChatGPT.
ChatGPT subscription You still pay for the plan.
Modal execution CPU, memory, and other resources remain separately billed.
Separate API-based analysis A judge or trajectory-analysis tool that calls an API still has its own model cost.

Modal publishes its resource charges on its pricing page. Subscription allowances and rate limits also remain relevant: moving the task to Modal doesn’t increase your account’s available Codex usage.

For someone already paying for ChatGPT, this is a useful option during task development. You can run an attempt, inspect why it failed, improve the task, and try again while using the allowance you already have. When you need sustained throughput or many simultaneous rollouts, compare an API-based setup against the subscription’s available capacity.

Start with one task and one rollout. Check the authentication method, inspect the result, and look at both model usage and Modal spend. That gives you a concrete basis for deciding whether the subscription route saves money for your workflow.