Skip to content

Latest commit

 

History

46 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

passenger-rs - open webui proxy to github copilot

CI License: GPL v3 Rust

A Rust proxy server that exposes GitHub Copilot models through a streaming OpenAI-compatible API.

Only streaming responses are supported. All requests must include "stream": true.

Use Case

passenger-rs is primarily designed to let web UIs such as Open WebUI talk to models available through your GitHub Copilot subscription.

Open WebUI (and similar tools) expect an OpenAI-compatible API endpoint. GitHub Copilot does not expose one natively. passenger-rs sits between the two: it accepts standard OpenAI streaming requests from the web UI, forwards them to the Copilot API using your personal token, and translates the response back into the format the UI expects.

Open WebUI  ──►  passenger-rs (127.0.0.1:8081)  ──►  api.githubcopilot.com
             OpenAI API                            Copilot API

Point your web UI at http://127.0.0.1:8081/v1 with any API key (the value is ignored) and all Copilot models that are enabled in your account will appear in the model picker.

Open WebUI setup

In Open WebUI, go to Settings → Connections and add http://127.0.0.1:8081/v1 as an OpenAI API connection:

Open WebUI Connections settings showing http://127.0.0.1:8081/v1 enabled

Click the gear icon next to the connection to confirm the settings. No authentication is required:

Open WebUI Edit Connection dialog with URL http://127.0.0.1:8081/v1 and Auth set to None

Quick Start

1. Download or build

# From source
git clone https://github.com/grumlimited/passenger-rs.git
cd passenger-rs
cargo build --release

Or download a pre-built binary from the releases page.

2. Authenticate with GitHub

./passenger-rs --login

This will:

  1. Display a GitHub device code and URL
  2. Open your browser to https://github.com/login/device
  3. After authorization, save tokens to ~/.config/passenger-rs/

3. Start the proxy server

./passenger-rs

The server starts on http://127.0.0.1:8081 by default.

4. Test the connection

curl http://127.0.0.1:8081/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello"}],
    "stream": true
  }'

API Endpoints

POST /v1/chat/completions

OpenAI-compatible streaming chat completions. Requires "stream": true.

Routes to Copilot /responses for gpt-5+ models (excluding gpt-5-mini), and to Copilot /chat/completions for all other models.

Example request:

{
  "model": "gpt-4o",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  "stream": true
}

Response is a text/event-stream of ChatCompletionChunk SSE events.

POST /v1/responses

OpenAI Responses API streaming endpoint. Requires "stream": true.

The Copilot Responses SSE format is identical to the OpenAI Responses SSE format — the stream is passed through byte-for-byte.

GET /v1/models

Lists available models from the GitHub Copilot model catalog in OpenAI format.

GET /health

Returns 200 OK with body OK.

Installation

System Requirements

  • Rust 1.70 or later
  • Active GitHub Copilot subscription

System Service (Linux)

Pre-built packages for Ubuntu and Arch Linux are available on the releases page.

# Arch Linux
yay -U passenger-rs-0.0.1-1-x86_64.pkg.tar.zst

# Ubuntu/Debian
sudo dpkg -i passenger-rs-0.0.1-x86_64.deb

Manage with systemd:

systemctl --user start passenger-rs.service
systemctl --user enable passenger-rs.service
systemctl --user status passenger-rs.service

Note: Before starting the service, authenticate with --login.

Configuration

Edit config.toml:

[github]
device_code_url = "https://github.com/login/device/code"
oauth_token_url = "https://github.com/login/oauth/access_token"
copilot_token_url = "https://api.github.com/copilot_internal/v2/token"
copilot_models_url = "https://models.github.ai/catalog/models"
client_id = "Iv1.b507a08c87ecfe98"

[copilot]
api_base_url = "https://api.githubcopilot.com"

[server]
port = 8081
host = "127.0.0.1"

CLI Reference

passenger-rs - GitHub Copilot streaming proxy (OpenAI-compatible)

Usage: passenger-rs [OPTIONS]

Options:
  -c, --config <CONFIG>
          Path to the configuration file [default: config.toml]

      --login
          Perform GitHub OAuth device flow login

      --refresh-token
          Refresh Copilot token using existing access token

      --access-token-path <ACCESS_TOKEN_PATH>
          Path to the access token file
          [default: ~/.config/passenger-rs/access_token.json]

      --copilot-token-path <COPILOT_TOKEN_PATH>
          Path to the Copilot token file
          [default: ~/.config/passenger-rs/token.json]

  -h, --help
          Print help information

  -V, --version
          Print version information

Token Management

Tokens are stored in ~/.config/passenger-rs/:

  • Access Token (access_token.json): Long-lived, used to obtain Copilot tokens
  • Copilot Token (token.json): Short-lived (~25 minutes), auto-refreshed 60 seconds before expiry

Custom paths:

./passenger-rs --login \
  --access-token-path /custom/path/access_token.json \
  --copilot-token-path /custom/path/copilot_token.json

Development

cargo build          # debug build
cargo build --release
cargo test
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt

Troubleshooting

"No authentication token found"

./passenger-rs --login

"Only streaming is supported"

Add "stream": true to your request body.

"Address already in use"

Change port in config.toml, or kill the process using port 8081:

lsof -ti:8081 | xargs kill -9

Enable debug logging

RUST_LOG=debug ./passenger-rs

License

GPL-3.0 — see LICENSE.

Acknowledgments

Disclaimer

Ensure you comply with GitHub's Terms of Service and Copilot's usage policies.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages