copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Ability to use Free Models (0x credits) in Copilot CLI

Open zazendev9900 opened this issue 3 months ago • 38 comments

Describe the feature or problem you'd like to solve

The Copilot CLI uses Sonnet 4 by default which incurs 1x cost / message.

Proposed solution

In the Copilot CLI, I wish we could select from a list of free models provided by GitHub Copilot eg. GPT-4.1, GPT-4o, GPT-5 mini, Grok Code Fast 1 etc. This would let us optimize our monthly quota. Thank you for considering.

Image

Example prompts or workflows

No response

Additional context

No response

zazendev9900 avatar Sep 26 '25 00:09 zazendev9900

+1'd. This is definitely the reason I'm not using the cli for now. Sometimes I ask some very simple questions and I wouldn't want to use a premium request for that!

harrychan108 avatar Sep 30 '25 15:09 harrychan108

+1. Support adding free models rather than wasting premium request credits on simple tasks. This is crucial for our long-term use of Copilot CLI.

YumeYuka avatar Oct 01 '25 16:10 YumeYuka

This is indeed very necessary for me to use the cli viably. I feel vscode has the best gh copilot experience right now but much of that should be ported to the cli, starting with more model availability

SilverMarcs avatar Oct 01 '25 17:10 SilverMarcs

+1 , some task maybe just want to read, but wasting the premium

JuniYadi avatar Oct 02 '25 12:10 JuniYadi

+1 maybe I can replace codecompanion.nvim with sidekick.nvim that use Copilot CLI.

crivotz avatar Oct 03 '25 06:10 crivotz

+1

halimsamy avatar Oct 06 '25 11:10 halimsamy

+1

prabhu-mannu avatar Oct 06 '25 12:10 prabhu-mannu

👍

This really should be prioritized to include at least one 0x multiplier model, and set it as the default.

kutsal-dpz avatar Oct 06 '25 16:10 kutsal-dpz

+1

joecklau avatar Oct 07 '25 01:10 joecklau

Max priority👍🏻

crivotz avatar Oct 07 '25 09:10 crivotz

this should be a priority, the tool currently forces the use of expensive models for very simple tasks.

ProvenPi avatar Oct 07 '25 13:10 ProvenPi

+1

Ton-Git avatar Oct 08 '25 20:10 Ton-Git

Yes please!

benstaniford avatar Oct 09 '25 10:10 benstaniford

+1

duquejo avatar Oct 10 '25 02:10 duquejo

Since it's using public API I believe you can achieve that by changing @github\copilot\index.js

There's a line

=["claude-sonnet-4.5","claude-sonnet-4","gpt-5"];

That can be replaced with:

=["gpt-4o","gpt-5","gpt-5-mini","grok-code-fast-1","o3-mini","o1","claude-3.5-sonnet","claude-3.7-sonnet","claude-3.7-sonnet-thought","claude-sonnet-4","claude-sonnet-4.5","gemini-2.0-flash-001","gemini-2.5-pro","gpt-4.1","o4-mini"];

Then go to your .copilot/config.json and a model of your choice:

{
  "banner": "never",
  "model": "grok-code-fast-1",
  "render_markdown": true,
  "screen_reader": false,
  "theme": "auto"
}

meregoodsamaritan avatar Oct 10 '25 05:10 meregoodsamaritan

Since it's using public API I believe you can achieve that by changing @github\copilot\index.js

There's a line

var Nk=["claude-sonnet-4.5","claude-sonnet-4","gpt-5"]; That can be replaced with:

var Nk=["gpt-4o","gpt-5","gpt-5-mini","grok-code-fast-1","o3-mini","o1","claude-3.5-sonnet","claude-3.7-sonnet","claude-3.7-sonnet-thought","claude-sonnet-4","claude-sonnet-4.5","gemini-2.0-flash-001","gemini-2.5-pro","gpt-4.1","o4-mini"]; Then go to your .copilot/config.json and a model of your choice:

{
  "banner": "never",
  "model": "grok-code-fast-1",
  "render_markdown": true,
  "screen_reader": false,
  "theme": "auto"
}

This is a hack man

tikazyq avatar Oct 10 '25 07:10 tikazyq

Confirmed this works, but will probably break next time you update

agileandy avatar Oct 10 '25 07:10 agileandy

Since it's using public API I believe you can achieve that by changing @github\copilot\index.js

There's a line

var Nk=["claude-sonnet-4.5","claude-sonnet-4","gpt-5"]; That can be replaced with:

var Nk=["gpt-4o","gpt-5","gpt-5-mini","grok-code-fast-1","o3-mini","o1","claude-3.5-sonnet","claude-3.7-sonnet","claude-3.7-sonnet-thought","claude-sonnet-4","claude-sonnet-4.5","gemini-2.0-flash-001","gemini-2.5-pro","gpt-4.1","o4-mini"]; Then go to your .copilot/config.json and a model of your choice:

{
  "banner": "never",
  "model": "grok-code-fast-1",
  "render_markdown": true,
  "screen_reader": false,
  "theme": "auto"
}

Cool, we can create a PR

crivotz avatar Oct 10 '25 07:10 crivotz

Following up the workaround from @meregoodsamaritan , I'm pasting here the convenient bash command:

