apispoof 3.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/README.md +155 -0
- package/dist/cli.js +2034 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# apispoof
|
|
2
|
+
|
|
3
|
+
Turn any AI CLI into an OpenAI-compatible API — no API keys, no billing.
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install -g apispoof
|
|
7
|
+
apispoof
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## What it does
|
|
13
|
+
|
|
14
|
+
apispoof runs a local HTTP server that speaks the OpenAI API format (`/v1/chat/completions`, `/v1/models`, `/health`). Any app that supports OpenAI-compatible endpoints — Goose, Cursor, Continue, Open WebUI, and others — can point at it and use whichever AI CLI you have authenticated on your machine.
|
|
15
|
+
|
|
16
|
+
You keep using the free tier or the subscription you already pay for. No Anthropic API key, no OpenAI API key, no extra cost.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Supported backends
|
|
21
|
+
|
|
22
|
+
| CLI | Install | Auth |
|
|
23
|
+
|-----|---------|------|
|
|
24
|
+
| **Claude Code** | [claude.ai/download](https://claude.ai/download) | `claude login` |
|
|
25
|
+
| **Gemini CLI** | `npm i -g @google/gemini-cli` | `gemini auth` |
|
|
26
|
+
| **Codex CLI** | `npm i -g @openai/codex` | `codex auth` |
|
|
27
|
+
| **GitHub Copilot** | `gh extension install github/gh-copilot` | `gh auth login` |
|
|
28
|
+
| **Droid (Factory.ai)** | [factory.ai](https://factory.ai) | `export FACTORY_API_KEY=fk-...` |
|
|
29
|
+
|
|
30
|
+
Install any one of these and apispoof will pick it up automatically.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
### Interactive setup (recommended)
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
apispoof
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Detects installed backends, asks for a port, and gives you the choice to run in the foreground or install as a background service that auto-starts on login.
|
|
43
|
+
|
|
44
|
+
### Manual commands
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
apispoof start # run in foreground (default port 8082)
|
|
48
|
+
apispoof start --port 9000 # custom port
|
|
49
|
+
apispoof install # install as background service
|
|
50
|
+
apispoof uninstall # remove background service
|
|
51
|
+
apispoof status # check if running
|
|
52
|
+
apispoof chat # interactive chat session in terminal
|
|
53
|
+
apispoof key # show your OpenAI-compatible API key
|
|
54
|
+
apispoof key reset # regenerate the API key
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Chat mode
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
apispoof chat
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Opens an interactive REPL. Type messages, get streamed responses. Keeps conversation history across turns.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Connecting an app
|
|
68
|
+
|
|
69
|
+
Once running, point any OpenAI-compatible app at:
|
|
70
|
+
|
|
71
|
+
| Setting | Value |
|
|
72
|
+
|---------|-------|
|
|
73
|
+
| **Base URL** | `http://127.0.0.1:8082/v1` |
|
|
74
|
+
| **API Key** | run `apispoof key` to get yours |
|
|
75
|
+
| **Model** | any model your CLI supports |
|
|
76
|
+
|
|
77
|
+
### Goose
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
# ~/.config/goose/config.yaml
|
|
81
|
+
GOOSE_PROVIDER: openai
|
|
82
|
+
GOOSE_MODEL: claude-opus-4-6
|
|
83
|
+
OPENAI_HOST: http://127.0.0.1:8082
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Continue (VS Code / JetBrains)
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"models": [{
|
|
91
|
+
"title": "apispoof",
|
|
92
|
+
"provider": "openai",
|
|
93
|
+
"model": "claude-sonnet-4-6",
|
|
94
|
+
"apiBase": "http://127.0.0.1:8082/v1",
|
|
95
|
+
"apiKey": "sk-spoof-..."
|
|
96
|
+
}]
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Open WebUI
|
|
101
|
+
|
|
102
|
+
Set **OpenAI API Base URL** to `http://127.0.0.1:8082/v1` and **API Key** from `apispoof key`.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## How it works
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
Your app → POST /v1/chat/completions
|
|
110
|
+
↓
|
|
111
|
+
apispoof (local HTTP server)
|
|
112
|
+
↓
|
|
113
|
+
claude / gemini / codex / gh copilot / droid (subprocess)
|
|
114
|
+
↓
|
|
115
|
+
streamed response back to your app
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
apispoof converts OpenAI message format to a plain prompt, spawns the appropriate CLI as a subprocess using your existing auth, and streams the output back as SSE — exactly what the OpenAI streaming format expects.
|
|
119
|
+
|
|
120
|
+
Model routing is automatic by prefix:
|
|
121
|
+
|
|
122
|
+
- `claude-*` → Claude Code CLI
|
|
123
|
+
- `gemini-*` → Gemini CLI
|
|
124
|
+
- `gpt-*`, `o3`, `o4` → Codex CLI
|
|
125
|
+
- `copilot` → GitHub Copilot CLI
|
|
126
|
+
- `droid`, `factory-*`, `glm-*`, `kimi-*`, `minimax-*` → Droid CLI (Factory.ai)
|
|
127
|
+
|
|
128
|
+
If the requested backend isn't available, it falls back to the first one that is.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Background service
|
|
133
|
+
|
|
134
|
+
On macOS, `apispoof install` creates a LaunchAgent that starts automatically on login and restarts if it crashes. Logs go to `~/.apispoof/server.log`.
|
|
135
|
+
|
|
136
|
+
On Linux, it creates a systemd user service (`systemctl --user`).
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
apispoof install # installs and starts
|
|
140
|
+
apispoof status # check pid and port
|
|
141
|
+
apispoof uninstall # stops and removes
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Requirements
|
|
147
|
+
|
|
148
|
+
- Node.js 18+
|
|
149
|
+
- At least one AI CLI installed and authenticated
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
MIT — [teodorwaltervido](https://github.com/teodorwaltervido)
|