npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

github-copilot-router

v1.2.2

Published

OpenAI & Anthropic compatible API router for GitHub Copilot SDK - Use Copilot with Claude Code, OpenAI Codex CLI, and more

Readme

GitHub Copilot Router

One command. No extra API keys. Just your existing GitHub Copilot plan.

Quick Start

  1. Install GitHub Copilot CLI

    # macOS/Linux
    brew install copilot-cli
    
    # Windows
    winget install GitHub.Copilot
    
    # npm (macOS, Linux, and Windows)
    npm install -g @github/copilot
    
  2. Authenticate

    copilot
    # Inside the CLI, type:
    /login
  3. Install and run

    npm install -g github-copilot-router
    
    gcr cc  # Launch Claude Code
    gcr cx  # Launch OpenAI Codex
    gcr     # Start the router server only

    The server will start at http://localhost:7318.

Tip: You can also authenticate via GITHUB_TOKEN environment variable with a PAT that has "Copilot Requests" permission.

Claude Code Integration

Claude Code can be configured to use this router as its backend, allowing you to use GitHub Copilot models through Claude Code's interface.

Quick Launch (Recommended)

The easiest way to use Claude Code with the router - no configuration needed:

gcr cc
# or: gcr claude-code

This starts the router, launches Claude Code with the correct environment variables, and cleans up when you exit. All arguments are passed through:

gcr cc --resume
gcr cc --dangerously-skip-permissions

Manual Setup

If you prefer to run the router separately:

  1. Start the router (keep it running in a terminal):

    gcr
  2. Configure Claude Code by creating/editing .claude/settings.json in your project:

    {
     "env": {
       "ANTHROPIC_BASE_URL": "http://localhost:7318",
       "ANTHROPIC_AUTH_TOKEN": "not-required",
       "ANTHROPIC_API_KEY": "",
       "ANTHROPIC_DEFAULT_HAIKU_MODEL": "github-copilot/claude-haiku-4.5",
       "ANTHROPIC_DEFAULT_SONNET_MODEL": "github-copilot/claude-sonnet-4.5",
       "ANTHROPIC_DEFAULT_OPUS_MODEL": "github-copilot/claude-opus-4.5"
     }
    }
  3. Restart Claude Code to pick up the new configuration.

Notes

  • ANTHROPIC_AUTH_TOKEN can be any non-empty string (authentication is handled by GitHub Copilot)
  • ANTHROPIC_API_KEY should be empty or omitted
  • Model names in the config should match models available in GitHub Copilot

OpenAI Codex Integration

OpenAI Codex CLI can be configured to use this router as a custom model provider.

Quick Launch (Recommended)

The easiest way to use Codex with the router - no configuration needed:

gcr cx
# or: gcr codex

This starts the router, launches Codex with the correct provider configuration, and cleans up when you exit. All arguments are passed through:

gcr cx --model gpt-4o
gcr cx --full-auto "fix the tests"

Manual Setup

If you prefer to run the router separately:

  1. Start the router (keep it running in a terminal):

    gcr
  2. Configure Codex CLI by creating/editing ~/.codex/config.toml:

    model = "gpt-5.2-codex"
    model_provider = "proxy"
    
    [model_providers.proxy]
    name = "OpenAI using GitHub Copilot Router"
    base_url = "http://localhost:7318/v1"
    wire_api = "responses"
  3. Run Codex as normal:

    codex

    It will now route requests through GitHub Copilot.

Notes

  • Model name should match a model available in GitHub Copilot (e.g., gpt-5.2-codex, gpt-4o, claude-sonnet-4.5)
  • No API key configuration needed - authentication is handled by GitHub Copilot

API Endpoints

| Endpoint | Method | Format | Description | |----------|--------|--------|-------------| | /v1/responses | POST | OpenAI | Responses API (recommended) | | /v1/responses/input_tokens | POST | OpenAI | Token counting | | /v1/chat/completions | POST | OpenAI | Chat completions (legacy) | | /v1/models | GET | OpenAI | List available models | | /v1/messages | POST | Anthropic | Messages API | | /v1/messages/count_tokens | POST | Anthropic | Token counting | | /health | GET | - | Health check |

Note: The /v1/responses endpoint is the newer OpenAI Responses API format, which is recommended over /v1/chat/completions. Some clients like OpenAI Codex CLI use wire_api = "responses" configuration.

Usage Examples

With curl (OpenAI format)

# Non-streaming
curl http://localhost:7318/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

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

With curl (Anthropic format)

curl http://localhost:7318/v1/messages \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4.5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

With OpenAI Python SDK

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:7318/v1",
    api_key="not-required"
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)

With Anthropic Python SDK

from anthropic import Anthropic

client = Anthropic(
    base_url="http://localhost:7318",
    api_key="not-required"
)

response = client.messages.create(
    model="claude-sonnet-4.5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.content[0].text)

Configuration

CLI Commands

| Command | Description | |---------|-------------| | gcr | Start the router server | | gcr claude-code | Launch Claude Code through the router | | gcr cc | Alias for claude-code | | gcr codex | Launch OpenAI Codex through the router | | gcr cx | Alias for codex |

Note: copilot-router is an alias for gcr (e.g., copilot-router cc works too).

Options:

  • --port, -p <port> - Port for the router (default: 7318)
  • --help, -h - Show help
  • --version, -v - Show version

Environment Variables

| Variable | Default | Description | |----------|---------|-------------| | PORT | 7318 | Server port | | GITHUB_TOKEN | - | GitHub PAT for authentication |

Troubleshooting

"AUTHENTICATION REQUIRED" error

You're not authenticated with GitHub Copilot. Follow the authentication steps above.

"copilot" command shows AWS Copilot

You have AWS Copilot installed which conflicts with GitHub Copilot CLI. Either:

  • Uninstall both GitHub Copilot and AWS Copilot: brew uninstall copilot-cli, and then install GitHub Copilot again.
  • Or ensure GitHub Copilot CLI is first in your PATH

License

MIT