opencode-github-copilot-enterprise-profile
v0.1.4
Published
OpenCode plugin/runtime for GitHub Copilot Enterprise model catalog and config overlays.
Downloads
414
Readme
GitHub Copilot Enterprise OpenCode Profile
Privacy-first OpenCode plugin and config renderer for enterprise Copilot environments.
Guarantees in this profile
- OpenCode share is disabled in generated config.
disabled_providerscontains onlyopencode.- Models are sourced from upstream Copilot
GET /models(authoritative metadata source). - Only models with
model_picker_enabled: trueand non-disabled picker policy are included in generated provider config. - Generated config also sets
provider.github-copilot.whitelistto the same filtered model IDs, so picker/listing is restricted to allowed models. - Default
modelis selected from enabledmodel_picker_category: "powerful"models first (premium + capability-first ranking), then falls back deterministically. - Default
small_modelis the strongest enabled non-premium model by capability-first ranking; when premium metadata is missing in upstream payloads, conservative non-premium ID heuristics are applied. OPENCODE_DISABLE_MODELS_FETCH=trueis treated as mandatory for startup scripts.- Thinking variants are metadata-first from
capabilities.supports.reasoning_effortwhen available.
Why this exists
In corporate/proxy environments, models.dev is often unavailable. This profile avoids dependency on it and derives model metadata from Copilot upstream API directly.
From issue #10416 discussion, this profile also incorporates practical hardening:
- Keep
disabled_providers: ["opencode"]explicit. - Require OpenCode
>=1.1.36for more reliable behavior around models fetch disable logic. - Support
OPENCODE_MODELS_URLif your environment requires a local models index override. - Optionally set
OPENCODE_DISABLE_DEFAULT_PLUGINS=truefor tighter offline startup control.
Files
- Generated runtime config:
.opencode/runtime/opencode.generated.json - Global plugin loader (installed):
~/.config/opencode/plugins/copilot-enterprise-profile.js - Runtime config renderer source:
scripts/render-config.ts - OpenCode launcher wrapper source:
scripts/run-opencode.ts - Compiled runtime entrypoints:
dist/scripts/*.js
Requirements
- Node 20+
- OpenCode installed
- Auth file present at
~/.local/share/opencode/auth.jsonwith key:
{
"github-copilot": {
"access": "<token>"
}
}Global install (simple)
One command installs plugin + global config overrides:
npm run install:globalOr install directly from npm (after publish):
npx opencode-github-copilot-enterprise-profileAlternative executable alias:
npx opencode-copilot-enterprise-installThis will:
- render models from Copilot
/models - install plugin loader in
~/.config/opencode/plugins/copilot-enterprise-profile.js - update
~/.config/opencode/opencode.jsonwith:share: "disabled"disabled_providers: ["opencode"]enabled_providers: ["github-copilot"]provider.github-copilot.modelsoverridesmodelandsmall_modelderived from upstream model metadata
- persist
OPENCODE_DISABLE_MODELS_FETCH=truein shell profiles
No extra manual config steps are needed after this.
Shell compatibility:
- macOS/Linux: writes to
~/.zshrcand~/.bashrc - Windows: writes PowerShell profile entries and attempts
setx OPENCODE_DISABLE_MODELS_FETCH true
Windows note:
- Preferred runtime is WSL per OpenCode docs; run installer from your target environment (WSL vs native Windows) so config paths are correct.
Usage
- Render generated config from Copilot
/models:
OPENCODE_DISABLE_MODELS_FETCH=true COPILOT_BASE_URL=https://api.githubcopilot.com npm run render-configThe generated config uses provider key github-copilot and only overrides provider.github-copilot.models.
- Run OpenCode using generated config:
OPENCODE_DISABLE_MODELS_FETCH=true npm run run -- modelsThis wrapper injects generated config via OPENCODE_CONFIG and OPENCODE_CONFIG_CONTENT to ensure runtime overrides apply.
Optional strict/offline-ish flags:
OPENCODE_PROFILE_OFFLINE=true OPENCODE_DISABLE_DEFAULT_PLUGINS=true OPENCODE_DISABLE_MODELS_FETCH=true npm run run -- modelsOptional subagent model override (lightweight + high reasoning):
OPENCODE_DISABLE_MODELS_FETCH=true npm run run -- --lightweight-subagents modelsThis enables OPENCODE_LIGHTWEIGHT_SUBAGENTS=true during config rendering and sets agent.general + agent.explore to the best enabled model_picker_category: "lightweight" model with the second-highest reasoning effort from metadata order (for example: low,medium,high,xhigh -> high).
If needed in enterprise packaging:
OPENCODE_MODELS_URL=<local models index path or URL>Security behavior
- Token/auth redaction in logs.
- HTTPS-only upstream validation for model catalog fetch.
- Atomic cache writes with restricted permissions.
- No use of OpenAI-compatible
/v1/modelsfor full capability decisions.
Thinking variant behavior
- The runtime inspects model capabilities from upstream
/models. - Variants are generated metadata-first from
capabilities.supports.reasoning_effort(normalized to endpoint-compatible effort aliases). - When metadata efforts are absent, compatibility fallbacks remain:
- non-reasoning models -> no variants
gemini*-> no variantsclaude*->thinkingvariant (thinking_budget: 4000)gpt-5.1-codex-max,gpt-5.2*,gpt-5.3*->low|medium|high|xhigh- other
gpt-5*reasoning models ->low|medium|high, plusxhighwhenrelease_date >= 2025-12-04
- Effort variants use
reasoningEffort,reasoningSummary: "auto", andinclude: ["reasoning.encrypted_content"]. - Variant overrides can disable specific variants with
disabled: true; disabled variants are removed and thedisabledkey is stripped from final config payload. - At request time, unsupported effort values are downgraded automatically.
Tests
npm testTypeScript
- Source is fully TypeScript in
src/**/*.ts,scripts/**/*.ts, andtest/**/*.ts. - Build output is emitted to
dist/vianpm run build.
Release automation
- CI workflow:
.github/workflows/ci.ymlruns tests on push/PR. - Release workflow:
.github/workflows/release.ymlpublishes to npm onv*git tags.
