@thomas-huang/caosi 0.1.4 → 0.2.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
CHANGED
|
@@ -2,9 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
[中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Keep using Claude Code, Codex, or Gemini CLI. Point them at your own upstream — no client switch.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Set the Base URL to `http://127.0.0.1:9999/{provider_name}`. Same protocol is passed through; caosi converts when they differ.
|
|
8
|
+
|
|
9
|
+
- A single static binary
|
|
10
|
+
- npm ships the binaries: no install script, nothing fetched from GitHub
|
|
11
|
+
- macOS, Linux, and Windows
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @thomas-huang/caosi
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
No Web UI, no OAuth, no key pool, no client-config rewrite. One process, one file, loopback only.
|
|
8
18
|
|
|
9
19
|
## Install
|
|
10
20
|
|
|
@@ -23,7 +33,7 @@ The first start writes a sample Provider File and exits. That is intentional: ca
|
|
|
23
33
|
caosi
|
|
24
34
|
```
|
|
25
35
|
|
|
26
|
-
Edit `~/.caosi/providers.jsonc`. Set `api_key` and `base_url`. If Claude Code will talk to an OpenAI-compatible upstream, keep `model` (for example `
|
|
36
|
+
Edit `~/.caosi/providers.jsonc`. Set `api_key` and `base_url`. If Claude Code will talk to an OpenAI-compatible upstream, keep `model` (for example `qwen/qwen3-coder`) so the upstream does not see `claude-*`.
|
|
27
37
|
|
|
28
38
|
Start again:
|
|
29
39
|
|
|
@@ -35,26 +45,26 @@ curl -s http://127.0.0.1:9999/health
|
|
|
35
45
|
## Point Claude Code at it
|
|
36
46
|
|
|
37
47
|
```bash
|
|
38
|
-
export ANTHROPIC_BASE_URL=http://127.0.0.1:9999/
|
|
48
|
+
export ANTHROPIC_BASE_URL=http://127.0.0.1:9999/openrouter
|
|
39
49
|
export ANTHROPIC_API_KEY=dummy
|
|
40
50
|
claude
|
|
41
51
|
```
|
|
42
52
|
|
|
43
|
-
Replace `
|
|
53
|
+
Replace `openrouter` with your Provider Name. caosi ignores the client key and uses the Provider's `api_key`. Claude Code sends `/v1/messages`; caosi converts when the upstream is not Claude.
|
|
44
54
|
|
|
45
55
|
## Codex / OpenAI and Gemini CLI
|
|
46
56
|
|
|
47
57
|
OpenAI SDK, Chat Completions, and Codex:
|
|
48
58
|
|
|
49
59
|
```bash
|
|
50
|
-
export OPENAI_BASE_URL=http://127.0.0.1:9999/
|
|
60
|
+
export OPENAI_BASE_URL=http://127.0.0.1:9999/openrouter/v1
|
|
51
61
|
export OPENAI_API_KEY=dummy
|
|
52
62
|
```
|
|
53
63
|
|
|
54
64
|
Gemini CLI (`~/.gemini/.env` or the environment):
|
|
55
65
|
|
|
56
66
|
```bash
|
|
57
|
-
export GEMINI_API_BASE=http://127.0.0.1:9999/
|
|
67
|
+
export GEMINI_API_BASE=http://127.0.0.1:9999/openrouter
|
|
58
68
|
```
|
|
59
69
|
|
|
60
70
|
## Provider File
|
|
@@ -63,11 +73,11 @@ export GEMINI_API_BASE=http://127.0.0.1:9999/deepseek
|
|
|
63
73
|
|
|
64
74
|
```jsonc
|
|
65
75
|
{
|
|
66
|
-
"
|
|
67
|
-
"base_url": "https://api
|
|
76
|
+
"openrouter": {
|
|
77
|
+
"base_url": "https://openrouter.ai/api",
|
|
68
78
|
"protocol": "openai_chat",
|
|
69
79
|
"api_key": "sk-...",
|
|
70
|
-
"model": "
|
|
80
|
+
"model": "qwen/qwen3-coder"
|
|
71
81
|
}
|
|
72
82
|
}
|
|
73
83
|
```
|
|
@@ -81,7 +91,7 @@ export GEMINI_API_BASE=http://127.0.0.1:9999/deepseek
|
|
|
81
91
|
|
|
82
92
|
- `model` is optional: when set, it replaces the client's model name on the upstream request.
|
|
83
93
|
- `headers` is optional extra request headers (for example OpenRouter).
|
|
84
|
-
- `base_url` is a prefix. caosi does not strip `/v1`. Use the root the upstream actually expects (`https://api
|
|
94
|
+
- `base_url` is a prefix. caosi does not strip `/v1`. Use the root the upstream actually expects (`https://openrouter.ai/api`, not `https://openrouter.ai/api/v1`).
|
|
85
95
|
|
|
86
96
|
## Listen, health, reload
|
|
87
97
|
|
|
@@ -92,6 +102,8 @@ export GEMINI_API_BASE=http://127.0.0.1:9999/deepseek
|
|
|
92
102
|
|
|
93
103
|
## What it does not do
|
|
94
104
|
|
|
105
|
+
caosi is a converter, not a gateway.
|
|
106
|
+
|
|
95
107
|
No Web UI, OAuth, failover, key pools, or rewriting your Claude Code / Codex / Gemini config files.
|
|
96
108
|
|
|
97
109
|
## Without Node.js
|
|
@@ -105,7 +117,7 @@ go install github.com/thomas-huang/caosi/cmd/caosi@latest
|
|
|
105
117
|
go test ./...
|
|
106
118
|
```
|
|
107
119
|
|
|
108
|
-
Domain language: [CONTEXT.md](CONTEXT.md). Decisions: [docs/adr](docs/adr).
|
|
120
|
+
Domain language: [CONTEXT.md](CONTEXT.md). Architecture: [docs/architecture.md](docs/architecture.md). Decisions: [docs/adr](docs/adr).
|
|
109
121
|
|
|
110
122
|
To cut a release, push a tag `vX.Y.Z`. GitHub Actions builds the five binaries, writes checksums, creates the Release, and publishes `@thomas-huang/caosi` to npm with GitHub OIDC trusted publishing (no access token).
|
|
111
123
|
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
package/vendor/caosi-linux-amd64
CHANGED
|
Binary file
|
package/vendor/caosi-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|