GitHub Copilot provider for RubyLLM.
Uses the undocumented OpenAI-compatible Copilot API with OAuth Device Code Flow authentication. No API key needed -- just authorize with your GitHub account.
gem 'ruby_llm-github_copilot'require 'ruby_llm-github_copilot'
chat = RubyLLM.chat(model: 'gpt-4o', provider: :github_copilot)
response = chat.ask("Hello!")
puts response.contentOn first use, you'll be prompted to visit a URL and enter a code to authorize. Tokens are cached to ~/.config/ruby_llm/github_copilot/ so you only need to do this once.
RubyLLM.configure do |config|
# Override the default token cache directory
config.github_copilot_token_dir = '/path/to/tokens'
endchat.ask("Tell me a story") { |chunk| print chunk.content }The provider includes ~30 models: GPT-3.5, GPT-4, GPT-4o, GPT-4.1, GPT-5, Claude (Haiku, Sonnet, Opus), Gemini, and embedding models. All pricing is zero (included in your Copilot subscription).
- Ruby >= 3.1.3
ruby_llm~> 1.14- A GitHub account with Copilot access
MIT