Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jjleng/copilot-more: $10/month GPT-4o and Claude-3.5-Sonnet APIs for coding and beyond. #962

Open
1 task
ShellLM opened this issue Dec 23, 2024 · 1 comment
Labels
AI-Agents Autonomous AI agents using LLMs AI-Chatbots Topics related to advanced chatbot platforms integrating multiple AI models ai-platform model hosts and APIs code-generation code generation models and tools like copilot and aider github gh tools like cli, Actions, Issues, Pages Models LLM and ML model repos and links openai OpenAI APIs, LLMs, Recipes and Evals Software2.0 Software development driven by AI and neural networks.

Comments

@ShellLM
Copy link
Collaborator

ShellLM commented Dec 23, 2024

jjleng/copilot-more: $10/month GPT-4o and Claude-3.5-Sonnet APIs for coding and beyond.

Snippet

"copilot-more

copilot-more maximizes the value of your GitHub Copilot subscription by exposing models like gpt-4o and Claude-3.5-Sonnet for use in agentic coding tools such as Cline, or any tool that supports bring-your-own-model setups. Unlike costly pay-as-you-go APIs, this approach lets you leverage these powerful models affordably. (Yes, $10 per month maximum.)

The exposed models aren't limited to coding tasks—you can connect any AI client and customize parameters like temperature, context window length, and more.

Ethical Use

  • Respect the GitHub Copilot terms of service.
  • Minimize the use of the models for non-coding purposes.
  • Be mindful of the risk of being banned by GitHub Copilot for misuse.

🏃‍♂️ How to Run

Get the refresh token

A refresh token is used to get the access token. This token should never be shared with anyone :). You can get the refresh token by following the steps below:

  1. Run the following command and note down the returned device_code and user_code:
    # 01ab8ac9400c4e429b23 is the client_id for the VS Code
    curl https://github.com/login/device/code -X POST -d 'client_id=01ab8ac9400c4e429b23&scope=user:email'
    
  2. Open https://github.com/login/device/ and enter the user_code.
  3. Replace YOUR_DEVICE_CODE with the device_code obtained earlier and run:
    curl https://github.com/login/oauth/access_token -X POST -d 'client_id=01ab8ac9400c4e429b23&scope=user:email&device_code=YOUR_DEVICE_CODE&grant_type=urn:ietf:params:oauth:grant-type:device_code'
    
  4. Note down the access_token starting with gho_.

Install and run copilot_more

  1. git clone https://github.com/jjleng/copilot-more.git
  2. cd copilot-more
  3. # install dependencies
  4. poetry install
  5. # run the server. Replace gho_xxxxx with the refresh token you got in the previous step. Note, you can use any port number you want.
  6. REFRESH_TOKEN=gho_xxxxx poetry run uvicorn copilot_more.server:app --port 15432

✨ Magic Time

Now you can connect Cline or any other AI client to http://localhost:15432 and start coding with the power of GPT-4o and Claude-3.5-Sonnet without worrying about the cost. Note, the copilot-more manages the access token, you can use whatever string as API keys if Cline or the AI tools ask for one.

🤔 Limitation

The GH Copilot models sit behind an API server that is not fully compatible with the OpenAI API. You cannot pass in a message like this:

{
  "role": "user",
  "content": [
    {
      "type": "text",
      "text": "<task>\nreview the code\n</task>"
    },
    {
      "type": "text",
      "text": "<task>\nreview the code carefully\n</task>"
    }
  ]
}

copilot-more takes care of this limitation by converting the message to a format that the GH Copilot API understands. However, without the type, we cannot leverage the models' vision capabilities, so that you cannot do screenshot analysis.

Suggested labels

None

@ShellLM ShellLM added AI-Agents Autonomous AI agents using LLMs AI-Chatbots Topics related to advanced chatbot platforms integrating multiple AI models ai-platform model hosts and APIs code-generation code generation models and tools like copilot and aider github gh tools like cli, Actions, Issues, Pages Models LLM and ML model repos and links openai OpenAI APIs, LLMs, Recipes and Evals Software2.0 Software development driven by AI and neural networks. labels Dec 23, 2024
@ShellLM
Copy link
Collaborator Author

ShellLM commented Dec 23, 2024

Related content

#950 similarity score: 0.9
#761 similarity score: 0.89
#707 similarity score: 0.88
#396 similarity score: 0.88
#743 similarity score: 0.88
#877 similarity score: 0.88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI-Agents Autonomous AI agents using LLMs AI-Chatbots Topics related to advanced chatbot platforms integrating multiple AI models ai-platform model hosts and APIs code-generation code generation models and tools like copilot and aider github gh tools like cli, Actions, Issues, Pages Models LLM and ML model repos and links openai OpenAI APIs, LLMs, Recipes and Evals Software2.0 Software development driven by AI and neural networks.
Projects
None yet
Development

No branches or pull requests

1 participant