openai-oauth 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +60 -0
- package/dist/chunk-VZQM4BY4.js +22616 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +125 -0
- package/dist/index.d.ts +153 -0
- package/dist/index.js +10 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# openai-oauth
|
|
2
|
+
|
|
3
|
+
OpenAI-compatible local endpoint backed by your ChatGPT account.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx openai-oauth
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
When startup succeeds, the CLI prints:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
OpenAI-compatible endpoint ready at http://127.0.0.1:10531/v1
|
|
15
|
+
Use this as your OpenAI base URL. No API key is required.
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If no auth file is available, it fails early and tells you to run:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx @openai/codex login
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Configuration
|
|
25
|
+
|
|
26
|
+
| Config | CLI | Default | Description |
|
|
27
|
+
| --- | --- | --- | --- |
|
|
28
|
+
| Host binding | `--host` | `127.0.0.1` | Host interface the local proxy binds to. |
|
|
29
|
+
| Port | `--port` | `10531` | Port the local proxy binds to. |
|
|
30
|
+
| Model allowlist | `--models` | `gpt-5.4`, `gpt-5.3-codex`, `gpt-5.3-codex-spark`, `gpt-5.2`, `gpt-5.1`, `gpt-5.1-codex`, `gpt-5.1-codex-max` | Comma-separated list of model ids exposed by `/v1/models`. |
|
|
31
|
+
| Upstream base URL | `--base-url` | `https://chatgpt.com/backend-api/codex` | Override the upstream Codex base URL. |
|
|
32
|
+
| OAuth client id | `--oauth-client-id` | `app_EMoamEEZ73f0CkXaXp7hrann` | Override the OAuth client id used for refresh. |
|
|
33
|
+
| OAuth token URL | `--oauth-token-url` | `https://auth.openai.com/oauth/token` | Override the OAuth token URL used for refresh. |
|
|
34
|
+
| Auth file path | `--oauth-file` | `--oauth-file` path if provided, otherwise `$CHATGPT_LOCAL_HOME/auth.json`, `$CODEX_HOME/auth.json`, `~/.chatgpt-local/auth.json`, `~/.codex/auth.json` | Override where the local OAuth auth file is discovered. |
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
What currently works:
|
|
39
|
+
|
|
40
|
+
- Working Endpoints:
|
|
41
|
+
- `/v1/responses`
|
|
42
|
+
- `/v1/chat/completions`
|
|
43
|
+
- `/v1/models` (with configurable model allowlist)
|
|
44
|
+
- Streaming Responses
|
|
45
|
+
- Toolcalls
|
|
46
|
+
- Reasoning Traces
|
|
47
|
+
|
|
48
|
+
## Known Limitations
|
|
49
|
+
|
|
50
|
+
What is intentionally not there yet:
|
|
51
|
+
|
|
52
|
+
- Only LLMs supported by Codex are available. This lists updates over time and is dependent on your Codex plan.
|
|
53
|
+
- Login flow is intentionally not bundled. Simply run `npx @openai/codex login` to create the auth file.
|
|
54
|
+
- There is no stateful replay support on the CLI `/v1/responses` endpoint. The proxy is stateless and expects callers to send the full conversation history.
|
|
55
|
+
|
|
56
|
+
## How it Works
|
|
57
|
+
|
|
58
|
+
OpenAI's Codex CLI uses a special endpoint at `chatgpt.com/backend-api/codex/responses` to let you use special OpenAI rate limits tied to your ChatGPT account.
|
|
59
|
+
|
|
60
|
+
By using the same Oauth tokens as Codex, we can effectively use OpenAI's API through Oauth instead of buying API credits.
|