@x-otto/plugin-openai-codex 0.1.0-alpha.0
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/README.md +35 -0
- package/otto-plugin.json +65 -0
- package/package.json +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @x-otto/plugin-openai-codex
|
|
2
|
+
|
|
3
|
+
> OAuth-based OpenAI ChatGPT (Codex) subscription provider plugin.
|
|
4
|
+
|
|
5
|
+
Provides access to OpenAI GPT models via a ChatGPT subscription OAuth flow (PKCE). Previously built-in, now a first-party plugin. Uses the `openai-responses` wire protocol with JWT-derived request headers from the ChatGPT OAuth tokens.
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
This plugin combines **declarative OAuth** (PKCE flow in `otto-plugin.json` `contributes.oauth`) with **declarative provider** (`contributes.providers`). It uses `tokenDerivedHeaders` to extract the `chatgpt-account-id` from the JWT claims in the OAuth tokens — a requirement for the ChatGPT Codex backend API.
|
|
10
|
+
|
|
11
|
+
The OAuth loopback ports (1455, 1457) and the `assumesLoopbackAlways` flag handle the browser-less CLI redirect flow.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
otto extension install plugin-openai-codex
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Requires `plugin-otto-wire-protocols` to be installed and trusted.
|
|
20
|
+
|
|
21
|
+
## Configuration
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
otto auth login openai-codex
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Provided models
|
|
28
|
+
|
|
29
|
+
| Model | Context | Strengths |
|
|
30
|
+
|-------|---------|-----------|
|
|
31
|
+
| `openai/gpt-5.1-codex` | 400K | reasoning, knowledge, coding, planning |
|
|
32
|
+
|
|
33
|
+
## Dependencies
|
|
34
|
+
|
|
35
|
+
- `plugin-otto-wire-protocols` (runtime peer)
|
package/otto-plugin.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "plugin-openai-codex",
|
|
3
|
+
"name": "OpenAI Codex OAuth Provider",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "OAuth-based OpenAI ChatGPT subscription provider (RFC-122 PKCE template + JWT token-derived headers). Previously built-in, now a first-party plugin.",
|
|
6
|
+
"capabilities": ["provider"],
|
|
7
|
+
"dependsOn": ["plugin-otto-wire-protocols"],
|
|
8
|
+
"contributes": {
|
|
9
|
+
"oauth": [
|
|
10
|
+
{
|
|
11
|
+
"kind": "pkce",
|
|
12
|
+
"id": "openai-codex",
|
|
13
|
+
"name": "OpenAI (ChatGPT Codex)",
|
|
14
|
+
"clientId": "QeIOi4qKJ2SHcNZAIIiGc8WkNVkgQdCX",
|
|
15
|
+
"authorizeUrl": "https://chatgpt.com/oauth/authorize",
|
|
16
|
+
"tokenUrl": "https://oauth.oaistatic.com/v1/oauth/token",
|
|
17
|
+
"redirectUri": "https://chatgpt.com/oauth/code/callback",
|
|
18
|
+
"scope": "openid profile email offline_access inference",
|
|
19
|
+
"loopbackPorts": [1455, 1457],
|
|
20
|
+
"tokenExchangeEncoding": "form",
|
|
21
|
+
"extraAuthParams": {
|
|
22
|
+
"id_token_add_organizations": "true",
|
|
23
|
+
"codex_cli_simplified_flow": "true"
|
|
24
|
+
},
|
|
25
|
+
"assumesLoopbackAlways": true,
|
|
26
|
+
"subscriptionScoped": true
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"providers": [
|
|
30
|
+
{
|
|
31
|
+
"id": "openai-codex",
|
|
32
|
+
"name": "OpenAI (ChatGPT Codex)",
|
|
33
|
+
"baseUrl": "https://chatgpt.com/backend-api/codex",
|
|
34
|
+
"wireApi": "openai-responses",
|
|
35
|
+
"oauthRef": "openai-codex",
|
|
36
|
+
"preserveProviderId": true,
|
|
37
|
+
"tokenDerivedHeaders": [
|
|
38
|
+
{
|
|
39
|
+
"header": "chatgpt-account-id",
|
|
40
|
+
"source": {
|
|
41
|
+
"kind": "jwt-claim",
|
|
42
|
+
"claim": "chatgpt_account_id",
|
|
43
|
+
"namespace": "https://api.openai.com/auth",
|
|
44
|
+
"tokenSources": ["id_token", "access_token"]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"headers": {
|
|
49
|
+
"originator": "codex_cli_rs"
|
|
50
|
+
},
|
|
51
|
+
"responseBodyPolicy": {
|
|
52
|
+
"store": false,
|
|
53
|
+
"sendMaxOutputTokens": false
|
|
54
|
+
},
|
|
55
|
+
"modelsEndpoint": {
|
|
56
|
+
"url": "https://chatgpt.com/backend-api/codex/models?client_version={clientVersion}",
|
|
57
|
+
"responseFormat": "openai-list"
|
|
58
|
+
},
|
|
59
|
+
"models": [
|
|
60
|
+
{ "id": "openai/gpt-5.1-codex", "contextWindow": 400000, "maxOutput": 128000, "cost": { "input": 1.25, "output": 10, "cacheRead": 0.125, "cacheWrite": 0 }, "strengths": ["reasoning", "knowledge", "coding", "planning"], "reasoning": true, "thinkingLevels": ["low", "medium", "high"] }
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@x-otto/plugin-openai-codex",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"otto-plugin.json",
|
|
8
|
+
"README.md"
|
|
9
|
+
],
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public",
|
|
12
|
+
"registry": "https://registry.npmjs.org",
|
|
13
|
+
"tag": "alpha"
|
|
14
|
+
}
|
|
15
|
+
}
|