forked from ericc-ch/copilot-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-controlled.bat
More file actions
62 lines (54 loc) · 2.15 KB
/
Copy pathstart-controlled.bat
File metadata and controls
62 lines (54 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@echo off
TITLE Copilot Proxy - Controlled
echo ================================================
echo Copilot Proxy - Controlled
echo ================================================
echo.
:: Load environment variables from .env if it exists
if exist .env (
echo Loading environment from .env...
for /f "usebackq tokens=1,* delims==" %%A in (".env") do (
if not "%%A"=="" if not "%%A:~0,1%"=="#" (
set "%%A=%%B"
)
)
echo.
)
:: --- TLS / HTTPS configuration ----------------------------------------
:: LAN IP the other laptop uses to reach this PC (must match a cert SAN).
set "LAN_IP=192.168.0.105"
:: Point the server at the self-signed cert generated by generate-cert.bat.
set "TLS_CERT=%~dp0certs\server.crt"
set "TLS_KEY=%~dp0certs\server.key"
if not exist "%TLS_CERT%" (
echo TLS certificate not found at "%TLS_CERT%".
echo Run generate-cert.bat first to create it.
echo.
pause
exit /b 1
)
:: Build if dist/ doesn't exist
if not exist dist (
echo Building project...
bun run build
echo.
)
if defined TAVILY_API_KEY (
echo Web search: enabled ^(Tavily^)
) else if defined BRAVE_API_KEY (
echo Web search: enabled ^(Brave^)
) else (
echo Web search: disabled ^(set TAVILY_API_KEY or BRAVE_API_KEY in .env to enable^)
)
echo.
echo Starting server on https://localhost:3131
echo Reachable from other machines at https://%LAN_IP%:3131
:: echo --burst-count 10 --burst-window 30 ^(max 10 requests per 30s window^)
echo.
echo To launch Claude Code, run in a new terminal:
:: echo set ANTHROPIC_BASE_URL=https://localhost:3131 ^& set ANTHROPIC_AUTH_TOKEN=dummy ^& set ANTHROPIC_MODEL=claude-opus-4.6 ^& set ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4.6 ^& set ANTHROPIC_SMALL_FAST_MODEL=gpt-4o-mini ^& set ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-opus-4.6 ^& set DISABLE_NON_ESSENTIAL_MODEL_CALLS=1 ^& set CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 ^& claude
echo.
:: start "" "https://ericc-ch.github.io/copilot-api?endpoint=https://%LAN_IP%:3131/usage"
bun run ./src/main.ts start --port 3131 --burst-count 300 --burst-window 30 --min-spacing 100 --burst-scope model
:: bun run ./src/main.ts start
pause