minosvasilias / godot-copilot

AI-assisted development for the Godot engine.
MIT License
225 stars 17 forks source link

Github copilot token, instead of OpenAI #7

Closed Khalilbz closed 7 months ago

Khalilbz commented 8 months ago

I'm paying a GitHub copilot subscription, so if it doesn't take much time for you please add the possibility to use the GHU (GitHub copilot token) instead of open AI, since it doesn't charge per token, but on a monthly based charging.

Get GitHub Copilot Token

Install github-copilot-cli:

# https://www.npmjs.com/package/@githubnext/github-copilot-cli
npm i @githubnext/github-copilot-cli -g

Retrieve the token:

github-copilot-cli auth

View the token:

vim ~/.copilot-cli-access-token
minosvasilias commented 7 months ago

Hey! Sorry for the delayed response to this.

I'll experiment with this over the next days/this weekend and add it if functional. Thanks for raising, i wasn't aware you could extract the copilot auth token like that.

minosvasilias commented 7 months ago

An update on this: I've got the requests to the copilot completions endpoint working, mirroring the authentication and headers implemented in https://github.com/aaamoon/copilot-gpt4-service. So this is indeed possible.

But to decrease the likelihood of account bans i'll also need to implement some caching behavior for machine and session IDs, and there will need to be a clear indication that using this method runs the risk of bans in the first place. Tbh i'm not loving the fact i'm running that risk myself, so i wouldn't want to use this personally.

But aiming to finish this up when i have time.

Khalilbz commented 7 months ago

I couldn't believe you did it bro, That would be so nice, specially knowing that the API is created specially for code completion, I'm waiting for the update, please mention it in the docs <3 <3

minosvasilias commented 7 months ago

Resolved in #9. Thanks for the the recommendation, let me know if you encounter any issues!