@galaxy-yearn/codex-deepseek-gateway 0.1.1 → 0.1.3
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 +21 -0
- package/README.md +121 -116
- package/bin/codex-deepseek-gateway.js +45 -5
- package/config/gateway.example.json +5 -0
- package/package.json +27 -6
- package/src/codex-sessions.js +375 -0
- package/src/config.js +16 -0
- package/src/firecrawl.js +369 -0
- package/src/protocol.js +4 -11
- package/src/server.js +140 -18
- package/src/tavily.js +20 -1
- package/src/web-search-emulator.js +331 -33
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Galaxy-Yearn
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
A small local gateway for using DeepSeek V4 models from Codex.
|
|
4
4
|
|
|
5
|
-
Codex
|
|
5
|
+
Codex keeps sending OpenAI `Responses API` requests to a local endpoint. The gateway converts those requests to DeepSeek-compatible `Chat Completions`, calls DeepSeek, then converts the result back to Responses JSON or streaming `response.*` events.
|
|
6
|
+
|
|
7
|
+
NPM package: [@galaxy-yearn/codex-deepseek-gateway](https://www.npmjs.com/package/@galaxy-yearn/codex-deepseek-gateway)
|
|
6
8
|
|
|
7
9
|
The runtime uses only the Node.js standard library. It installs under `~/.codex/deepseek-gateway`, runs as a detached background process, and does not edit your existing Codex config.
|
|
8
10
|
|
|
11
|
+
Use this when you want Codex to stay on its normal Responses API path while the actual model is DeepSeek, including DeepSeek thinking output, function calls, local session resume help, and optional web search emulation through Tavily and Firecrawl.
|
|
12
|
+
|
|
9
13
|
## Requirements
|
|
10
14
|
|
|
11
15
|
- Node.js 20 or newer
|
|
@@ -20,81 +24,36 @@ Run:
|
|
|
20
24
|
npx @galaxy-yearn/codex-deepseek-gateway install
|
|
21
25
|
```
|
|
22
26
|
|
|
23
|
-
This copies the
|
|
27
|
+
This copies the runtime to:
|
|
24
28
|
|
|
25
29
|
```text
|
|
26
30
|
~/.codex/deepseek-gateway
|
|
27
31
|
```
|
|
28
32
|
|
|
29
|
-
It
|
|
33
|
+
It creates two local config files:
|
|
30
34
|
|
|
31
35
|
```text
|
|
32
36
|
~/.codex/deepseek-gateway/config/gateway.local.json
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Open that file and replace `sk-REPLACE_ME` with your DeepSeek API key.
|
|
36
|
-
|
|
37
|
-
The install also creates:
|
|
38
|
-
|
|
39
|
-
```text
|
|
40
37
|
~/.codex/deepseek-gateway/config/model-aliases.json
|
|
41
38
|
```
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
By default, the gateway serves the local alias list directly. If you also want to merge DeepSeek's upstream `/models` list, set `"fetchUpstreamModels": true` in `gateway.local.json`. Leaving it `false` keeps `/v1/models` lighter and more predictable.
|
|
46
|
-
|
|
47
|
-
### Tavily Web Search
|
|
48
|
-
|
|
49
|
-
Tavily search is off by default. To let Codex's native `web_search` tool work while the active model is DeepSeek, set these fields in `gateway.local.json`:
|
|
40
|
+
Put your DeepSeek API key in `gateway.local.json`:
|
|
50
41
|
|
|
51
42
|
```json
|
|
52
|
-
"
|
|
53
|
-
"tavilyWebSearchEnabled": true
|
|
43
|
+
"upstreamApiKey": "sk-..."
|
|
54
44
|
```
|
|
55
45
|
|
|
56
|
-
|
|
46
|
+
`model-aliases.json` controls the gateway-facing model IDs exposed on `GET /v1/models` and used by the `sessions` picker. Edit it only if you want to add or rename model aliases.
|
|
57
47
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- Codex sees `web_search_call` items and final assistant messages in the Responses format.
|
|
61
|
-
- DeepSeek sees a normal Chat Completions function tool named `tavily_search`.
|
|
62
|
-
- If Codex replays prior `web_search_call` items as conversation state, the gateway keeps them as Responses search records instead of sending broken, unpaired Chat tool calls upstream.
|
|
63
|
-
|
|
64
|
-
Codex receives:
|
|
65
|
-
|
|
66
|
-
- `web_search_call` output items
|
|
67
|
-
- final assistant `message` items
|
|
68
|
-
- streaming `response.output_text.annotation.added` events for URL citations when the final text contains a matching source marker
|
|
69
|
-
- final `url_citation` annotations on matching cited source markers
|
|
70
|
-
- `web_search_call.action.sources` only when the request includes `include: ["web_search_call.action.sources"]`
|
|
71
|
-
|
|
72
|
-
DeepSeek receives a compact text summary it can read directly:
|
|
73
|
-
|
|
74
|
-
- the search query
|
|
75
|
-
- an optional Tavily answer summary
|
|
76
|
-
- numbered sources
|
|
77
|
-
- each source's title, URL, optional date, relevance score, and snippet
|
|
78
|
-
|
|
79
|
-
The gateway does not pass Tavily's raw response object, raw page content, images, or extra Tavily-only fields to DeepSeek. Tavily is called with `include_raw_content: false`. The model is also told not to write Markdown links or raw URLs in the final answer; URL data is carried through Responses citation annotations when the client supports rendering them.
|
|
80
|
-
|
|
81
|
-
If the key is already configured, `install` also starts the gateway. If this is your first install, run `start` after adding the key:
|
|
48
|
+
If the key is already configured, `install` also starts the gateway. If this is your first install, add the key and then run:
|
|
82
49
|
|
|
83
50
|
```sh
|
|
84
51
|
npx @galaxy-yearn/codex-deepseek-gateway start
|
|
85
52
|
```
|
|
86
53
|
|
|
87
|
-
Check that it is running:
|
|
88
|
-
|
|
89
|
-
```sh
|
|
90
|
-
npx @galaxy-yearn/codex-deepseek-gateway status
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
You should see `"reachable": true`.
|
|
94
|
-
|
|
95
54
|
## Configure Codex
|
|
96
55
|
|
|
97
|
-
Edit `~/.codex/config.toml
|
|
56
|
+
Edit `~/.codex/config.toml`:
|
|
98
57
|
|
|
99
58
|
```toml
|
|
100
59
|
model_provider = "deepseek-gateway"
|
|
@@ -104,35 +63,28 @@ model_supports_reasoning_summaries = true
|
|
|
104
63
|
model_reasoning_summary = "auto"
|
|
105
64
|
|
|
106
65
|
[model_providers.deepseek-gateway]
|
|
107
|
-
name = "
|
|
66
|
+
name = "DeepSeek"
|
|
108
67
|
base_url = "http://127.0.0.1:3000/v1"
|
|
109
68
|
wire_api = "responses"
|
|
110
69
|
```
|
|
111
70
|
|
|
112
71
|
Use `deepseek-v4-pro` instead of `deepseek-v4-flash` if you want the pro model.
|
|
113
72
|
|
|
114
|
-
`config.toml
|
|
115
|
-
|
|
116
|
-
- the active provider via `model_provider`
|
|
117
|
-
- the active model ID via `model`
|
|
118
|
-
- the provider label via `[model_providers.<id>].name`
|
|
119
|
-
|
|
120
|
-
It does not define a separate display name for each model entry inside Codex `/model`. If your Codex build reads custom provider models from `/v1/models`, the visible model names come from the gateway's model IDs in `~/.codex/deepseek-gateway/config/model-aliases.json`.
|
|
121
|
-
|
|
122
|
-
These reasoning settings do different jobs:
|
|
123
|
-
|
|
124
|
-
- `model_supports_reasoning_summaries = true`
|
|
125
|
-
- `model_reasoning_summary = "auto"`
|
|
73
|
+
Restart Codex after changing `config.toml`.
|
|
126
74
|
|
|
127
|
-
|
|
75
|
+
## Start And Verify
|
|
128
76
|
|
|
129
|
-
|
|
77
|
+
Start, stop, and inspect the local background process:
|
|
130
78
|
|
|
131
|
-
|
|
79
|
+
```sh
|
|
80
|
+
npx @galaxy-yearn/codex-deepseek-gateway start
|
|
81
|
+
npx @galaxy-yearn/codex-deepseek-gateway stop
|
|
82
|
+
npx @galaxy-yearn/codex-deepseek-gateway status
|
|
83
|
+
```
|
|
132
84
|
|
|
133
|
-
|
|
85
|
+
`status` should show `"reachable": true`.
|
|
134
86
|
|
|
135
|
-
Run:
|
|
87
|
+
Run `doctor` to check the active Codex config and the DeepSeek request shape the gateway will send:
|
|
136
88
|
|
|
137
89
|
```sh
|
|
138
90
|
npx @galaxy-yearn/codex-deepseek-gateway doctor
|
|
@@ -141,29 +93,43 @@ npx @galaxy-yearn/codex-deepseek-gateway doctor
|
|
|
141
93
|
Important fields:
|
|
142
94
|
|
|
143
95
|
- `codexConfigUsingGateway` should be `true`
|
|
144
|
-
- `codexModel` should be your
|
|
96
|
+
- `codexModel` should be your gateway model, for example `deepseek-v4-pro`
|
|
145
97
|
- `codexReasoningEffort` should match `model_reasoning_effort`
|
|
146
98
|
- `deepseekThinking` shows the DeepSeek `thinking` payload
|
|
147
99
|
- `deepseekReasoningEffort` shows the DeepSeek effort sent upstream
|
|
148
|
-
- `reasoningDisplayMode` shows whether the gateway will emit `summary`, `disabled`, or `hidden`
|
|
149
100
|
- `gatewayEmitsReasoningSummary` should be `true` when DeepSeek thinking is enabled
|
|
150
|
-
- `
|
|
151
|
-
- `tavilyWebSearchReady` should be `true` if you want Codex `web_search` to route through Tavily
|
|
101
|
+
- `tavilyWebSearchReady` and `firecrawlWebFetchReady` show whether optional web search backends are usable
|
|
152
102
|
|
|
153
|
-
|
|
103
|
+
Avoid running Codex through a proxy while using the local gateway. Some proxy clients intercept `http://127.0.0.1:3000` and can break local gateway requests.
|
|
154
104
|
|
|
155
|
-
|
|
156
|
-
|
|
105
|
+
## Models
|
|
106
|
+
|
|
107
|
+
The installed `config/model-aliases.json` starts with:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"deepseek-v4-flash": {
|
|
112
|
+
"model": "deepseek-v4-flash",
|
|
113
|
+
"thinking": "auto"
|
|
114
|
+
},
|
|
115
|
+
"deepseek-v4-pro": {
|
|
116
|
+
"model": "deepseek-v4-pro",
|
|
117
|
+
"thinking": "auto"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
157
120
|
```
|
|
158
121
|
|
|
159
|
-
`
|
|
122
|
+
The gateway serves these aliases directly on `GET /v1/models`. If you also want to merge DeepSeek's upstream `/models` list, set this in `gateway.local.json`:
|
|
160
123
|
|
|
161
124
|
```json
|
|
162
|
-
"
|
|
163
|
-
"deepseekReasoningEffort": "max"
|
|
125
|
+
"fetchUpstreamModels": true
|
|
164
126
|
```
|
|
165
127
|
|
|
166
|
-
|
|
128
|
+
Whether Codex TUI `/model` shows custom provider models depends on the Codex client build. `config.toml` and the `sessions` command remain the reliable ways to choose a model.
|
|
129
|
+
|
|
130
|
+
## Reasoning
|
|
131
|
+
|
|
132
|
+
Codex reasoning effort maps to DeepSeek V4 thinking mode:
|
|
167
133
|
|
|
168
134
|
| Codex `model_reasoning_effort` | DeepSeek request |
|
|
169
135
|
| --- | --- |
|
|
@@ -172,11 +138,73 @@ model_reasoning_effort = "xhigh"
|
|
|
172
138
|
| `high` | `thinking.type = enabled`, `reasoning_effort = high` |
|
|
173
139
|
| `xhigh` | `thinking.type = enabled`, `reasoning_effort = max` |
|
|
174
140
|
|
|
175
|
-
|
|
141
|
+
`model_supports_reasoning_summaries = true` and `model_reasoning_summary = "auto"` tell Codex to use its normal thinking UI path. When DeepSeek returns `reasoning_content`, the gateway keeps the raw text as `reasoning_text` and mirrors it into `summary_text` with a `Reasoning` heading for Codex TUI compatibility.
|
|
142
|
+
|
|
143
|
+
When thinking is enabled, the gateway intentionally buffers visible assistant text and tool-call output until the upstream response completes, then emits reasoning first. This improves thinking order in Codex at the cost of higher first-token latency.
|
|
176
144
|
|
|
177
|
-
|
|
145
|
+
## Web Search
|
|
178
146
|
|
|
179
|
-
|
|
147
|
+
Web search is off by default. To let Codex's native `web_search` or `web_search_preview` tool work while DeepSeek is active, configure the optional backends in `gateway.local.json`.
|
|
148
|
+
|
|
149
|
+
Tavily provides search results:
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
"tavilyApiKey": "tvly-...",
|
|
153
|
+
"tavilyWebSearchEnabled": true
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Firecrawl provides opened-page reading and focused page lookup:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
"firecrawlApiKey": "fc-...",
|
|
160
|
+
"firecrawlWebFetchEnabled": true,
|
|
161
|
+
"firecrawlAutoScrapeTopResults": 3
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Codex does not need MCP, a different tool name, or prompt changes. The gateway converts Codex web search requests into internal Chat Completions tools:
|
|
165
|
+
|
|
166
|
+
- `tavily_search` searches the web and returns citation-ready snippets.
|
|
167
|
+
- `firecrawl_open_page` reads a specific public page.
|
|
168
|
+
- `firecrawl_find_in_page` reads a page with a focused query.
|
|
169
|
+
|
|
170
|
+
DeepSeek receives compact text context containing the search query, sources, snippets, and optional opened-page excerpts. Codex receives Responses-compatible `web_search_call` items, final assistant messages, and URL citation annotations when the final text cites a matching source marker.
|
|
171
|
+
|
|
172
|
+
The web payload is intentionally text-focused. Tavily is called with `include_raw_content: false`; Firecrawl defaults to main content, removes base64 images, rejects local/private URLs, and truncates page text before it reaches the model.
|
|
173
|
+
|
|
174
|
+
## Sessions
|
|
175
|
+
|
|
176
|
+
Open a cross-provider session picker from a project:
|
|
177
|
+
|
|
178
|
+
```sh
|
|
179
|
+
npx @galaxy-yearn/codex-deepseek-gateway sessions
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The picker is read-only. It scans Codex local transcript files, lists sessions for the current project across providers, then runs:
|
|
183
|
+
|
|
184
|
+
```sh
|
|
185
|
+
codex resume <session-id> -c model_provider=deepseek-gateway -c model=<model> -c model_reasoning_effort=<effort>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Flow:
|
|
189
|
+
|
|
190
|
+
- choose a model from `~/.codex/deepseek-gateway/config/model-aliases.json`
|
|
191
|
+
- choose Codex reasoning effort
|
|
192
|
+
- choose the session to resume
|
|
193
|
+
- use `Up/Down` to select, `Enter` to confirm, `Left` to go back, and `Esc` to quit
|
|
194
|
+
|
|
195
|
+
Print copyable resume commands instead of opening the picker:
|
|
196
|
+
|
|
197
|
+
```sh
|
|
198
|
+
npx @galaxy-yearn/codex-deepseek-gateway sessions --print
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Include sessions outside the current project:
|
|
202
|
+
|
|
203
|
+
```sh
|
|
204
|
+
npx @galaxy-yearn/codex-deepseek-gateway sessions --all
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The command does not edit session files, change provider ownership, or change Codex's native resume picker filters. It only helps you find the hidden session id and resume it with explicit config overrides.
|
|
180
208
|
|
|
181
209
|
## Commands
|
|
182
210
|
|
|
@@ -186,6 +214,7 @@ npx @galaxy-yearn/codex-deepseek-gateway start
|
|
|
186
214
|
npx @galaxy-yearn/codex-deepseek-gateway stop
|
|
187
215
|
npx @galaxy-yearn/codex-deepseek-gateway status
|
|
188
216
|
npx @galaxy-yearn/codex-deepseek-gateway doctor
|
|
217
|
+
npx @galaxy-yearn/codex-deepseek-gateway sessions
|
|
189
218
|
npx @galaxy-yearn/codex-deepseek-gateway uninstall
|
|
190
219
|
```
|
|
191
220
|
|
|
@@ -200,47 +229,23 @@ If `start` returns without visible output on your terminal, run `status`; `"reac
|
|
|
200
229
|
- text input and output
|
|
201
230
|
- image, file, and audio content parts when DeepSeek accepts the corresponding Chat Completions shape
|
|
202
231
|
- function tools and tool-call history
|
|
203
|
-
- conservative schema-based repair for streamed and non-streamed tool arguments where DeepSeek returns stringified JSON values for fields that Codex declared as arrays, objects, booleans, or numbers
|
|
204
|
-
- Codex `web_search` emulation through Tavily when `tavilyWebSearchEnabled` is true and `tavilyApiKey` is configured, with Responses-style `web_search_call` output and compact source snippets for DeepSeek
|
|
205
|
-
- Responses-style URL citation metadata for Tavily-backed answers when the final text contains matching source markers
|
|
206
232
|
- DeepSeek thinking mode and `reasoning_content`
|
|
207
233
|
- lightweight local `previous_response_id` / `conversation` history while the gateway process is running
|
|
208
|
-
- `GET /v1/models` with local
|
|
234
|
+
- `GET /v1/models` with local model aliases and optional upstream discovery
|
|
235
|
+
- optional Tavily/Firecrawl-backed `web_search` emulation
|
|
236
|
+
- read-only cross-provider session picker
|
|
209
237
|
|
|
210
238
|
## Limits
|
|
211
239
|
|
|
212
240
|
Chat Completions is not a full Responses API replacement. Some Responses features have no equivalent upstream field.
|
|
213
241
|
|
|
214
|
-
- Hosted tools such as file search, computer use, image generation, and code interpreter are represented as function-tool shims unless Codex executes matching tools locally. Web search is the only hosted tool the gateway can emulate directly
|
|
215
|
-
- Tavily
|
|
242
|
+
- Hosted tools such as file search, computer use, image generation, and code interpreter are represented as function-tool shims unless Codex executes matching tools locally. Web search is the only hosted tool the gateway can emulate directly.
|
|
243
|
+
- Tavily and Firecrawl web emulation is text-focused. It does not expose raw HTML, screenshots, browser actions, crawl/map jobs, cookies, private network access, or provider-specific payloads through Codex `web_search`.
|
|
216
244
|
- URL citations are returned in the Responses metadata path. Whether they appear as clickable links in the terminal depends on the Codex client build and how it renders custom-provider citation annotations.
|
|
217
245
|
- OpenAI `file_id` values are passed through; the gateway cannot fetch private OpenAI-hosted files.
|
|
218
246
|
- In-memory conversation history is lost when the gateway restarts.
|
|
219
247
|
- The gateway exposes model aliases on `/v1/models`, including aliases from `config/model-aliases.json`. Whether Codex TUI `/model` actually shows custom provider models depends on the Codex build. `config.toml` remains the reliable fallback.
|
|
220
248
|
|
|
221
|
-
##
|
|
249
|
+
## License
|
|
222
250
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
```sh
|
|
226
|
-
npm test
|
|
227
|
-
npm pack
|
|
228
|
-
npx --yes --package ./<generated-tarball>.tgz codex-deepseek-gateway install --no-edit
|
|
229
|
-
npx --yes --package ./<generated-tarball>.tgz codex-deepseek-gateway status
|
|
230
|
-
npx --yes --package ./<generated-tarball>.tgz codex-deepseek-gateway doctor
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
Replace `<generated-tarball>.tgz` with the filename printed by `npm pack`.
|
|
234
|
-
|
|
235
|
-
For published usage, use the shorter package command shown in the install section.
|
|
236
|
-
|
|
237
|
-
## Publish
|
|
238
|
-
|
|
239
|
-
When ready:
|
|
240
|
-
|
|
241
|
-
```sh
|
|
242
|
-
npm login
|
|
243
|
-
npm test
|
|
244
|
-
npm pack --dry-run
|
|
245
|
-
npm publish
|
|
246
|
-
```
|
|
251
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -13,6 +13,7 @@ import { createRequire } from 'node:module';
|
|
|
13
13
|
import { dirname, join, resolve } from 'node:path';
|
|
14
14
|
import { fileURLToPath } from 'node:url';
|
|
15
15
|
import { loadConfig } from '../src/config.js';
|
|
16
|
+
import { sessions } from '../src/codex-sessions.js';
|
|
16
17
|
import { toProviderChatCompletionsRequest } from '../src/protocol.js';
|
|
17
18
|
|
|
18
19
|
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
@@ -32,16 +33,25 @@ Usage:
|
|
|
32
33
|
codex-deepseek-gateway stop
|
|
33
34
|
codex-deepseek-gateway status
|
|
34
35
|
codex-deepseek-gateway doctor
|
|
36
|
+
codex-deepseek-gateway sessions
|
|
35
37
|
codex-deepseek-gateway uninstall
|
|
36
38
|
|
|
37
39
|
Options:
|
|
38
40
|
--dir <path> Install directory, defaults to ~/.codex/deepseek-gateway
|
|
39
41
|
--no-edit Do not open the local config file after install
|
|
42
|
+
--all With sessions, include sessions outside the current project
|
|
43
|
+
--provider <id> With sessions, target model_provider override
|
|
44
|
+
--model <id> With sessions, target model override
|
|
45
|
+
--reasoning-effort <level>
|
|
46
|
+
With sessions, target Codex reasoning effort
|
|
47
|
+
--exec <id> With sessions, run the generated codex resume command
|
|
48
|
+
--limit <n> With sessions, max rows to print, defaults to 20
|
|
49
|
+
--print With sessions, print copyable resume commands instead of picker
|
|
40
50
|
`);
|
|
41
51
|
}
|
|
42
52
|
|
|
43
53
|
function parseArgs(argv) {
|
|
44
|
-
const options = { dir: defaultInstallDir(), noEdit: false };
|
|
54
|
+
const options = { dir: defaultInstallDir(), noEdit: false, all: false };
|
|
45
55
|
const rest = [];
|
|
46
56
|
for (let index = 0; index < argv.length; index += 1) {
|
|
47
57
|
const arg = argv[index];
|
|
@@ -52,6 +62,35 @@ function parseArgs(argv) {
|
|
|
52
62
|
index += 1;
|
|
53
63
|
} else if (arg === '--no-edit' || arg === '-NoEdit') {
|
|
54
64
|
options.noEdit = true;
|
|
65
|
+
} else if (arg === '--all') {
|
|
66
|
+
options.all = true;
|
|
67
|
+
} else if (arg === '--provider') {
|
|
68
|
+
const value = argv[index + 1];
|
|
69
|
+
if (!value) throw new Error(`${arg} requires a provider id`);
|
|
70
|
+
options.provider = value;
|
|
71
|
+
index += 1;
|
|
72
|
+
} else if (arg === '--model' || arg === '-m') {
|
|
73
|
+
const value = argv[index + 1];
|
|
74
|
+
if (!value) throw new Error(`${arg} requires a model id`);
|
|
75
|
+
options.model = value;
|
|
76
|
+
index += 1;
|
|
77
|
+
} else if (arg === '--reasoning-effort') {
|
|
78
|
+
const value = argv[index + 1];
|
|
79
|
+
if (!value) throw new Error(`${arg} requires a reasoning effort`);
|
|
80
|
+
options.reasoningEffort = value;
|
|
81
|
+
index += 1;
|
|
82
|
+
} else if (arg === '--exec') {
|
|
83
|
+
const value = argv[index + 1];
|
|
84
|
+
if (!value) throw new Error(`${arg} requires a session id`);
|
|
85
|
+
options.exec = value;
|
|
86
|
+
index += 1;
|
|
87
|
+
} else if (arg === '--limit') {
|
|
88
|
+
const value = Number(argv[index + 1]);
|
|
89
|
+
if (!Number.isInteger(value) || value < 1) throw new Error(`${arg} requires a positive integer`);
|
|
90
|
+
options.limit = value;
|
|
91
|
+
index += 1;
|
|
92
|
+
} else if (arg === '--print') {
|
|
93
|
+
options.print = true;
|
|
55
94
|
} else {
|
|
56
95
|
rest.push(arg);
|
|
57
96
|
}
|
|
@@ -345,9 +384,10 @@ async function doctor(options) {
|
|
|
345
384
|
codexSummaryConfigured,
|
|
346
385
|
tavilyWebSearchEnabled: Boolean(config.tavilyWebSearchEnabled),
|
|
347
386
|
tavilyWebSearchReady: Boolean(config.tavilyWebSearchEnabled && config.tavilyApiKey),
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
387
|
+
firecrawlWebFetchEnabled: Boolean(config.firecrawlWebFetchEnabled),
|
|
388
|
+
firecrawlWebFetchReady: Boolean(config.firecrawlWebFetchEnabled && config.firecrawlApiKey),
|
|
389
|
+
firecrawlAutoScrapeTopResults: config.firecrawlAutoScrapeTopResults,
|
|
390
|
+
hint: 'The gateway exposes model aliases on /v1/models. Whether Codex TUI /model shows them depends on the Codex build.',
|
|
351
391
|
}, null, 2));
|
|
352
392
|
print('\n');
|
|
353
393
|
}
|
|
@@ -364,7 +404,7 @@ async function main() {
|
|
|
364
404
|
usage();
|
|
365
405
|
return;
|
|
366
406
|
}
|
|
367
|
-
const commands = { install, start, stop, status, doctor, uninstall };
|
|
407
|
+
const commands = { install, start, stop, status, doctor, sessions, uninstall };
|
|
368
408
|
const handler = commands[command];
|
|
369
409
|
if (!handler) {
|
|
370
410
|
throw new Error(`Unknown command: ${command}`);
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
"tavilyMaxResults": 5,
|
|
12
12
|
"tavilyMaxSearchRounds": 2,
|
|
13
13
|
"tavilyTimeoutMs": 15000,
|
|
14
|
+
"firecrawlApiKey": "",
|
|
15
|
+
"firecrawlWebFetchEnabled": false,
|
|
16
|
+
"firecrawlAutoScrapeTopResults": 3,
|
|
17
|
+
"firecrawlPageMaxChars": 5000,
|
|
18
|
+
"firecrawlTimeoutMs": 30000,
|
|
14
19
|
"fetchUpstreamModels": false,
|
|
15
20
|
"modelsTimeoutMs": 5000,
|
|
16
21
|
"modelsCacheMs": 60000,
|
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galaxy-yearn/codex-deepseek-gateway",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Local Codex Responses API
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Local OpenAI Codex Responses API gateway for DeepSeek Chat Completions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/server.js",
|
|
7
7
|
"bin": {
|
|
8
8
|
"codex-deepseek-gateway": "bin/codex-deepseek-gateway.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"bin",
|
|
12
|
-
"config",
|
|
11
|
+
"bin/codex-deepseek-gateway.js",
|
|
12
|
+
"config/gateway.example.json",
|
|
13
|
+
"config/model-aliases.example.json",
|
|
13
14
|
"src",
|
|
14
|
-
"README.md"
|
|
15
|
+
"README.md",
|
|
16
|
+
"LICENSE"
|
|
15
17
|
],
|
|
16
18
|
"scripts": {
|
|
17
19
|
"test": "node --test"
|
|
@@ -25,9 +27,28 @@
|
|
|
25
27
|
"openai",
|
|
26
28
|
"responses-api",
|
|
27
29
|
"chat-completions",
|
|
28
|
-
"gateway"
|
|
30
|
+
"gateway",
|
|
31
|
+
"proxy",
|
|
32
|
+
"codex-cli",
|
|
33
|
+
"openai-responses",
|
|
34
|
+
"deepseek-v4",
|
|
35
|
+
"deepseek-v4-flash",
|
|
36
|
+
"deepseek-v4-pro",
|
|
37
|
+
"function-calling",
|
|
38
|
+
"tool-calls",
|
|
39
|
+
"web-search",
|
|
40
|
+
"tavily",
|
|
41
|
+
"firecrawl"
|
|
29
42
|
],
|
|
30
43
|
"license": "MIT",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "git+https://github.com/Galaxy-Yearn/codex-deepseek-gateway.git"
|
|
47
|
+
},
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/Galaxy-Yearn/codex-deepseek-gateway/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/Galaxy-Yearn/codex-deepseek-gateway#readme",
|
|
31
52
|
"publishConfig": {
|
|
32
53
|
"access": "public"
|
|
33
54
|
}
|