Support for using GH Copilot API
Wondering how hard it would be to add support for APIs used by GH Copilot. This helps us make use of Copilot subscription with other Emacs llm frontends. chep/copilot-chat.el does make use of this if you need a reference. With the somewhat recent addition of 3.5 Sonnet, it seems like a solid option. Roo Code seems to have done something similar recently and got a good reception(from what I saw on Reddit).
Is https://github.com/ahyatt/llm/pull/113 what you are looking for? This is fairly close to finished right now.
GitHub models is different. It is a separate model inference API provided by GH and is not related to the Copilot subscription. Also, it does not provide access to Sonnet and has shorter context window limits for most models AFAICT.
Thanks for the clarification. I looked around, and it doesn't look like there are docs for the API available. That doesn't mean it's not possible, but I'd have to separately reverse-engineer it, which will take some time. Because the llm package is FSF licensed, I can't just go off someone else's code.
That probably isn't something I'm going to have time for, but if there's anyone that does have FSF paperwork done, and does want to take this on, I think it'd be a reasonable thing to add. However, the lack of an API docs may mean that Github intends to make breaking changes, which is a risk factor here.
Because the llm package is FSF licensed, I can't just go off someone else's code.
The chep/copilot-chat package mentioned above is MIT licensed, and MIT license is considered as an FSF compatible, meaning it can be used, bundled and distributed together with GPL code.
You are right, it may be that their API will change, but I doubt that the pace of change should be big, since there are already a lot of plugins that would break in that case.
Having support for GH Copilot would be really nice, since GH is, to my knowledge, the only AI tool that can be used free of cost for the maintainers of Open-Source projects.
Thanks for the clarification. I'll look into this; a lot will depend on how easy it is for me to test this. I have a Github Copilot account, but whether that lets me use this functionality I don't know.
This interesting to me as well since they recently started to provide a free contingent. I use LLMs sparingly and maybe that would be enough for my usage. Currently I use the ChatGPT API and charged it with 15$ in December and still haven't used all of it.
I use LLMs sparingly and maybe that would be enough for my usage.
If you only use it sparingly and don't care about sonnet, GitHub models in https://github.com/ahyatt/llm/pull/113 should be good enough. It has a pretty generous free tier.
@Nebucatnetzer
Ah I didn’t know we could use those for free as well. Thank you for letting me know.
FYI, gptel now does support copilot. Ref: https://github.com/karthink/gptel/blob/master/gptel-gh.el
Thanks for the info. I'll take a look at this again soon (also, if someone with FSF paperwork wanted to make a contribution, that of course would be welcome).
I took a look at this a few weeks ago, and how to get authentication working is pretty undocumented. While I could copy what happens in gptel, because this is FSF code, the FSF can't just copy non-FSF-copyrighted code without an assignment (I think).
What could happen, though, is that we could copy it and put it not under FSF copyright but under a different copyright, and make it available through Non-GNU ELPA or MELPA.
Wondering if it would be enough to get consent from the original authors of the file as well as the project maintainers to make this part of llm under a GPL license. Seems like the file was touch by 5 folks including the maintainer.
That would require them to sign the FSF paperwork, if they haven't already. It's possible! But at that point, I'd probably just ask them to sign the FSF paperwork and adapt it themselves to this library. https://github.com/kiennq is the primary author, and I think only they would be sufficient to make this happen.