Skip to main content
OpenAI’s Codex CLI is a coding agent that runs locally and shells out to other tools. Authsome plugs in cleanly: wrap the agent invocation with authsome run -- and the proxy injects fresh credentials for every service the agent calls.
The agent drives login. When Codex hits a missing credential it runs authsome login <provider> itself, opens a browser on your machine for OAuth consent, and picks up from there. Don’t paste keys into prompts and don’t pre-run login commands unless you’re seeding a credential ahead of time.

Run Codex under the auth proxy. Paste this to set up the wrapper.

What you get

  • One login per service. Codex never sees raw client_secrets, tokens, or API keys.
  • Automatic refresh. OAuth tokens stay fresh between Codex sessions.
  • Multi-account support. Run Codex against your work GitHub one minute, personal the next.
  • The same vault. Connections created from Codex live alongside connections from the regular CLI.
Inside Codex:
  • OPENAI_API_KEY=authsome-proxy-managed is set in Codex’s environment, so its SDK initializes.
  • Outbound HTTPS calls to api.openai.com, api.github.com, and any other matched provider are intercepted and authenticated at the proxy layer.
  • Codex’s own subprocess calls inherit the same HTTP_PROXY / HTTPS_PROXY variables, so tools Codex spawns are also covered.

Alternative: env export before launch

If Codex is running in an environment where the proxy CA cannot be trusted, fall back to env-var export:
The variables persist for the shell session. Codex (and anything it spawns) reads them as it normally would. Re-run eval after token refresh, or use the proxy pattern above to avoid that step.

Multiple accounts

The proxy uses each provider’s default connection. To target a non-default connection in a single Codex session, set it as the default with --force first. See Multiple connections per provider.

Embedding the library

If you’re orchestrating Codex from a larger Python program and need explicit per-call control, drop below the proxy into the library:
This pattern is cleaner than passing keys through prompts or hardcoding them into .env files. See Python library.

Troubleshooting

What’s next

Run agents with the proxy

The injection model in detail.

OpenAI integration

Set up the OpenAI key Codex will use.