copilot-relay 0.4.5 → 0.4.7

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
@@ -16,7 +16,7 @@
16
16
  - **Use advertised chat models** — catalog-driven endpoint selection, optional effort support, and clear opt-in per-model deep checks.
17
17
  - **Choose Claude's upstream protocol** — `claudeUpstreamApi: chat-completions` stays the default; opt into `auto` or `messages` for native Claude transport.
18
18
  - **Diagnose offline** — debug mode captures full observed bodies for `copilot-relay replay`; captures contain unredacted prompts and must never be shared wholesale.
19
- - **Run it your way** — foreground CLI or background service on macOS, Windows, and Linux.
19
+ - **Run it your way** — foreground CLI or background service on macOS, Windows, and Linux; set `apiKey` to require a client key before binding beyond loopback.
20
20
 
21
21
  ## Quick start
22
22
 
@@ -39,7 +39,8 @@ claude
39
39
 
40
40
  Configuration lives in `~/.copilot-relay/config.yaml`. Model access depends on your
41
41
  account and organization policy; if startup rejects a model, choose an available
42
- one using the [configuration guide](wiki/EN-Configuration.md).
42
+ one using the [configuration guide](wiki/EN-Configuration.md). Behind a proxy, set
43
+ `upstreamProxy` in `config.yaml` to its URL, or `env`, before `copilot-relay auth`.
43
44
 
44
45
  Discover models, find the config value for one, and optionally test it:
45
46
 
@@ -53,6 +54,18 @@ Deep checks **consume Copilot usage** and test an isolated relay pipeline, not t
53
54
  running daemon. Add `--details` for safe failure evidence and private replay hints.
54
55
  Use `copilot-relay status --deep` for daemon health, and `copilot-relay stop` when finished.
55
56
 
57
+ Check how well prompt caching works per model and upstream route. The report reads
58
+ only local logs and shows a hit rate below the goal, 95% by default, in red:
59
+
60
+ ```sh
61
+ copilot-relay cache # last 24 hours
62
+ copilot-relay cache --hourly # or --daily; narrow with --since 6h or --model opus
63
+ copilot-relay cache --json
64
+ ```
65
+
66
+ Check your Copilot plan and quota with `copilot-relay usage`; add `--json` for
67
+ scripts. It asks GitHub with the stored token, so no relay needs to run.
68
+
56
69
  ## Go further
57
70
 
58
71
  **[Open the Wiki](https://github.com/D0n9X1n/copilot-relay/wiki)** · **[English / 中文](wiki/README.md)**
@@ -3,7 +3,7 @@
3
3
  # This file is copied to ~/.copilot-relay/config.yaml on first start.
4
4
  # Edit the user config file, not this template, for local changes.
5
5
  # Valid complete edits hot-reload without rewriting this file.
6
- # host, port, and claudeSetup require restart.
6
+ # host, port, claudeSetup, and upstreamProxy require restart.
7
7
  #
8
8
  # Values here apply to a fresh install only. copilot-relay writes the resolved
9
9
  # config back to disk, so once a key exists in your config.yaml it is yours:
@@ -15,13 +15,32 @@ host: 127.0.0.1
15
15
  # Local port for the HTTP server.
16
16
  port: 4142
17
17
 
18
+ # Optional key that every client request must carry, as x-api-key or
19
+ # Authorization: Bearer. GET /healthz and GET|HEAD /api/hello stay open.
20
+ # Empty disables it. A set key is at least 16 visible ASCII characters;
21
+ # quote one that starts with #. Set a key before binding host beyond
22
+ # loopback: otherwise any client that reaches the port can use your
23
+ # Copilot account. Changes hot-reload, but a client keeps the token it
24
+ # loaded, so update and restart clients after changing it.
25
+ apiKey:
26
+
18
27
  # GitHub Copilot API base URL.
19
28
  # Keep this default unless you know your Copilot tenant uses a custom endpoint.
20
29
  copilotBaseUrl: https://api.githubcopilot.com
21
30
 
31
+ # Outbound proxy for Copilot and GitHub calls, including sign-in.
32
+ # Leave empty to connect directly.
33
+ # env uses HTTPS_PROXY, HTTP_PROXY and NO_PROXY. A background service does not
34
+ # inherit your shell's variables, so prefer a URL there.
35
+ # A URL looks like http://proxy.example:3128 or https://user:password@proxy.example:3128;
36
+ # percent-encode reserved characters in the user name and password.
37
+ upstreamProxy:
38
+
22
39
  # When true, start updates ~/.claude/settings.json with ANTHROPIC_BASE_URL
23
- # and a dummy ANTHROPIC_AUTH_TOKEN so Claude Code can use this proxy.
24
- # Also seeds context/output budgets from model discovery when not already set.
40
+ # and ANTHROPIC_AUTH_TOKEN so Claude Code can use this proxy. The token is
41
+ # apiKey when it is set; otherwise a dummy token is written if none is present.
42
+ # Also seeds context/output budgets from model discovery, and
43
+ # CLAUDE_CODE_AUTO_MODE_SERVER=0, when not already set.
25
44
  claudeSetup: true
26
45
 
27
46
  # Log verbosity: