aither_codex/constant.rs
1//! Constants for the `ChatGPT` Codex backend and its OAuth flow.
2
3/// `OpenAI` auth issuer base URL.
4pub const ISSUER: &str = "https://auth.openai.com";
5
6/// Public OAuth client ID shared by Codex-compatible third-party clients.
7///
8/// Registered for the `http://localhost:1455` loopback redirect; the port and
9/// path are fixed by the client's registration and cannot be changed.
10pub const CLIENT_ID: &str = "app_EMoamEEZ73f0CkXaXp7hrann";
11
12/// OAuth authorization endpoint (browser flow).
13pub const AUTHORIZE_URL: &str = "https://auth.openai.com/oauth/authorize";
14
15/// OAuth token endpoint (authorization-code exchange and refresh grants).
16pub const TOKEN_URL: &str = "https://auth.openai.com/oauth/token";
17
18/// Device authorization request endpoint (headless flow).
19pub const DEVICE_CODE_URL: &str = "https://auth.openai.com/api/accounts/deviceauth/usercode";
20
21/// Device authorization token polling endpoint.
22pub const DEVICE_TOKEN_URL: &str = "https://auth.openai.com/api/accounts/deviceauth/token";
23
24/// Page where the user enters the device code.
25pub const DEVICE_VERIFICATION_URL: &str = "https://auth.openai.com/codex/device";
26
27/// Local port for the OAuth loopback redirect listener.
28pub const OAUTH_PORT: u16 = 1455;
29
30/// Redirect URI registered for [`CLIENT_ID`].
31pub const REDIRECT_URI: &str = "http://localhost:1455/auth/callback";
32
33/// OAuth scopes requested at login.
34pub const OAUTH_SCOPES: &str = "openid profile email offline_access";
35
36/// Base URL for the subscription Codex Responses backend.
37pub const CODEX_BASE_URL: &str = "https://chatgpt.com/backend-api/codex";
38
39/// Client version sent to the models endpoint and as request metadata.
40pub const CLIENT_VERSION: &str = "0.160.0";
41
42/// `originator` header value identifying this client to the backend.
43pub const ORIGINATOR: &str = "may";
44
45/// The header carrying the `ChatGPT` account identifier.
46pub const ACCOUNT_ID_HEADER: &str = "ChatGPT-Account-Id";
47
48/// Optional residency hint header; only sent when the token carries a real
49/// constraint (`no_constraint` is omitted).
50pub const RESIDENCY_HEADER: &str = "x-openai-internal-codex-residency";