@leoustc/service-llm 0.2.3 → 0.2.5
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 +8 -0
- package/VERSION +1 -1
- package/dist/cli.js +5 -1
- package/dist/http.js +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,14 @@ Use your ChatGPT Codex subscription through OpenAI-compatible HTTP APIs or MCP.
|
|
|
15
15
|
npm install --global @leoustc/service-llm
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
Show the installed CLI version:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
service-llm -v
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Use `service-llm --help` to show all available commands and server options.
|
|
25
|
+
|
|
18
26
|
## Log in
|
|
19
27
|
|
|
20
28
|
```sh
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.5
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { listModels, login, setDefaultModel } from "./auth.js";
|
|
3
3
|
import { startServer } from "./http.js";
|
|
4
|
+
import { version } from "./version.js";
|
|
4
5
|
|
|
5
6
|
function usage() {
|
|
6
7
|
console.error(`Usage:
|
|
8
|
+
service-llm -v | --version
|
|
7
9
|
service-llm login [--device-code]
|
|
8
10
|
service-llm model [list]
|
|
9
11
|
service-llm model set <model-id>
|
|
@@ -39,7 +41,9 @@ function valueAfter(args, names, fallback) {
|
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
const args = process.argv.slice(2);
|
|
42
|
-
if (args.
|
|
44
|
+
if (args.length === 1 && ["-v", "--version"].includes(args[0])) {
|
|
45
|
+
console.log(`service-llm v${version}`);
|
|
46
|
+
} else if (args.includes("--help") || args.includes("-h")) {
|
|
43
47
|
usage();
|
|
44
48
|
} else if (args[0] === "login") {
|
|
45
49
|
await login({ deviceCode: args.includes("--device-code") });
|
package/dist/http.js
CHANGED
|
@@ -5,7 +5,6 @@ import { version } from "./version.js";
|
|
|
5
5
|
import {
|
|
6
6
|
contentFromMessage,
|
|
7
7
|
createCompletionStream,
|
|
8
|
-
defaultModel,
|
|
9
8
|
messagesFromChat,
|
|
10
9
|
messagesFromResponses,
|
|
11
10
|
toolCallsFromMessage,
|
|
@@ -168,8 +167,8 @@ async function responses(request, response, body) {
|
|
|
168
167
|
sendJson(response, 200, responseObject(id, model, await collect(streamResult)));
|
|
169
168
|
}
|
|
170
169
|
|
|
171
|
-
async function ask({ prompt, model
|
|
172
|
-
const completion = await
|
|
170
|
+
export async function ask({ prompt, model, tools, toolChoice }, createCompletion = createCompletionStream) {
|
|
171
|
+
const completion = await createCompletion({
|
|
173
172
|
context: messagesFromResponses(prompt),
|
|
174
173
|
model,
|
|
175
174
|
tools,
|
package/package.json
CHANGED