Sign a Codex agent in with ChatGPT

Run a Codex agent on your own ChatGPT plan with a one-time device code, from the console or the CLI. What it means for billing, and how to sign out again.

On this page

An agent on the Codex runtime normally calls its model through the inference key that comes with Qoren, paid in credits. If you have a ChatGPT plan, you can sign the agent in to your ChatGPT account instead, so its work runs on that plan. You sign in with a one-time code; no password is ever typed into Qoren.

Before you start#

  • A Codex agent that has finished setting up. Only runtimes that support this kind of sign in show the card, and today that is Codex. See runtimes.
  • A ChatGPT account you can sign in to in your browser.
  • On a ChatGPT Enterprise workspace, a workspace admin may first need to turn on device code sign in.

Sign in from the console#

  1. Open the Codex agent and click Settings, then Keys.
  2. Scroll to the ChatGPT sign in card. Its badge says Platform key while the agent runs on Qoren's key.
  3. Click Sign in with ChatGPT (1).
The ChatGPT sign in card on a Codex agent's Keys settings, showing that it runs on the platform inference key, with a Sign in with ChatGPT button.1
The ChatGPT sign in card on a Codex agent, before signing in: Sign in with ChatGPT (1).
  1. Wait a moment while Qoren asks ChatGPT for a one-time code. The card then shows the code in large letters. Click Copy code.
  2. Click Open the ChatGPT device page, sign in to ChatGPT in that tab if asked, and enter the code.
  3. Approve the sign in. Leave the Qoren page open: the agent finishes the sign in as soon as you approve, and the button reads Waiting for your approval… until then.

The code expires in about 15 minutes. If it runs out, or the sign in fails, the card shows the error and the button changes to Try signing in again.

When it works, the badge changes to Signed in (1) and the card says Runs on your ChatGPT plan.

The ChatGPT sign in card after a successful sign in: it shows Signed in, says the agent runs on your ChatGPT plan, and offers a Sign out button.12
A signed-in Codex agent: the Signed in badge (1) and the Sign out button (2).

Check again re-reads which sign in the agent is using right now. If the badge shows Unknown, Qoren could not reach the agent's environment; try again once it is back up.

Sign in from the CLI#

With the Qoren CLI installed and signed in, run:

qoren agent chatgpt-login <agent-id>

The command prints the ChatGPT device page address and the one-time code, then waits until you approve in your browser. When it finishes, the agent's work runs on your ChatGPT plan. Add --no-wait to print the job id and return straight away instead of waiting.

What it means for billing#

  • Model usage goes to your ChatGPT plan. Work the agent does while signed in is billed by OpenAI to that plan. It does not appear in Qoren's spend metering, so it does not use credits and does not show as model charges in Qoren.
  • Everything else still uses credits. The environment the agent runs on, mailboxes and web searches are paid in credits as usual. See how credits work.
  • It is per agent. Signing one Codex agent in changes nothing for your other agents. To move all your agents' model usage to your own account, see bring your own key.

Sign out#

In the console:

  1. Open the agent and go to Settings, then Keys.
  2. In the ChatGPT sign in card, click Sign out (2).

From the CLI:

qoren agent chatgpt-logout <agent-id>

Either way, the agent goes back to Qoren's inference key from its next turn, and its model usage is paid in credits again. A turn that is already running finishes on the plan it started with.

Frequently asked questions#

Which agents can sign in with ChatGPT?

Agents on the Codex runtime. The ChatGPT sign in card only appears on runtimes that support a device code sign in, and today that is Codex.

Do I type my ChatGPT password into Qoren?

No. You sign in on ChatGPT's own device page in your browser and enter the one-time code there. Qoren only receives the result.

How long is the code valid?

About 15 minutes. If it expires, click Try signing in again for a new code.

Does signing in stop credits being used?

Only for the agent's model usage. Hosting, mailboxes and web searches still use credits.

Our company uses ChatGPT Enterprise and the sign in fails. Why?

Enterprise workspaces may need a workspace admin to turn on device code sign in before it works.

Was this page helpful?

Last updated