@nick3/copilot-api 1.10.9 → 1.10.30
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 +140 -45
- package/README.zh-CN.md +140 -45
- package/dist/{account-COtMmvzU.js → account-DpW8RaT6.js} +3 -3
- package/dist/{account-COtMmvzU.js.map → account-DpW8RaT6.js.map} +1 -1
- package/dist/admin/AGENTS.md +19 -0
- package/dist/admin/assets/{index-BAh4eOwM.js → index-BGmG-ckX.js} +34 -34
- package/dist/admin/index.html +1 -1
- package/dist/auth-CnwhQOu6.js +327 -0
- package/dist/auth-CnwhQOu6.js.map +1 -0
- package/dist/{check-usage-DdevqHE5.js → check-usage-CseltoFJ.js} +4 -42
- package/dist/check-usage-CseltoFJ.js.map +1 -0
- package/dist/config-XZv75uoU.js +591 -0
- package/dist/config-XZv75uoU.js.map +1 -0
- package/dist/{debug-BMo6ltbp.js → debug-D8xHblDV.js} +18 -7
- package/dist/debug-D8xHblDV.js.map +1 -0
- package/dist/main.js +5 -10
- package/dist/main.js.map +1 -1
- package/dist/mcp-http-BhELuvog.js +2 -0
- package/dist/mcp-http-DI4Vz01p.js +82 -0
- package/dist/mcp-http-DI4Vz01p.js.map +1 -0
- package/dist/mcp-http-config-DMdUDz1D.js +39 -0
- package/dist/mcp-http-config-DMdUDz1D.js.map +1 -0
- package/dist/mcp-pLTPS0tO.js +79 -0
- package/dist/mcp-pLTPS0tO.js.map +1 -0
- package/dist/{tool-search-BrN7M0Dd.js → mcp-server-DEqHrXFq.js} +25 -2
- package/dist/mcp-server-DEqHrXFq.js.map +1 -0
- package/dist/{paths-CclKwouX.js → paths-Bpsb62LK.js} +3 -1
- package/dist/paths-Bpsb62LK.js.map +1 -0
- package/dist/{poll-access-token-BAgM2-7k.js → poll-access-token-GzVkiTH8.js} +71 -4
- package/dist/poll-access-token-GzVkiTH8.js.map +1 -0
- package/dist/{request-outbound-BJjWS_jF.js → request-outbound-BkEA8Wgb.js} +1 -1
- package/dist/{request-outbound-Pu1kp2x8.js → request-outbound-DZTxxtcx.js} +3 -3
- package/dist/{request-outbound-Pu1kp2x8.js.map → request-outbound-DZTxxtcx.js.map} +1 -1
- package/dist/{proxy-_U-hgwIn.js → responses-bridge-registry-JjUvTCST.js} +127 -581
- package/dist/responses-bridge-registry-JjUvTCST.js.map +1 -0
- package/dist/{server-GxNB5Syq.js → server-BYKxAFro.js} +678 -249
- package/dist/server-BYKxAFro.js.map +1 -0
- package/dist/start-DVlCJ0Ma.js +526 -0
- package/dist/start-DVlCJ0Ma.js.map +1 -0
- package/dist/token-9O2KJcF5.js +946 -0
- package/dist/token-9O2KJcF5.js.map +1 -0
- package/package.json +2 -2
- package/dist/auth-B0y-2njL.js +0 -226
- package/dist/auth-B0y-2njL.js.map +0 -1
- package/dist/check-usage-DdevqHE5.js.map +0 -1
- package/dist/debug-BMo6ltbp.js.map +0 -1
- package/dist/get-copilot-token-8Rm-rVsp.js +0 -17
- package/dist/get-copilot-token-8Rm-rVsp.js.map +0 -1
- package/dist/mcp-9Hgepkc5.js +0 -37
- package/dist/mcp-9Hgepkc5.js.map +0 -1
- package/dist/paths-CclKwouX.js.map +0 -1
- package/dist/poll-access-token-BAgM2-7k.js.map +0 -1
- package/dist/proxy-_U-hgwIn.js.map +0 -1
- package/dist/server-GxNB5Syq.js.map +0 -1
- package/dist/start-DdrurmQ3.js +0 -274
- package/dist/start-DdrurmQ3.js.map +0 -1
- package/dist/tool-search-BrN7M0Dd.js.map +0 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ English | [简体中文](./README.zh-CN.md)
|
|
|
30
30
|
>
|
|
31
31
|
> 2. **Recommend for Opencode:** When using with opencode, we recommend starting with the opencode OAuth app. This approach behaves identically to opencode's built-in GitHub Copilot provider with no Terms of Service risk:
|
|
32
32
|
> ```sh
|
|
33
|
-
>
|
|
33
|
+
> bunx --bun @nick3/copilot-api@latest --oauth-app=opencode start
|
|
34
34
|
> ```
|
|
35
35
|
>
|
|
36
36
|
> 3. **Disable multi agent when using codex:** If you're using codex via GitHub Copilot, it's recommended to disable the multi agent feature. Currently, GitHub Copilot charges based on the last message being a user role when using codex, and the billing logic has not been adjusted.
|
|
@@ -46,6 +46,7 @@ Compared with routing everything through plain Chat Completions compatibility, t
|
|
|
46
46
|
## Features
|
|
47
47
|
|
|
48
48
|
- **OpenAI & Anthropic Compatibility**: Exposes GitHub Copilot as an OpenAI-compatible (`/v1/responses`, `/v1/chat/completions`, `/v1/models`, `/v1/embeddings`) and Anthropic-compatible (`/v1/messages`) API.
|
|
49
|
+
- **Codex Responses WebSocket Compatibility**: Accepts Codex's preferred Responses WebSocket transport on `/v1/responses` and bridges it through the existing Responses handler.
|
|
49
50
|
- **Anthropic-First Routing for Claude Models**: When a model supports Copilot's native `/v1/messages` endpoint, the proxy prefers it over `/responses` or `/chat/completions`, preserving Anthropic-style `tool_use` / `tool_result` flows and more Claude-native behavior.
|
|
50
51
|
- **Fewer Unnecessary Premium Requests**: Reduces wasted premium usage by routing warmup requests to `smallModel`, merging `tool_result` follow-ups back into the tool flow, and treating resumed tool turns as continuation traffic instead of fresh premium interactions.
|
|
51
52
|
- **Phase-Aware `gpt-5.4` and `gpt-5.3-codex`**: These models can emit user-friendly commentary before deeper reasoning or tool use, so long-running coding actions are easier to understand instead of appearing as a sudden tool burst.
|
|
@@ -126,7 +127,7 @@ When an Anthropic API key is configured, the proxy forwards Claude model token c
|
|
|
126
127
|
## Prerequisites
|
|
127
128
|
|
|
128
129
|
- Bun (>= 1.2.x)
|
|
129
|
-
- Node.js if you
|
|
130
|
+
- Node.js only if you want to run the lightweight MCP bridge through `npx`
|
|
130
131
|
- GitHub account with Copilot subscription (individual, business, or enterprise)
|
|
131
132
|
|
|
132
133
|
## Installation
|
|
@@ -143,26 +144,28 @@ To start the server directly from source:
|
|
|
143
144
|
bun run start start
|
|
144
145
|
```
|
|
145
146
|
|
|
146
|
-
## Using with
|
|
147
|
+
## Using the published CLI with Bun
|
|
147
148
|
|
|
148
|
-
|
|
149
|
+
The server and account-management commands are Bun-only because the Admin UI and request history use `bun:sqlite`. Run the published CLI with Bun so the `#!/usr/bin/env node` shebang does not force Node.js:
|
|
149
150
|
|
|
150
151
|
```sh
|
|
151
|
-
|
|
152
|
+
bunx --bun @nick3/copilot-api@latest start
|
|
152
153
|
```
|
|
153
154
|
|
|
154
155
|
With options:
|
|
155
156
|
|
|
156
157
|
```sh
|
|
157
|
-
|
|
158
|
+
bunx --bun @nick3/copilot-api@latest start --port 8080
|
|
158
159
|
```
|
|
159
160
|
|
|
160
161
|
For authentication only:
|
|
161
162
|
|
|
162
163
|
```sh
|
|
163
|
-
|
|
164
|
+
bunx --bun @nick3/copilot-api@latest auth
|
|
164
165
|
```
|
|
165
166
|
|
|
167
|
+
The lightweight MCP bridge is the exception and can still be launched with `npx`; see [GPT Tool Search](#gpt-tool-search).
|
|
168
|
+
|
|
166
169
|
## Using with Docker
|
|
167
170
|
|
|
168
171
|
Build image
|
|
@@ -293,6 +296,20 @@ The following command line options are available for the `start` command:
|
|
|
293
296
|
| --claude-code | Generate a command to launch Claude Code with Copilot API config | false | -c |
|
|
294
297
|
| --show-token | Show GitHub and Copilot tokens on fetch and refresh | false | none |
|
|
295
298
|
| --proxy-env | Initialize proxy from environment variables | false | none |
|
|
299
|
+
| --enable-mcp-http | Expose the unauthenticated MCP Streamable HTTP endpoint at `/mcp` | false | none |
|
|
300
|
+
|
|
301
|
+
### MCP Command Options
|
|
302
|
+
|
|
303
|
+
The `mcp` command defaults to stdio for local Claude Code compatibility. Use `--transport http` only when your MCP client supports Streamable HTTP.
|
|
304
|
+
|
|
305
|
+
| Option | Description | Default |
|
|
306
|
+
| ----------- | ----------------------------------- | --------- |
|
|
307
|
+
| --transport | Transport to use: `stdio` or `http` | stdio |
|
|
308
|
+
| --host | HTTP transport host | 127.0.0.1 |
|
|
309
|
+
| --port | HTTP transport port | 4142 |
|
|
310
|
+
| --path | HTTP transport path | /mcp |
|
|
311
|
+
|
|
312
|
+
MCP HTTP browser CORS is loopback-only by default. Set `COPILOT_API_MCP_HTTP_ALLOWED_ORIGINS=https://client.example.com,https://admin.example.com` to allow extra browser origins, or `*` to explicitly opt into wildcard CORS.
|
|
296
313
|
|
|
297
314
|
### Auth Command Options
|
|
298
315
|
|
|
@@ -451,7 +468,7 @@ The `<target>` can be either the account ID (GitHub login) or a 1-based index.
|
|
|
451
468
|
- **modelRefreshIntervalHours:** Interval for refreshing account model lists in the background. Set to `0` to disable refresh. Defaults to `24`.
|
|
452
469
|
- **sessionAffinityRetentionDays:** Number of days to retain session affinity bindings. Defaults to `7`.
|
|
453
470
|
- **useMessagesApi:** When `true` (default), Claude-family models that support Copilot's native `/v1/messages` endpoint may use the Messages API path. Set to `false` to skip the Messages API candidate and fall back to `/responses` (if supported) or `/chat/completions`.
|
|
454
|
-
- **useResponsesApiWebSocket:** When `true` (default), Responses API requests use Copilot's WebSocket transport for models that advertise `ws:/responses`; models that only advertise `/responses` continue to use HTTP. Set to `false` to disable WebSocket routing.
|
|
471
|
+
- **useResponsesApiWebSocket:** When `true` (default), outbound Copilot Responses API requests use Copilot's WebSocket transport for models that advertise `ws:/responses`; models that only advertise `/responses` continue to use HTTP. Set to `false` to disable upstream WebSocket routing. This does not disable the inbound Codex-compatible WebSocket listener on `/v1/responses`.
|
|
455
472
|
- **useResponsesApiWebSearch:** When `true` (default), `/v1/responses` keeps tools with `type: "web_search"` and forwards them upstream. Set to `false` to strip them before the Copilot request is sent.
|
|
456
473
|
- **logLevel:** Controls handler file-log verbosity under `logs/*.log`. Allowed values: `error`, `warn`, `info`, `debug`. Defaults to `info`. Set it to `debug` when you need payload- or stream-level diagnostics written into file logs.
|
|
457
474
|
- **anthropicApiKey:** Optional Anthropic API key used for accurate Claude token counting (see [Accurate Claude Token Counting](#accurate-claude-token-counting) below). Can also be set via the `ANTHROPIC_API_KEY` environment variable. If not set, token counting falls back to GPT tokenizer estimation.
|
|
@@ -489,6 +506,7 @@ These endpoints mimic the OpenAI API structure.
|
|
|
489
506
|
| Endpoint | Method | Description |
|
|
490
507
|
| --------------------------- | ------ | ---------------------------------------------------------------- |
|
|
491
508
|
| `POST /v1/responses` | `POST` | OpenAI Most advanced interface for generating model responses. |
|
|
509
|
+
| `GET /v1/responses` | `WS` | Codex-compatible Responses WebSocket transport. |
|
|
492
510
|
| `POST /v1/chat/completions` | `POST` | Creates a model response for the given chat conversation. |
|
|
493
511
|
| `GET /v1/models` | `GET` | Lists the currently available models. |
|
|
494
512
|
| `POST /v1/embeddings` | `POST` | Creates an embedding vector representing the input text. |
|
|
@@ -570,86 +588,98 @@ The server also exposes a built-in admin UI and API for inspecting account statu
|
|
|
570
588
|
|
|
571
589
|
## Example Usage
|
|
572
590
|
|
|
573
|
-
Using with
|
|
591
|
+
Using the published CLI with Bun:
|
|
574
592
|
|
|
575
593
|
```sh
|
|
576
594
|
# Basic usage with start command
|
|
577
|
-
|
|
595
|
+
bunx --bun @nick3/copilot-api@latest start
|
|
578
596
|
|
|
579
597
|
# Run on custom port with verbose logging
|
|
580
|
-
|
|
598
|
+
bunx --bun @nick3/copilot-api@latest start --port 8080 --verbose
|
|
581
599
|
|
|
582
600
|
# Use with a business plan GitHub account
|
|
583
|
-
|
|
601
|
+
bunx --bun @nick3/copilot-api@latest start --account-type business
|
|
584
602
|
|
|
585
603
|
# Use with an enterprise plan GitHub account
|
|
586
|
-
|
|
604
|
+
bunx --bun @nick3/copilot-api@latest start --account-type enterprise
|
|
587
605
|
|
|
588
606
|
# Enable manual approval for each request
|
|
589
|
-
|
|
607
|
+
bunx --bun @nick3/copilot-api@latest start --manual
|
|
590
608
|
|
|
591
609
|
# Set rate limit to 30 seconds between requests
|
|
592
|
-
|
|
610
|
+
bunx --bun @nick3/copilot-api@latest start --rate-limit 30
|
|
593
611
|
|
|
594
612
|
# Wait instead of error when rate limit is hit
|
|
595
|
-
|
|
613
|
+
bunx --bun @nick3/copilot-api@latest start --rate-limit 30 --wait
|
|
596
614
|
|
|
597
615
|
# Provide GitHub token directly
|
|
598
|
-
|
|
616
|
+
bunx --bun @nick3/copilot-api@latest start --github-token ghp_YOUR_TOKEN_HERE
|
|
599
617
|
|
|
600
618
|
# Run only the auth flow
|
|
601
|
-
|
|
619
|
+
bunx --bun @nick3/copilot-api@latest auth
|
|
602
620
|
|
|
603
621
|
# Run auth flow with verbose logging
|
|
604
|
-
|
|
622
|
+
bunx --bun @nick3/copilot-api@latest auth --verbose
|
|
605
623
|
|
|
606
624
|
# Add multiple accounts (each account is added in order)
|
|
607
|
-
|
|
608
|
-
|
|
625
|
+
bunx --bun @nick3/copilot-api@latest auth add
|
|
626
|
+
bunx --bun @nick3/copilot-api@latest auth add # add second account
|
|
609
627
|
|
|
610
628
|
# List all registered accounts
|
|
611
|
-
|
|
629
|
+
bunx --bun @nick3/copilot-api@latest auth ls
|
|
612
630
|
|
|
613
631
|
# List accounts with quota information
|
|
614
|
-
|
|
632
|
+
bunx --bun @nick3/copilot-api@latest auth ls -q
|
|
615
633
|
|
|
616
634
|
# Remove an account by index (1-based)
|
|
617
|
-
|
|
635
|
+
bunx --bun @nick3/copilot-api@latest auth rm 2
|
|
618
636
|
|
|
619
637
|
# Remove an account by ID (GitHub login)
|
|
620
|
-
|
|
638
|
+
bunx --bun @nick3/copilot-api@latest auth rm octocat
|
|
621
639
|
|
|
622
640
|
# Show your Copilot usage/quota in the terminal (no server needed)
|
|
623
|
-
|
|
641
|
+
bunx --bun @nick3/copilot-api@latest check-usage
|
|
624
642
|
|
|
625
643
|
# Display debug information for troubleshooting
|
|
626
|
-
|
|
644
|
+
bunx --bun @nick3/copilot-api@latest debug
|
|
627
645
|
|
|
628
646
|
# Display debug information in JSON format
|
|
629
|
-
|
|
647
|
+
bunx --bun @nick3/copilot-api@latest debug --json
|
|
630
648
|
|
|
631
649
|
# Initialize proxy from environment variables (HTTP_PROXY, HTTPS_PROXY, etc.)
|
|
632
|
-
|
|
650
|
+
bunx --bun @nick3/copilot-api@latest start --proxy-env
|
|
633
651
|
|
|
634
652
|
# Use opencode GitHub Copilot authentication
|
|
635
|
-
COPILOT_API_OAUTH_APP=opencode
|
|
653
|
+
COPILOT_API_OAUTH_APP=opencode bunx --bun @nick3/copilot-api@latest start
|
|
636
654
|
|
|
637
655
|
# Set custom API home directory via command line
|
|
638
|
-
|
|
656
|
+
bunx --bun @nick3/copilot-api@latest --api-home=/path/to/custom/dir start
|
|
639
657
|
|
|
640
658
|
# Use GitHub Enterprise via command line
|
|
641
|
-
|
|
659
|
+
bunx --bun @nick3/copilot-api@latest --enterprise-url=company.ghe.com start
|
|
642
660
|
|
|
643
661
|
# Use opencode OAuth via command line
|
|
644
|
-
|
|
662
|
+
bunx --bun @nick3/copilot-api@latest --oauth-app=opencode start
|
|
645
663
|
|
|
646
664
|
# Combine multiple global options
|
|
647
|
-
|
|
665
|
+
bunx --bun @nick3/copilot-api@latest --api-home=/custom/path --oauth-app=opencode --enterprise-url=company.ghe.com start
|
|
666
|
+
```
|
|
648
667
|
|
|
649
|
-
|
|
650
|
-
|
|
668
|
+
For the MCP tool-search bridge only, `npx` remains supported:
|
|
669
|
+
|
|
670
|
+
```sh
|
|
671
|
+
# Local stdio MCP bridge, unchanged
|
|
672
|
+
npx -y @nick3/copilot-api@latest mcp
|
|
673
|
+
|
|
674
|
+
# Standalone Streamable HTTP MCP bridge
|
|
675
|
+
npx -y @nick3/copilot-api@latest mcp --transport http --host 127.0.0.1 --port 4142 --path /mcp
|
|
676
|
+
|
|
677
|
+
# Main proxy server with /mcp explicitly enabled
|
|
678
|
+
bunx --bun @nick3/copilot-api@latest start --enable-mcp-http
|
|
651
679
|
```
|
|
652
680
|
|
|
681
|
+
The HTTP MCP endpoint is unauthenticated. Keep the default loopback host for standalone mode. Browser CORS defaults to loopback origins only; set `COPILOT_API_MCP_HTTP_ALLOWED_ORIGINS` only for trusted clients. Do not expose `/mcp` on an untrusted network unless an external proxy, firewall, or tunnel access policy protects it.
|
|
682
|
+
|
|
653
683
|
### Opencode OAuth Authentication
|
|
654
684
|
|
|
655
685
|
You can use opencode GitHub Copilot authentication instead of the default one:
|
|
@@ -659,16 +689,52 @@ You can use opencode GitHub Copilot authentication instead of the default one:
|
|
|
659
689
|
export COPILOT_API_OAUTH_APP=opencode
|
|
660
690
|
|
|
661
691
|
# Then run start or auth commands
|
|
662
|
-
|
|
663
|
-
|
|
692
|
+
bunx --bun @nick3/copilot-api@latest start
|
|
693
|
+
bunx --bun @nick3/copilot-api@latest auth
|
|
664
694
|
```
|
|
665
695
|
|
|
666
696
|
Or use inline environment variable:
|
|
667
697
|
|
|
668
698
|
```sh
|
|
669
|
-
COPILOT_API_OAUTH_APP=opencode
|
|
699
|
+
COPILOT_API_OAUTH_APP=opencode bunx --bun @nick3/copilot-api@latest start
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
## Using with Codex CLI
|
|
703
|
+
|
|
704
|
+
Codex can use this proxy as an OpenAI-compatible Responses API provider. The proxy supports both Codex's HTTP `POST /v1/responses` path and its preferred WebSocket upgrade on `GET /v1/responses`.
|
|
705
|
+
|
|
706
|
+
Start the proxy:
|
|
707
|
+
|
|
708
|
+
```sh
|
|
709
|
+
bunx --bun @nick3/copilot-api@latest start
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
> **Note:** The inbound Codex WebSocket listener on `GET /v1/responses` requires the Bun server runtime, so start the proxy with `bunx --bun` (or a local Bun install). The `npx` path is only supported for the lightweight MCP bridge and does not run the WebSocket listener.
|
|
713
|
+
|
|
714
|
+
Add a provider to `~/.codex/config.toml`:
|
|
715
|
+
|
|
716
|
+
```toml
|
|
717
|
+
[model_providers.copilot-api]
|
|
718
|
+
name = "copilot-api"
|
|
719
|
+
base_url = "http://localhost:4141/v1"
|
|
720
|
+
wire_api = "responses"
|
|
721
|
+
supports_websockets = true
|
|
722
|
+
|
|
723
|
+
[profiles.copilot-api]
|
|
724
|
+
model_provider = "copilot-api"
|
|
725
|
+
model = "gpt-5.4"
|
|
670
726
|
```
|
|
671
727
|
|
|
728
|
+
Then run Codex with that profile:
|
|
729
|
+
|
|
730
|
+
```sh
|
|
731
|
+
codex -p copilot-api
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
If you configured `auth.apiKeys`, add the same key to Codex's provider headers or bearer-token configuration so both HTTP and WebSocket requests authenticate successfully. For troubleshooting only, set `supports_websockets = false` in Codex to force its HTTP fallback path.
|
|
735
|
+
|
|
736
|
+
> **Note:** When using Codex via GitHub Copilot, it is currently recommended to disable Codex multi-agent features because Copilot billing may count Codex traffic based on the final user-role message.
|
|
737
|
+
|
|
672
738
|
## Using with Claude Code
|
|
673
739
|
|
|
674
740
|
This proxy can be used to power [Claude Code](https://docs.anthropic.com/en/claude-code), an experimental conversational AI assistant for developers from Anthropic.
|
|
@@ -680,7 +746,7 @@ There are two ways to configure Claude Code to use this proxy:
|
|
|
680
746
|
To get started, run the `start` command with the `--claude-code` flag:
|
|
681
747
|
|
|
682
748
|
```sh
|
|
683
|
-
|
|
749
|
+
bunx --bun @nick3/copilot-api@latest start --claude-code
|
|
684
750
|
```
|
|
685
751
|
|
|
686
752
|
You will be prompted to select a primary model and a "small, fast" model for background tasks. After selecting the models, a command will be copied to your clipboard. This command sets the necessary environment variables for Claude Code to use the proxy.
|
|
@@ -736,7 +802,9 @@ Do not set Claude Code's native `ENABLE_TOOL_SEARCH` for GPT models. That flag e
|
|
|
736
802
|
|
|
737
803
|
If you install `tool-search@copilot-api-marketplace`, Claude Code receives this MCP bridge automatically and you can skip the manual Claude Code MCP setup below.
|
|
738
804
|
|
|
739
|
-
|
|
805
|
+
This MCP bridge is intentionally small and does not load the server or SQLite code, so it remains safe to run through `npx`. Use Bun for the main `start`, `auth`, `check-usage`, and `debug` commands.
|
|
806
|
+
|
|
807
|
+
Add the tool search bridge to the MCP config used by Claude Code over stdio:
|
|
740
808
|
|
|
741
809
|
```json
|
|
742
810
|
{
|
|
@@ -750,6 +818,33 @@ Add the tool search bridge to the MCP config used by Claude Code:
|
|
|
750
818
|
}
|
|
751
819
|
```
|
|
752
820
|
|
|
821
|
+
To use Streamable HTTP instead, start the MCP HTTP bridge in one terminal:
|
|
822
|
+
|
|
823
|
+
```sh
|
|
824
|
+
npx -y @nick3/copilot-api@latest mcp --transport http --host 127.0.0.1 --port 4142 --path /mcp
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
Then add the HTTP MCP server to Claude Code:
|
|
828
|
+
|
|
829
|
+
```sh
|
|
830
|
+
claude mcp add --transport http tool_search http://127.0.0.1:4142/mcp
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
Equivalent manual MCP config:
|
|
834
|
+
|
|
835
|
+
```json
|
|
836
|
+
{
|
|
837
|
+
"mcpServers": {
|
|
838
|
+
"tool_search": {
|
|
839
|
+
"type": "http",
|
|
840
|
+
"url": "http://127.0.0.1:4142/mcp"
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
If you prefer the main proxy process to expose the same MCP server, start it with `--enable-mcp-http` and use `http://127.0.0.1:4141/mcp` as the Claude Code MCP URL. Use either the stdio config or the HTTP config for `tool_search`, not both.
|
|
847
|
+
|
|
753
848
|
Add the tool search bridge to the MCP config used by opencode:
|
|
754
849
|
|
|
755
850
|
```json
|
|
@@ -778,7 +873,7 @@ OpenCode already has a direct GitHub Copilot provider. Use this section when you
|
|
|
778
873
|
Start the proxy with the OpenCode OAuth app:
|
|
779
874
|
|
|
780
875
|
```sh
|
|
781
|
-
|
|
876
|
+
bunx --bun @nick3/copilot-api@latest --oauth-app=opencode start
|
|
782
877
|
```
|
|
783
878
|
|
|
784
879
|
Then point OpenCode at the proxy with `@ai-sdk/anthropic`.
|
|
@@ -868,7 +963,7 @@ Why these fields matter:
|
|
|
868
963
|
curl "http://localhost:4141/api/admin/meta"
|
|
869
964
|
|
|
870
965
|
# Enable remote admin UI/API access (server-side)
|
|
871
|
-
# ADMIN_TOKEN=your_admin_token_here
|
|
966
|
+
# ADMIN_TOKEN=your_admin_token_here bunx --bun @nick3/copilot-api@latest start
|
|
872
967
|
|
|
873
968
|
# Remote access (token required)
|
|
874
969
|
curl -H "x-admin-token: your_admin_token_here" "http://localhost:4141/api/admin/accounts?include_stats=1"
|
|
@@ -886,9 +981,9 @@ curl "http://localhost:4141/api/admin/requests/<requestId>"
|
|
|
886
981
|
|
|
887
982
|
The proxy includes a built-in admin UI served from your running instance. It lets you inspect account status and request history captured by the proxy (models/endpoints, tokens/usage, timing, and error summaries).
|
|
888
983
|
|
|
889
|
-
1. Start the server. For example, using
|
|
984
|
+
1. Start the server. For example, using Bun:
|
|
890
985
|
```sh
|
|
891
|
-
|
|
986
|
+
bunx --bun @nick3/copilot-api@latest start
|
|
892
987
|
```
|
|
893
988
|
2. Open the UI in your browser:
|
|
894
989
|
- `http://localhost:4141/admin` (replace the port if you changed it)
|