| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This project provides a reverse proxy for GitHub Copilot, exposing OpenAI-compatible endpoints for use with tools and clients that expect the OpenAI API. It follows the authentication and token management approach used by OpenCode.
❗ IMPORTANT: Vision/Image capability is not available on all GitHub Copilot accounts!
- Even if your account supports GPT-4o, vision features may not be enabled for your Copilot subscription.
- Some orgs and accounts do not have access to vision/image generation/analysis, or may have different levels of support than OpenAI direct accounts.
- This proxy supports vision for Copilot accounts if your Copilot subscription supports it. If your account does not, you will receive a relevant error from the upstream API.
- For latest details, check your Copilot subscription or contact GitHub support for your organization/account.
Pre-built binaries are available for each release on the Releases page.
Available platforms:
Docker images are automatically built and published to GitHub Container Registry via GitHub Actions:
# Pull the latest image
docker pull ghcr.io/privapps/github-copilot-svcs:latest
# Pull a specific version (example)
docker pull ghcr.io/privapps/github-copilot-svcs:0.0.2Available architectures:
Releases are automatically created when code is merged to the main branch:
This service includes enterprise-grade performance optimizations:
If you have make installed, you can build, run, and test the project easily:
make build # Build the binary
make run # Start the proxy server
make test # Run unit tests
make test-all # Run all tests
make test-coverage # Generate coverage report
make clean # Remove the binary
make lint # Run linting
make fmt # Format code
make vet # Run go vet
make security # Run security analysis
make docker-build # Build Docker image
make docker-run # Run Docker containerYou can control which models are available by specifying allowed_models in your config file (config.json).
Example:
{
"allowed_models": ["gpt-4o", "claude-3.7-sonnet"]
}You can build binaries for different platforms using the following Makefile targets:
The output binaries will be named accordingly (e.g., github-copilot-svcs-windows-arm64.exe).
make build
# or manually:
go build -o github-copilot-svcs# Copy example config and customize timeout values
cp config.example.json ~/.local/share/github-copilot-svcs/config.json
# Edit the timeouts section as needed./github-copilot-svcs authmake run
# or manually:
./github-copilot-svcs rundocker run --rm \ -p 8081:8081 \ -v ~/.local/share/github-copilot-svcs:/home/appuser/.local/share/github-copilot-svcs \ ghcr.io/privapps/github-copilot-svcs:latest
| Command | Description |
|---|---|
| run | Run the proxy server (default command) |
| auth | Authenticate with GitHub Copilot using device flow |
| status | Show detailed authentication and token status |
| config | Display current configuration details |
| models | List all available AI models |
| refresh | Manually force token refresh |
| version | Show version information |
| help | Show usage information |
The status command now provides detailed token information with optional JSON output:
./github-copilot-svcs status
./github-copilot-svcs status --json # JSON format outputExample output:
Configuration file: ~/.local/share/github-copilot-svcs/config.json Port: 8081 Authentication: ✓ Authenticated Token expires: in 29m 53s (1793 seconds) Status: ✅ Token is healthy Has GitHub token: true Refresh interval: 1500 seconds
Status indicators:
Once running, the proxy exposes these OpenAI-compatible endpoints:
POST http://localhost:8081/v1/chat/completions
Content-Type: application/json
{
"model": "gpt-4.1",
"messages": [
{"role": "user", "content": "Hello, world!"}
],
"max_tokens": 100
}For GPT-5.x models (nano, mini, codex variants):
POST http://localhost:8081/v1/responses
Content-Type: application/json
{
"model": "gpt-5.6-luna",
"input": "Hello, world!",
"max_output_tokens": 100
}GET http://localhost:8081/v1/modelsGET http://localhost:8081/healthGET http://localhost:8081/debug/pprof/ # Overview of available profiles
GET http://localhost:8081/debug/pprof/heap # Memory heap profile
GET http://localhost:8081/debug/pprof/goroutine # Goroutine profile
GET http://localhost:8081/debug/pprof/profile # CPU profile (30s sampling)
GET http://localhost:8081/debug/pprof/trace # Execution traceThe proxy implements proactive token management to minimize authentication interruptions:
Chat completion requests are automatically retried to handle transient failures:
# Manual token refresh if needed
./github-copilot-svcs refresh
# Check current token status
./github-copilot-svcs status
# Re-authenticate if all else fails
./github-copilot-svcs authThe configuration is stored in ~/.local/share/github-copilot-svcs/config.json:
{
"port": 8081,
"github_token": "gho_...",
"copilot_token": "ghu_...",
"expires_at": 1720000000,
"refresh_in": 1500,
"headers": {
"user_agent": "GitHubCopilotChat/0.29.1",
"editor_version": "vscode/1.102.3",
"editor_plugin_version": "copilot-chat/0.29.1",
"copilot_integration_id": "vscode-chat",
"openai_intent": "conversation-edits",
"x_initiator": "user"
},
"timeouts": {
"http_client": 300,
"server_read": 30,
"server_write": 300,
"server_idle": 120,
"proxy_context": 300,
"circuit_breaker": 30,
"keep_alive": 30,
"tls_handshake": 10,
"dial_timeout": 10,
"idle_conn_timeout": 90
}
}The headers section allows you to customize the HTTP headers sent to the Copilot API. All fields are optional; defaults are shown below:
| Field | Default Value | Description |
|---|---|---|
| user_agent | GitHubCopilotChat/0.29.1 | User-Agent header for all requests |
| editor_version | vscode/1.102.3 | Editor-Version header |
| editor_plugin_version | copilot-chat/0.29.1 | Editor-Plugin-Version header |
| copilot_integration_id | vscode-chat | Copilot-Integration-Id header |
| openai_intent | conversation-edits | Openai-Intent header |
| x_initiator | user | X-Initiator header |
You can override any of these by editing your config.json.
All timeout values are specified in seconds and have sensible defaults:
| Field | Default | Description |
|---|---|---|
| http_client | 300 | HTTP client timeout for outbound requests to GitHub Copilot API |
| server_read | 30 | Server timeout for reading incoming requests |
| server_write | 300 | Server timeout for writing responses (increased for streaming) |
| server_idle | 120 | Server timeout for idle connections |
| proxy_context | 300 | Request context timeout for proxy operations |
| circuit_breaker | 30 | Circuit breaker recovery timeout when API is failing |
| keep_alive | 30 | TCP keep-alive timeout for HTTP connections |
| tls_handshake | 10 | TLS handshake timeout |
| dial_timeout | 10 | Connection dial timeout |
| idle_conn_timeout | 90 | Idle connection timeout in connection pool |
Streaming Support: The service is optimized for long-running streaming chat completions with timeouts up to 300 seconds (5 minutes) to support extended AI conversations.
Custom Configuration: You can copy config.example.json as a starting point and modify timeout values based on your environment:
cp config.example.json ~/.local/share/github-copilot-svcs/config.json
# Edit the timeouts section as neededThe authentication follows GitHub Copilot's OAuth device flow:
The proxy automatically maps common model names to GitHub Copilot models. Each model has an api_type field indicating which endpoint to use:
| Model | Provider |
|---|---|
| gpt-4o, gpt-4.1 | OpenAI |
| claude-haiku-4.5, claude-sonnet-5, claude-opus-4.8 | Anthropic |
| gemini-3.5-flash, gemini-3.1-pro-preview |
| Model | Provider |
|---|---|
| gpt-5.3-codex, gpt-5.4-mini | OpenAI |
| gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra | OpenAI |
Note: Use the /v1/models endpoint to see all available models and their api_type field to determine which endpoint to use.
# Re-authenticate
./github-copilot-svcs auth
# Check current status
./github-copilot-svcs status# Check if service is running
curl http://localhost:8081/health
# List available models with api_type field
curl http://localhost:8081/v1/models
# Test chat completions
curl -X POST http://localhost:8081/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4.1","messages":[{"role":"user","content":"hi"}]}'
# Test responses API
curl -X POST http://localhost:8081/v1/responses \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.6-luna","input":"hi","max_output_tokens":20}'# Use a different port
# Edit ~/.local/share/github-copilot-svcs/config.json
# Or delete config file and restart to select new port# Chat Completions (for GPT-4.x, Claude, Gemini models)
curl -X POST http://localhost:8081/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"messages": [{"role": "user", "content": "Write a hello world in Python"}],
"max_tokens": 100
}'
# Responses API (for GPT-5.x nano/mini/codex models)
curl -X POST http://localhost:8081/v1/responses \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-luna",
"input": "Write a hello world in Python",
"max_output_tokens": 100
}'The proxy fully supports vision capabilities with base64-encoded images in OpenAI-compatible format:
# Example with base64-encoded image
curl -X POST http://localhost:8081/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,/9j/4AAQ..."}}
]
}],
"max_tokens": 300
}'Vision Features:
Example Script: The repository includes test_vision_proxy.sh that demonstrates vision capabilities:
./test_vision_proxy.sh dog.jpeg "Describe this image in detail"import openai
# Point OpenAI client to the proxy
client = openai.OpenAI(
base_url="http://localhost:8081/v1",
api_key="dummy" # Not used, but required by client
)
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello, world!"}]
)
print(response.choices[0].message.content)from langchain.llms import OpenAI
llm = OpenAI(
openai_api_base="http://localhost:8081/v1",
openai_api_key="dummy" # Not used
)
response = llm("Write a hello world in Python")
print(response)To use this proxy with Codex CLI, add a model provider configuration to your Codex config file (e.g., ~/.codex/config.toml):
model = "gpt-5.6-terra"
model_provider = "local-ghcp"
model_reasoning_effort = "medium"
[model_providers.local-ghcp]
name = "local-ghcp"
base_url = "http://localhost:8081/v1"
wire_api = "responses"
experimental_bearer_token = "sk-local"
requires_openai_auth = false
supports_websockets = falseThis configures Codex to use the proxy's Responses API endpoint (/v1/responses) for GPT-5.x models. The wire_api = "responses" setting ensures Codex uses the correct transport.
git clone <repository>
cd github-copilot-svcs
make build
# or manually:
go mod tidy
go build -o github-copilot-svcs ./cmd/github-copilot-svcsmake test # Run unit tests
make test-all # Run all tests (unit + integration)
make test-coverage # Run tests with coverage report
# or manually:
go test ./test/...The project includes comprehensive test coverage:
Generate coverage reports:
make test-coverage # Generates coverage.html and shows terminal summaryCurrent test coverage: ~45% across all packages, with excellent coverage in core components like logging (95%+) and configuration (58%+).
Apache License 2.0 - see LICENSE file for details.
This is free software: you are free to change and redistribute it under the terms of the Apache 2.0 license.
We welcome contributions! Please follow these guidelines:
Q: Authentication fails or times out A: Run ./github-copilot-svcs auth again and check your network connection. Ensure your GitHub account has Copilot access.
Q: Service won't start or port is in use A: Edit your config file to use a different port, or stop the conflicting service.
Q: Token expires too quickly A: Check your system clock and ensure the refresh interval in config is set correctly.
Q: How do I update configuration? A: Edit ~/.local/share/github-copilot-svcs/config.json or use environment variables if supported.
Q: How do I report a bug or request a feature? A: Open an issue on GitHub with details about your environment and the problem.
For issues and questions:
| Back | FazBrowse Home | New Git URL |