Skip to content

feat: add built-in OpenAI Codex OAuth support#25

Merged
F16shen merged 1 commit intoAI-Shell-Team:mainfrom
guanzi008:feat/openai-codex-oauth
Mar 12, 2026
Merged

feat: add built-in OpenAI Codex OAuth support#25
F16shen merged 1 commit intoAI-Shell-Team:mainfrom
guanzi008:feat/openai-codex-oauth

Conversation

@guanzi008
Copy link
Copy Markdown
Contributor

@guanzi008 guanzi008 commented Mar 11, 2026

Summary

  • add built-in OpenAI Codex account auth to aish, without requiring a traditional API key
  • support browser PKCE login, device-code login, and optional codex-cli compatibility fallback
  • wire openai-codex/* models into the existing config, setup, shell, and LLM runtime paths
  • handle the official Codex backend stream format and token refresh flow, with regression tests

Usage

Login with built-in browser OAuth:

aish models auth login --provider openai-codex

Login on a headless server:

aish models auth login --provider openai-codex --auth-flow device-code

Optional fallback using the local codex CLI:

aish models auth login --provider openai-codex --auth-flow codex-cli

Use an account-scoped model after login:

aish run --model openai-codex/gpt-5.4

Or switch inside the shell:

/model openai-codex/gpt-5.4

Notes:

  • openai-codex/* does not require api_key
  • auth file resolution supports AISH_CODEX_AUTH_PATH, codex_auth_path, $CODEX_HOME/auth.json, and ~/.codex/auth.json

Testing

  • .venv/bin/pytest -q tests/test_openai_codex.py tests/test_cli.py tests/test_shell.py
  • 67 passed

@github-actions github-actions Bot added pty PTY or interactive process issue core agent Agent or LLM workflow issue config cli tests size: XL docs labels Mar 11, 2026
@guanzi008 guanzi008 force-pushed the feat/openai-codex-oauth branch from 3d93ee2 to d69f8c8 Compare March 11, 2026 14:06
@github-actions github-actions Bot removed the docs label Mar 11, 2026
@F16shen
Copy link
Copy Markdown
Collaborator

F16shen commented Mar 12, 2026

功能上可以先合并。
我会补一个PR,把现在这些 openai-codex specific 的分支收敛成统一的 provider 抽象,方便以后新增其他OAuth provider

@F16shen F16shen merged commit fa3f2dc into AI-Shell-Team:main Mar 12, 2026
9 of 12 checks passed
@F16shen
Copy link
Copy Markdown
Collaborator

F16shen commented Mar 12, 2026

Resloves #38

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Agent or LLM workflow issue cli config core pty PTY or interactive process issue size: XL tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants