A tool to add custom models to GitHub Copilot CLI's allowed models list.
Note: This is a fork of the original copilot-cli-free-models. Special thanks to the original creator @agileandy for his work. This version has been enhanced to provide native support for both Bash (Linux/macOS/WSL) and Windows PowerShell, and it patches both required model arrays for full compatibility with /model command.
This fork introduces two dedicated scripts:
patch-models.sh: For Bash-based systems (Linux, macOS, WSL).patch-models.ps1: For native Windows environments using PowerShell.
- Dual Script Support: Native scripts for both PowerShell on Windows and Bash on other systems.
- Dual Array Patching: The script now patches both the simple model name array and the model object array (which includes labels), ensuring models appear correctly in any UI that uses them.
- Expanded Default Models: Now includes
gpt-4.1,gpt-4o,gpt-5-mini,grok-code-fast-1,gemini-2.5-proby default.
Warning
A Note on Copilot CLI Versions 0.0.357
Version 0.0.356 of the Copilot CLI briefly introduced experimental models (gpt-5-codex, gpt-5.1, gpt-5.1-codex-mini, gpt-5.1-codex). However, in the very next version (0.0.357), GitHub removed the API connection code for these models, making them non-functional. Now in version 0.0.358, they have restored the code for these models.
Our goal is to patch in only working models. Therefore, this script will not add these specific models on v0.0.357.
If you wish to use these experimental models, you must use Copilot CLI version 0.0.356 or 0.0.358+. otherwise they will not work! you can switch to that version by:
npm install -g @github/copilot@0.0.356
or
npm install -g @github/copilot@0.0.358+
- In-App Model Switching: After patching, you can switch between the added models using commands like
/modeldirectly within the Copilot CLI interface.
| Platform | Status | Tested Versions | Notes |
|---|---|---|---|
| macOS | β Working | v0.0.363 | Verified via automated tests on macOS |
| Windows | β Working | v0.0.363 | Fully tested on PowerShell, WSL, and Git Bash and automated tests on Windows |
| Linux | β Working | v0.0.363 | Verified via automated tests on Ubuntu. |
Note: This script performs text-based find-and-replace on minified JavaScript. Different Copilot CLI versions may have different internal structure. Always test with --dry-run first.
- GitHub Copilot CLI version
0.0.354. - GitHub Copilot CLI version
0.0.355. - GitHub Copilot CLI version
0.0.356. (They added new models: gpt-5.1,gpt-5.1-codex-mini,gpt-5.1-codex) - GitHub Copilot CLI version
0.0.357. (They remove code for added models: gpt-5.1,gpt-5.1-codex-mini,gpt-5.1-codex? wierd...) - GitHub Copilot CLI version
0.0.358. (They fix and restore code for added models: gpt-5.1,gpt-5.1-codex-mini,gpt-5.1-codex π©·) - GitHub Copilot CLI version
0.0.359. - GitHub Copilot CLI version
0.0.360. - GitHub Copilot CLI version
0.0.361. (They added new model: Gemini 3 Pro. Latest tested version) - GitHub Copilot CLI version
0.0.362. (They fix some issues only) - GitHub Copilot CLI version
0.0.363. (Opus 4.5, GPT-4.1 and GPT-5-Mini are now available in GitHub Copilot CLI Native so i add models they dont add by default (gpt-4o,grok-code-fast-1,gemini-2.5-pro (pls remember to unlock new models in Copilot settings page)))
- Bash shell (macOS, Linux, WSL)
- Perl (pre-installed on macOS/Linux)
- GitHub Copilot CLI installed
- Windows PowerShell 7.0+ (pre-installed on Windows 10/11)
- GitHub Copilot CLI installed
- Make the script executable:
chmod +x patch-models.sh
- Run a dry run to preview changes:
./patch-models.sh --dry-run
- Apply the patch:
./patch-models.sh
- Set Execution Policy (if needed):
Open PowerShell as an Administrator and run this command once to allow local scripts to run:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
- Run a dry run to preview changes:
Open a regular PowerShell window, navigate to the directory, and run:
.\patch-models.ps1 -DryRun
- Apply the patch:
.\patch-models.ps1
Thanks to the dual-array patch, you can now switch between the newly added models directly from the Copilot CLI using the /model command.
Editing your configuration file is optional. You only need to edit ~/.copilot/config.json if you want to set a default model that the CLI will use at startup.
To set a default model (Optional):
Edit the file at ~/.copilot/config.json and set the model property:
{
"model": "gpt-5-mini"
}If you don't set a default, you can still access the new models anytime by typing /model in the Copilot CLI prompt.
Since the Copilot CLI's internal structure can change with updates, this repository will use branches to track unlocker versions that are compatible with specific releases of @github/copilot.
If the script on the main branch fails after a CLI update, please check the repository's branches for a version named after your CLI version (e.g., copilot-v1.20.0).
Default Usage (Recommended)
This will patch the CLI with the default set of models: gpt-4.1, gpt-4o, gpt-5-mini, and grok-code-fast-1.
./patch-models.shAdd Specific Models
Use the --models flag to add a custom list of models instead of the default ones.
./patch-models.sh --models o1Patch a Custom Location
./patch-models.sh --file /path/to/custom/index.jsDefault Usage (Recommended)
This will patch the CLI with the default set of models: gpt-4.1, gpt-4o, gpt-5-mini, and grok-code-fast-1.
.\patch-models.ps1Add Specific Models
Use the -Models parameter to add a custom list of models instead of the default ones.
.\patch-models.ps1 -Models "o1"Patch a Custom Location
.\patch-models.ps1 -File "C:\path\to\custom\index.js"The Copilot CLI's index.js is a large minified file containing hardcoded arrays of allowed models. This fork's patcher locates and modifies two of these arrays:
- A simple name array:
// Variable name changes between versions (e.g., Yv, Ef) Yv=["claude-sonnet-4.5","claude-sonnet-4",...]
- An object array with labels:
// Variable name also changes (e.g., Dwe) Dwe=[{model:"claude-sonnet-4.5",label:"Claude Sonnet 4.5"},...]
The unlocker auto-detects the variable names and safely appends your desired models to both lists, ensuring full functionality. A timestamped backup is always created before any changes are made.
If a future Copilot CLI update breaks the unlocker, you'll need to find the new patterns for both arrays or wait for update of Copilot-CLI-Unlocker.
- Locate the arrays by searching the
index.jsfile for known model names like"claude-sonnet"or"gpt-5". - Find the variable names they are assigned to (the characters before the
=). - Update the search patterns in the script. Both
.shand.ps1scripts have clearly marked regex patterns that can be adjusted. Always test your changes with--dry-runor-DryRun.
Copilot-CLI-Unlocker/
βββ patch-models.sh # Unlocker for Linux, macOS, and WSL
βββ patch-models.ps1 # Unlocker for Windows PowerShell
βββ README.md # This file
The file structure has likely changed in a new Copilot CLI update. Check the branches of this repository for a version compatible with your CLI version. If one doesn't exist, you may need to follow the "Adapting for Future Updates" section.
This can happen if the file is write-protected or if the script's patterns no longer match. The script should automatically restore from backup.
- Verify the patch was applied by searching for one of your added models inside the
index.jsfile. - Double-check your
~/.copilot/config.jsonfor correct spelling and syntax. The model name is case-sensitive and must be an exact match. - Check any updates of Copilot CLI or Copilot-CLI-Unlocker
- Check your configuration at https://github.com/settings/copilot/features
- Create Issue in this repo
This project uses GitHub Actions for Continuous Integration (CI) to ensure that both patcher scripts (.sh and .ps1) work correctly across multiple operating systems. Every change pushed to the repository is automatically tested on:
- Linux (Ubuntu)
- macOS
- Windows
This automated process verifies that the scripts can correctly locate the Copilot CLI installation and prepare the patch without errors, giving users confidence in the tool's reliability with every update. You can view the latest test results here.
This project has been greatly improved by the contributions of the community. A special thanks to the following individuals:
- @agileandy - For creating the original
copilot-cli-free-modelsproject, which served as the foundation for this fork. - @ebrindley - For contributing critical fixes for macOS compatibility and resolving JavaScript syntax errors (PR #6).
We also thank everyone who reports issues, suggests features, and helps make this tool better.
For issues with:
- This patcher: Check the troubleshooting section above
- Copilot CLI itself: Contact GitHub Support
- Model availability: Check with your GitHub organization's settings
This is a utility script for personal use. The GitHub Copilot CLI itself is proprietary software from GitHub.

