@guanghechen/kit-copilot
v0.6.11
Published
AI API proxy server routing through GitHub Copilot
Downloads
2,893
Maintainers
Readme
@guanghechen/kit-copilot
GitHub Copilot proxy server for Claude, Codex, and Gemini compatible endpoints.
Environment Model
kit-copilot follows a strict environment flow:
- CLI entry passes
process.envto@guanghechen/commander/node. - Commander merges user envs with preset envs into
ctx.envs. - Runtime logic consumes
ctx.envsonly.
There is no runtime fallback from business logic to global process.env for critical keys such as:
GH_PRIMARY_TOKENCOPILOT_MODEL_REFRESH_SEC
Preset File (preset.json)
Config root:
$XDG_CONFIG_HOME/kit/copilotwhenXDG_CONFIG_HOMEis set~/.config/kit/copilototherwise
Default preset file:
<config-root>/preset.json
Commander loads preset data from preset.json (preset.file) and merges selected profile into ctx.envs.
If <config-root>/preset.json does not exist, command runs without preset envs.
Example preset.json:
{
"version": 1,
"defaults": { "profile": "default" },
"profiles": {
"default": {
"envFile": ".env.local"
}
}
}Token Persistence
kit-copilot auth persists GH_PRIMARY_TOKEN to preset env storage.
- Persist target:
<config-root>/.env.local GH_COPILOT_TOKENis not persisted
Note: .env.local is not auto-loaded by commander unless preset.json profile points to it (for example via envFile).
Examples
kit-copilot auth
kit-copilot start --port=4141With preset env file:
GH_PRIMARY_TOKEN=ghu_xxx
COPILOT_MODEL_REFRESH_SEC=300