github-router 0.1.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 ADDED
@@ -0,0 +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.
package/README.md ADDED
@@ -0,0 +1,195 @@
1
+ # openroute
2
+
3
+ [![CI](https://github.com/animeshkundu/openroute/actions/workflows/ci.yml/badge.svg)](https://github.com/animeshkundu/openroute/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/oproute)](https://www.npmjs.com/package/oproute)
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
+ openroute 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 oproute@latest auth
20
+
21
+ # 2. Start the proxy
22
+ npx oproute@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 oproute@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_AUTH_TOKEN": "dummy",
48
+ "ANTHROPIC_MODEL": "gpt-4.1",
49
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-4.1",
50
+ "ANTHROPIC_SMALL_FAST_MODEL": "gpt-4.1-mini",
51
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-4.1-mini",
52
+ "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
53
+ "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
54
+ },
55
+ "permissions": {
56
+ "deny": ["WebSearch"]
57
+ }
58
+ }
59
+ ```
60
+
61
+ Then run `claude` as normal.
62
+
63
+ ---
64
+
65
+ ## Use with Codex CLI
66
+
67
+ ```sh
68
+ npx oproute@latest start --codex
69
+ ```
70
+
71
+ Or set the env vars yourself:
72
+
73
+ ```sh
74
+ export OPENAI_BASE_URL="http://localhost:8787/v1"
75
+ export OPENAI_API_KEY="dummy"
76
+ codex -m gpt5.2-codex
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Use with any OpenAI-compatible tool
82
+
83
+ Point any tool at `http://localhost:8787/v1`:
84
+
85
+ ```sh
86
+ curl http://localhost:8787/v1/chat/completions \
87
+ -H "Content-Type: application/json" \
88
+ -d '{"model": "gpt-4.1", "messages": [{"role": "user", "content": "Hello"}]}'
89
+ ```
90
+
91
+ ---
92
+
93
+ ## API Endpoints
94
+
95
+ | Endpoint | Method | Format |
96
+ |---|---|---|
97
+ | `/v1/chat/completions` | POST | OpenAI Chat Completions |
98
+ | `/v1/responses` | POST | OpenAI Responses (Codex models) |
99
+ | `/v1/messages` | POST | Anthropic Messages |
100
+ | `/v1/messages/count_tokens` | POST | Anthropic token counting |
101
+ | `/v1/models` | GET | OpenAI model list |
102
+ | `/v1/embeddings` | POST | OpenAI embeddings |
103
+ | `/v1/search` | POST | Web search |
104
+ | `/usage` | GET | Copilot usage & quotas |
105
+
106
+ All endpoints also available without the `/v1` prefix.
107
+
108
+ <details>
109
+ <summary>Model / endpoint compatibility</summary>
110
+
111
+ | Model | /chat/completions | /responses |
112
+ |---|---|---|
113
+ | gpt-4.1, gpt-4o | Yes | Yes |
114
+ | gpt5.2-codex, gpt-5.1-codex-mini | No | Yes |
115
+ | claude-sonnet-4, claude-opus-4 | Yes (via /messages) | No |
116
+ | o3, o4-mini | Yes | Yes |
117
+
118
+ </details>
119
+
120
+ ---
121
+
122
+ ## Docker
123
+
124
+ ```sh
125
+ docker build -t openroute .
126
+ docker run -p 8787:8787 -e GH_TOKEN=your_token openroute
127
+ ```
128
+
129
+ <details>
130
+ <summary>Docker Compose</summary>
131
+
132
+ ```yaml
133
+ services:
134
+ openroute:
135
+ build: .
136
+ ports:
137
+ - "8787:8787"
138
+ environment:
139
+ - GH_TOKEN=your_github_token_here
140
+ restart: unless-stopped
141
+ ```
142
+
143
+ </details>
144
+
145
+ <details>
146
+ <summary>Persistent token storage</summary>
147
+
148
+ ```sh
149
+ mkdir -p ./openroute-data
150
+ docker run -p 8787:8787 -v $(pwd)/openroute-data:/root/.local/share/openroute openroute
151
+ ```
152
+
153
+ </details>
154
+
155
+ ---
156
+
157
+ ## CLI Reference
158
+
159
+ ```
160
+ oproute start [options] Start the proxy server
161
+ oproute auth Authenticate with GitHub
162
+ oproute check-usage Show Copilot usage/quotas
163
+ oproute debug Print diagnostic info
164
+ ```
165
+
166
+ | Flag | Description | Default |
167
+ |---|---|---|
168
+ | `--port, -p` | Port | 8787 |
169
+ | `--verbose, -v` | Debug logging | false |
170
+ | `--account-type, -a` | `individual` / `business` / `enterprise` | individual |
171
+ | `--rate-limit, -r` | Min seconds between requests | — |
172
+ | `--wait, -w` | Queue requests instead of rejecting on rate limit | false |
173
+ | `--manual` | Approve each request manually | false |
174
+ | `--github-token, -g` | Pass token directly (skip auth flow) | — |
175
+ | `--claude-code, -c` | Generate Claude Code launch command | false |
176
+ | `--codex` | Generate Codex CLI launch command | false |
177
+ | `--show-token` | Print tokens to console | false |
178
+ | `--proxy-env` | Use HTTP_PROXY/HTTPS_PROXY env vars | false |
179
+
180
+ ---
181
+
182
+ ## Development
183
+
184
+ ```sh
185
+ bun install # Install deps
186
+ bun run dev # Dev server with hot reload
187
+ bun test # Run tests
188
+ bun run lint:all # Lint
189
+ bun run typecheck # Type check
190
+ bun run build # Build for distribution
191
+ ```
192
+
193
+ ## License
194
+
195
+ [MIT](LICENSE)