sed -i.bak 's/var Nk=\["claude-sonnet-4\.5","claude-sonnet-4","gpt-5"\];/var
   Nk=["gpt-4o","gpt-5","gpt-5-mini","grok-code-fast-1","o3-mini","o1","claude-3.5-sonnet","claude-3.7-sonnet","claude-3.7-sonnet-thought","claude-sonnet-4","claude-sonnet-4.5","gemini-2.0-flash-001","gemini-2.5-pro","gpt-4.1","o4-mini"];/'
   <global_node_modules>/@github/copilot/index.js

Or, you can simply ask GitHub Copilot CLI to do it for you:

  1. start copilot
  2. copy the content from @meregoodsamaritan above, and enter
  3. set the environment variable COPILOT_MODEL: COPILOT_MODEL=grok-code-fast-1 copilot

Everything working fine on 0.0.338 but it'll definitely change in the later release.

Great job @meregoodsamaritan !

tikazyq avatar Oct 10 '25 07:10 tikazyq

Cool, we can create a PR

It seems typescript code for copilot-cli is not publicly available, they seem to release just compiled .js, and this repo is just for gathering issues.


Any ideas what's the reliable source for all available models for copilot, to include them all? In VS Code there's also Copilot SWE that has 0x - but I'm not sure what is its code name (copilot-swe?).

meregoodsamaritan avatar Oct 10 '25 07:10 meregoodsamaritan

Since it's using public API I believe you can achieve that by changing @github\copilot\index.js

There's a line

var Nk=["claude-sonnet-4.5","claude-sonnet-4","gpt-5"];

That can be replaced with:

var Nk=["gpt-4o","gpt-5","gpt-5-mini","grok-code-fast-1","o3-mini","o1","claude-3.5-sonnet","claude-3.7-sonnet","claude-3.7-sonnet-thought","claude-sonnet-4","claude-sonnet-4.5","gemini-2.0-flash-001","gemini-2.5-pro","gpt-4.1","o4-mini"];

Then go to your .copilot/config.json and a model of your choice:

{
  "banner": "never",
  "model": "grok-code-fast-1",
  "render_markdown": true,
  "screen_reader": false,
  "theme": "auto"
}

for me it seems like it was var Ek instead of var Nk, so it does seem to change (possibly with every version update)

JourneyOver avatar Oct 11 '25 05:10 JourneyOver

for me it seems like it was var Ek instead of var Nk, so it does seem to change (possibly with every version update)

Yeah, copilot updated today. I've removed var Nk= part from the message, since it should be unique match either way.

Any ideas what's the reliable source for all available models for copilot, to include them all?

Found it - there's models.json with full info about existing models. There are some additional models, but it seems they're either outdated or not for chat.

api url - https://api.individual.githubcopilot.com/models (requires access token) models.json - https://pastebin.com/VdVUfFsm

meregoodsamaritan avatar Oct 11 '25 07:10 meregoodsamaritan

A feature request with many upvotes and very easy to do, and they won't do it? Classic case of conflict in their business model.

Even if they did add 0x models, I can guarantee it will be rate limited to hell.

russeg avatar Oct 11 '25 09:10 russeg

A feature request with many upvotes and very easy to do, and they won't do it? Classic case of conflict in their business model.

Even if they did add 0x models, I can guarantee it will be rate limited to hell.

Maybe they're keeping it to announce it to the universe.

crivotz avatar Oct 14 '25 15:10 crivotz

+1

jwlv avatar Oct 15 '25 14:10 jwlv

Here's what I got working on fish shell which ignores the changing var

sudo sed -i.bak -E 's/(var [A-Za-z0-9_]+=)\["claude-sonnet-4\.5","claude-sonnet-4","gpt-5"\];/\1["gpt-4o","gpt-5","gpt-5-mini","grok-code-fast-1","o3-mini","o1","claude-3.5-sonnet","claude-3.7-sonnet","claude-3.7-sonnet-thought","claude-sonnet-4","claude-sonnet-4.5","gemini-2.0-flash-001","gemini-2.5-pro","gpt-4.1","o4-mini"];/g' /usr/lib/node_modules/@github/copilot/index.js

silentjay avatar Oct 15 '25 23:10 silentjay

Image

I need it badly... I'm disappearing soon!

litoxy avatar Oct 16 '25 06:10 litoxy

+1

jgreys avatar Oct 16 '25 10:10 jgreys

Has anyone got any of the free models working successfully with this workaround? I've tried Grok Code Fast 1 so far and I get a load of errors when it tries to use the built in copilot-cli tools such as read_bash and str_replace_editor, it doesn't seem to know the correct parameters to run them. Other tools such as read_file work fine. Any free models actually work out the box or any workarounds for them?

str_replace_editor: edit the file at core/models/models.py.
   Invalid inputs: old_str is required for str_replace

str_replace_editor: edit the file at core/models/models.py.
   Missing required arguments for command insert: insert_line and new_str

silentjay avatar Oct 16 '25 12:10 silentjay

It's very hit or miss with them working from what I can tell, I ended up switching over to opencode and just use my copilot through it instead and it seems to work better and I don't have to deal with workarounds.

JourneyOver avatar Oct 16 '25 13:10 JourneyOver