@theclawlab/pai 1.0.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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2540 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sw chen
|
|
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
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# pai
|
|
2
|
+
|
|
3
|
+
Unix-style CLI for interacting with LLMs. One built-in tool (`bash_exec`), basic session support, and text embedding.
|
|
4
|
+
|
|
5
|
+
Note:
|
|
6
|
+
pai is a thin wrapper around @mariozechner/pi-ai (https://github.com/badlogic/pi-mono/tree/main/packages/ai).
|
|
7
|
+
Thanks to Mario Zechner for providing this amazing work.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 20+ providers (OpenAI, Anthropic, Google, GitHub Copilot, Azure, Bedrock, etc.)
|
|
12
|
+
- API Key, OAuth, and cloud credential authentication
|
|
13
|
+
- Streaming and non-streaming output
|
|
14
|
+
- Session files (JSONL) for multi-turn conversations
|
|
15
|
+
- `bash_exec` tool — LLM can run shell commands
|
|
16
|
+
- `embed` command — generate text embeddings
|
|
17
|
+
- Human-readable (default) and machine-parseable (`--json`) output
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install
|
|
23
|
+
npm run build
|
|
24
|
+
npm link
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Configure a provider
|
|
31
|
+
pai model config --add --name openai --provider openai --set apiKey=sk-...
|
|
32
|
+
|
|
33
|
+
# Set as default
|
|
34
|
+
pai model default --name openai
|
|
35
|
+
|
|
36
|
+
# Chat
|
|
37
|
+
pai chat "Hello"
|
|
38
|
+
|
|
39
|
+
# Generate embeddings
|
|
40
|
+
pai model default --embed-provider openai --embed-model text-embedding-3-small
|
|
41
|
+
pai embed "hello world" --json
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Commands
|
|
45
|
+
|
|
46
|
+
| Command | Description |
|
|
47
|
+
|---------|-------------|
|
|
48
|
+
| `pai chat [prompt]` | Chat with an LLM (supports tool calling, streaming, sessions) |
|
|
49
|
+
| `pai embed [text]` | Generate text embeddings (single or batch) |
|
|
50
|
+
| `pai model list` | List configured/available providers |
|
|
51
|
+
| `pai model config` | Add, update, delete, or show provider configuration |
|
|
52
|
+
| `pai model default` | View or set default provider and embedding model |
|
|
53
|
+
| `pai model login` | Interactive OAuth login for supported providers |
|
|
54
|
+
|
|
55
|
+
## Documentation
|
|
56
|
+
|
|
57
|
+
- **[USAGE.md](USAGE.md)** — Full usage guide with all providers, options, and examples
|
|
58
|
+
|
package/dist/index.d.ts
ADDED