github-router 0.3.11 → 0.3.13

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 CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 animeshkundu
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 animeshkundu
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
@@ -1,206 +1,206 @@
1
- # github-router
2
-
3
- [![CI](https://github.com/animeshkundu/github-router/actions/workflows/ci.yml/badge.svg)](https://github.com/animeshkundu/github-router/actions/workflows/ci.yml)
4
- [![npm](https://img.shields.io/npm/v/github-router)](https://www.npmjs.com/package/github-router)
5
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
-
7
- Use your GitHub Copilot subscription to power **Claude Code**, **Codex CLI**, or any OpenAI/Anthropic-compatible tool.
8
-
9
- github-router is a local reverse proxy that translates standard API formats to GitHub Copilot's backend. One command to start, copy-paste configs for your tools.
10
-
11
- > [!WARNING]
12
- > Unofficial. Not supported by GitHub. May break. Use responsibly.
13
- > Review the [GitHub Copilot Terms](https://docs.github.com/site-policy/github-terms/github-terms-for-additional-products-and-features#github-copilot) and [Acceptable Use Policies](https://docs.github.com/site-policy/acceptable-use-policies/github-acceptable-use-policies#4-spam-and-inauthentic-activity-on-github).
14
-
15
- ## Quick Start
16
-
17
- ```sh
18
- # 1. Authenticate (one-time)
19
- npx github-router@latest auth
20
-
21
- # 2. Start the proxy
22
- npx github-router@latest start
23
- ```
24
-
25
- The server runs at `http://localhost:8787`. Now pick your tool below.
26
-
27
- ---
28
-
29
- ## Use with Claude Code
30
-
31
- **Option A: Interactive (recommended)**
32
-
33
- ```sh
34
- npx github-router@latest start --claude-code
35
- ```
36
-
37
- Select your models, a launch command gets copied to your clipboard. Paste it in a new terminal.
38
-
39
- **Option B: Copy-paste config**
40
-
41
- Create `.claude/settings.json` in your project:
42
-
43
- ```json
44
- {
45
- "env": {
46
- "ANTHROPIC_BASE_URL": "http://localhost:8787",
47
- "ANTHROPIC_API_KEY": "dummy",
48
- "ANTHROPIC_AUTH_TOKEN": "dummy",
49
- "ANTHROPIC_MODEL": "gpt-4.1",
50
- "ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-4.1",
51
- "ANTHROPIC_SMALL_FAST_MODEL": "gpt-4.1-mini",
52
- "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-4.1-mini",
53
- "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
54
- "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
55
- },
56
- "permissions": {
57
- "deny": ["WebSearch"]
58
- }
59
- }
60
- ```
61
-
62
- Then run `claude` as normal.
63
-
64
- ---
65
-
66
- ## Use with Codex CLI
67
-
68
- ```sh
69
- npx github-router@latest start --codex
70
- ```
71
-
72
- Or set the env vars yourself:
73
-
74
- ```sh
75
- export OPENAI_BASE_URL="http://localhost:8787/v1"
76
- export OPENAI_API_KEY="dummy"
77
- codex -m gpt5.2-codex
78
- ```
79
-
80
- ---
81
-
82
- ## Use with any OpenAI-compatible tool
83
-
84
- Point any tool at `http://localhost:8787/v1`:
85
-
86
- ```sh
87
- curl http://localhost:8787/v1/chat/completions \
88
- -H "Content-Type: application/json" \
89
- -d '{"model": "gpt-4.1", "messages": [{"role": "user", "content": "Hello"}]}'
90
- ```
91
-
92
- ---
93
-
94
- ## API Endpoints
95
-
96
- | Endpoint | Method | Format |
97
- |---|---|---|
98
- | `/v1/chat/completions` | POST | OpenAI Chat Completions |
99
- | `/v1/responses` | POST | OpenAI Responses (Codex models) |
100
- | `/v1/messages` | POST | Anthropic Messages |
101
- | `/v1/messages/count_tokens` | POST | Anthropic token counting |
102
- | `/v1/models` | GET | OpenAI model list |
103
- | `/v1/embeddings` | POST | OpenAI embeddings |
104
- | `/v1/search` | POST | Web search |
105
- | `/usage` | GET | Copilot usage & quotas |
106
-
107
- OpenAI-compatible endpoints are also available without the `/v1` prefix (for example, `/chat/completions`).
108
- Anthropic endpoints are only available under `/v1/messages`.
109
-
110
- <details>
111
- <summary>Model / endpoint compatibility</summary>
112
-
113
- | Model | /chat/completions | /responses |
114
- |---|---|---|
115
- | gpt-4.1, gpt-4o | Yes | Yes |
116
- | gpt5.2-codex, gpt-5.1-codex-mini | No | Yes |
117
- | claude-sonnet-4, claude-opus-4 | Yes (via /messages) | No |
118
- | o3, o4-mini | Yes | Yes |
119
-
120
- </details>
121
-
122
- ---
123
-
124
- ## Docker
125
-
126
- Pre-built images on GitHub Container Registry:
127
-
128
- ```sh
129
- docker pull ghcr.io/animeshkundu/github-router:latest
130
- docker run -p 8787:8787 -e GH_TOKEN=your_token ghcr.io/animeshkundu/github-router
131
- ```
132
-
133
- Or build locally:
134
-
135
- ```sh
136
- docker build -t github-router .
137
- docker run -p 8787:8787 -e GH_TOKEN=your_token github-router
138
- ```
139
-
140
- <details>
141
- <summary>Docker Compose</summary>
142
-
143
- ```yaml
144
- services:
145
- github-router:
146
- build: .
147
- ports:
148
- - "8787:8787"
149
- environment:
150
- - GH_TOKEN=your_github_token_here
151
- restart: unless-stopped
152
- ```
153
-
154
- </details>
155
-
156
- <details>
157
- <summary>Persistent token storage</summary>
158
-
159
- ```sh
160
- mkdir -p ./github-router-data
161
- docker run -p 8787:8787 -v $(pwd)/github-router-data:/root/.local/share/github-router github-router
162
- ```
163
-
164
- </details>
165
-
166
- ---
167
-
168
- ## CLI Reference
169
-
170
- ```
171
- github-router start [options] Start the proxy server
172
- github-router auth Authenticate with GitHub
173
- github-router check-usage Show Copilot usage/quotas
174
- github-router debug Print diagnostic info
175
- ```
176
-
177
- | Flag | Description | Default |
178
- |---|---|---|
179
- | `--port, -p` | Port | 8787 |
180
- | `--verbose, -v` | Debug logging | false |
181
- | `--account-type, -a` | `individual` / `business` / `enterprise` | individual |
182
- | `--rate-limit, -r` | Min seconds between requests | - |
183
- | `--wait, -w` | Queue requests instead of rejecting on rate limit | false |
184
- | `--manual` | Approve each request manually | false |
185
- | `--github-token, -g` | Pass token directly (skip auth flow) | - |
186
- | `--claude-code, -c` | Generate Claude Code launch command | false |
187
- | `--codex` | Generate Codex CLI launch command | false |
188
- | `--show-token` | Print tokens to console | false |
189
- | `--proxy-env` | Use HTTP_PROXY/HTTPS_PROXY env vars | false |
190
-
191
- ---
192
-
193
- ## Development
194
-
195
- ```sh
196
- bun install # Install deps
197
- bun run dev # Dev server with hot reload
198
- bun test # Run tests
199
- bun run lint:all # Lint
200
- bun run typecheck # Type check
201
- bun run build # Build for distribution
202
- ```
203
-
204
- ## License
205
-
206
- [MIT](LICENSE)
1
+ # github-router
2
+
3
+ [![CI](https://github.com/animeshkundu/github-router/actions/workflows/ci.yml/badge.svg)](https://github.com/animeshkundu/github-router/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/github-router)](https://www.npmjs.com/package/github-router)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+
7
+ Use your GitHub Copilot subscription to power **Claude Code**, **Codex CLI**, or any OpenAI/Anthropic-compatible tool.
8
+
9
+ github-router is a local reverse proxy that translates standard API formats to GitHub Copilot's backend. One command to start, copy-paste configs for your tools.
10
+
11
+ > [!WARNING]
12
+ > Unofficial. Not supported by GitHub. May break. Use responsibly.
13
+ > Review the [GitHub Copilot Terms](https://docs.github.com/site-policy/github-terms/github-terms-for-additional-products-and-features#github-copilot) and [Acceptable Use Policies](https://docs.github.com/site-policy/acceptable-use-policies/github-acceptable-use-policies#4-spam-and-inauthentic-activity-on-github).
14
+
15
+ ## Quick Start
16
+
17
+ ```sh
18
+ # 1. Authenticate (one-time)
19
+ npx github-router@latest auth
20
+
21
+ # 2. Start the proxy
22
+ npx github-router@latest start
23
+ ```
24
+
25
+ The server runs at `http://localhost:8787`. Now pick your tool below.
26
+
27
+ ---
28
+
29
+ ## Use with Claude Code
30
+
31
+ **Option A: Interactive (recommended)**
32
+
33
+ ```sh
34
+ npx github-router@latest start --claude-code
35
+ ```
36
+
37
+ Select your models, a launch command gets copied to your clipboard. Paste it in a new terminal.
38
+
39
+ **Option B: Copy-paste config**
40
+
41
+ Create `.claude/settings.json` in your project:
42
+
43
+ ```json
44
+ {
45
+ "env": {
46
+ "ANTHROPIC_BASE_URL": "http://localhost:8787",
47
+ "ANTHROPIC_API_KEY": "dummy",
48
+ "ANTHROPIC_AUTH_TOKEN": "dummy",
49
+ "ANTHROPIC_MODEL": "gpt-4.1",
50
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-4.1",
51
+ "ANTHROPIC_SMALL_FAST_MODEL": "gpt-4.1-mini",
52
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-4.1-mini",
53
+ "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
54
+ "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
55
+ },
56
+ "permissions": {
57
+ "deny": ["WebSearch"]
58
+ }
59
+ }
60
+ ```
61
+
62
+ Then run `claude` as normal.
63
+
64
+ ---
65
+
66
+ ## Use with Codex CLI
67
+
68
+ ```sh
69
+ npx github-router@latest start --codex
70
+ ```
71
+
72
+ Or set the env vars yourself:
73
+
74
+ ```sh
75
+ export OPENAI_BASE_URL="http://localhost:8787/v1"
76
+ export OPENAI_API_KEY="dummy"
77
+ codex --full-auto -m gpt-5.3-codex
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Use with any OpenAI-compatible tool
83
+
84
+ Point any tool at `http://localhost:8787/v1`:
85
+
86
+ ```sh
87
+ curl http://localhost:8787/v1/chat/completions \
88
+ -H "Content-Type: application/json" \
89
+ -d '{"model": "gpt-4.1", "messages": [{"role": "user", "content": "Hello"}]}'
90
+ ```
91
+
92
+ ---
93
+
94
+ ## API Endpoints
95
+
96
+ | Endpoint | Method | Format |
97
+ |---|---|---|
98
+ | `/v1/chat/completions` | POST | OpenAI Chat Completions |
99
+ | `/v1/responses` | POST | OpenAI Responses (Codex models) |
100
+ | `/v1/messages` | POST | Anthropic Messages |
101
+ | `/v1/messages/count_tokens` | POST | Anthropic token counting |
102
+ | `/v1/models` | GET | OpenAI model list |
103
+ | `/v1/embeddings` | POST | OpenAI embeddings |
104
+ | `/v1/search` | POST | Web search |
105
+ | `/usage` | GET | Copilot usage & quotas |
106
+
107
+ OpenAI-compatible endpoints are also available without the `/v1` prefix (for example, `/chat/completions`).
108
+ Anthropic endpoints are only available under `/v1/messages`.
109
+
110
+ <details>
111
+ <summary>Model / endpoint compatibility</summary>
112
+
113
+ | Model | /chat/completions | /responses | /v1/messages |
114
+ |---|---|---|---|
115
+ | gpt-4.1, gpt-4o | Yes | Yes | No |
116
+ | gpt-5.3-codex, gpt-5.2-codex | No | Yes | No |
117
+ | claude-opus-4.6, claude-sonnet-4.6 | Yes | No | Yes |
118
+ | o3, o4-mini | Yes | Yes | No |
119
+
120
+ </details>
121
+
122
+ ---
123
+
124
+ ## Docker
125
+
126
+ Pre-built images on GitHub Container Registry:
127
+
128
+ ```sh
129
+ docker pull ghcr.io/animeshkundu/github-router:latest
130
+ docker run -p 8787:8787 -e GH_TOKEN=your_token ghcr.io/animeshkundu/github-router
131
+ ```
132
+
133
+ Or build locally:
134
+
135
+ ```sh
136
+ docker build -t github-router .
137
+ docker run -p 8787:8787 -e GH_TOKEN=your_token github-router
138
+ ```
139
+
140
+ <details>
141
+ <summary>Docker Compose</summary>
142
+
143
+ ```yaml
144
+ services:
145
+ github-router:
146
+ build: .
147
+ ports:
148
+ - "8787:8787"
149
+ environment:
150
+ - GH_TOKEN=your_github_token_here
151
+ restart: unless-stopped
152
+ ```
153
+
154
+ </details>
155
+
156
+ <details>
157
+ <summary>Persistent token storage</summary>
158
+
159
+ ```sh
160
+ mkdir -p ./github-router-data
161
+ docker run -p 8787:8787 -v $(pwd)/github-router-data:/root/.local/share/github-router github-router
162
+ ```
163
+
164
+ </details>
165
+
166
+ ---
167
+
168
+ ## CLI Reference
169
+
170
+ ```
171
+ github-router start [options] Start the proxy server
172
+ github-router auth Authenticate with GitHub
173
+ github-router check-usage Show Copilot usage/quotas
174
+ github-router debug Print diagnostic info
175
+ ```
176
+
177
+ | Flag | Description | Default |
178
+ |---|---|---|
179
+ | `--port, -p` | Port | 8787 |
180
+ | `--verbose, -v` | Debug logging | false |
181
+ | `--account-type, -a` | `individual` / `business` / `enterprise` | individual |
182
+ | `--rate-limit, -r` | Min seconds between requests | - |
183
+ | `--wait, -w` | Queue requests instead of rejecting on rate limit | false |
184
+ | `--manual` | Approve each request manually | false |
185
+ | `--github-token, -g` | Pass token directly (skip auth flow) | - |
186
+ | `--claude-code, -c` | Generate Claude Code launch command | false |
187
+ | `--codex` | Generate Codex CLI launch command | false |
188
+ | `--show-token` | Print tokens to console | false |
189
+ | `--proxy-env` | Use HTTP_PROXY/HTTPS_PROXY env vars | false |
190
+
191
+ ---
192
+
193
+ ## Development
194
+
195
+ ```sh
196
+ bun install # Install deps
197
+ bun run dev # Dev server with hot reload
198
+ bun test # Run tests
199
+ bun run lint:all # Lint
200
+ bun run typecheck # Type check
201
+ bun run build # Build for distribution
202
+ ```
203
+
204
+ ## License
205
+
206
+ [MIT](LICENSE)