Skip to content

Conversation

@celia-oai
Copy link
Contributor

@celia-oai celia-oai commented Nov 7, 2025

Added doc for auth v2 endpoints. Updated the auth section in Codex MCP interface doc too.

@celia-oai celia-oai changed the title changes [App-server] Add auth v2 doc & update codex mcp interface auth section Nov 7, 2025
@celia-oai celia-oai marked this pull request as ready for review November 7, 2025 05:56

Response examples:
```json
{ "id": 1, "result": { "account": null, "requiresOpenaiAuth": false } } // no auth needed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's more accurate to say something like // Set to true for some enterprise-managed Codex deployments, which requires ChatGPT login

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not exactly this? it's more like set to false for oss? https://github.com/openai/codex/blob/main/codex-rs/core/src/model_provider_info.rs#L356. I'll update the comment to reflect this

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a user is using a model provider that does auth via an API key that is read from an environment variable (which also includes how we support the Copilot API in the VS Code extension), then requiresOpenaiAuth should be false. I can't remember offhand if "normal" OpenAI key auth (which is read from auth.json) also falls into this category.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting - looking at the code of how old get_auth_status workflow works it seems that we check requiresOpenaiAuth based on model provider, regardless of the auth method (api key or not): https://github.com/openai/codex/blob/main/codex-rs/app-server/src/codex_message_processor.rs#L820

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah nice, i did get it completely wrong lol. thanks for clarifying!


### Dev notes

- `codex generate-ts --out <dir>` emits v2 typings under `v2/`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: v2 typings -> v2 types

- `model/list` → enumerate available models and reasoning options
- Auth
- `loginApiKey`, `loginChatGpt`, `cancelLoginChatGpt`, `logoutChatGpt`, `getAuthStatus`
- `account/read`, `account/login/start`, `account/login/cancel`, `account/logout`, `account/rateLimits/read`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doc merits a follow-up to be rewritten because it's very misleading:

  • Historically, we had codex mcp, which did conform to the MCP (sorta).
  • We have since split it into codex mcp-server (which is an MCP server, though one that needs some attention...) and codex app-server
  • We really need to say "app server" when we mean the app server (including the name of this document!)

- `account/updated` (notify) — emitted whenever auth mode changes (`authMode`: `apikey`, `chatgpt`, or `null`).
- `account/rateLimits/read` — fetch ChatGPT rate limits; updates arrive via `account/rateLimits/updated` (notify).

### 1) Check auth state
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should try to autogenerate more of this from code at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sg


The v2 JSON-RPC auth/account surface exposes request/response methods plus server-initiated notifications (no `id`). Use these to determine auth state, start or cancel logins, logout, and inspect ChatGPT rate limits.

### Quick reference
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have an initialize?

@owenlin0
Copy link
Contributor

owenlin0 commented Nov 7, 2025

going to work on a PR to update this doc for Threads and Turns, so will merge to avoid conflicts 😁

@owenlin0 owenlin0 merged commit 2e81f19 into main Nov 7, 2025
25 checks passed
@owenlin0 owenlin0 deleted the dev/cc/update-doc branch November 7, 2025 16:17
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2025
@etraut-openai etraut-openai added the oai-pr PRs posted by Codex team members label Nov 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai-pr PRs posted by Codex team members

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants