{"id":50795627,"url":"https://github.com/wosledon/copilot-auto-byok","last_synced_at":"2026-06-12T14:30:59.240Z","repository":{"id":362747429,"uuid":"1259637531","full_name":"wosledon/copilot-auto-byok","owner":"wosledon","description":"Copilot BYOK big models routing | Copilot BOYK 大模型路由","archived":false,"fork":false,"pushed_at":"2026-06-05T17:33:33.000Z","size":335,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-05T19:18:32.653Z","etag":null,"topics":["bigmodel","copilot","copilot-cli","copilot-coding-agent","modelrouter"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wosledon.png","metadata":{"files":{"readme":"README.en-US.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-04T17:53:33.000Z","updated_at":"2026-06-05T17:33:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wosledon/copilot-auto-byok","commit_stats":null,"previous_names":["wosledon/copilot-auto-byok"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/wosledon/copilot-auto-byok","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wosledon%2Fcopilot-auto-byok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wosledon%2Fcopilot-auto-byok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wosledon%2Fcopilot-auto-byok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wosledon%2Fcopilot-auto-byok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wosledon","download_url":"https://codeload.github.com/wosledon/copilot-auto-byok/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wosledon%2Fcopilot-auto-byok/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34249560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bigmodel","copilot","copilot-cli","copilot-coding-agent","modelrouter"],"created_at":"2026-06-12T14:30:58.387Z","updated_at":"2026-06-12T14:30:59.230Z","avatar_url":"https://github.com/wosledon.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# copilot-auto-byok\n\n[English](README.en-US.md) | [中文](README.zh-CN.md)\n\n`copilot-auto-byok` is a custom backend proxy service for **GitHub Copilot** in **Bring Your Own Key (BYOK)** mode. It allows you to host your own OpenAI or Anthropic API keys locally and expose them as a Copilot-compatible backend, with flexible model routing, key management, and usage metrics.\n\nThe service provides OpenAI-compatible `/v1/chat/completions` and Anthropic-compatible `/v1/messages` proxy endpoints, plus a built-in web UI for managing providers, models, API keys, and request metrics.\n\n## Features\n\n- **Multi-provider support**: Manage OpenAI and Anthropic provider configurations in one place.\n- **Auto model routing**: Use the `auto-copilot` binding to let Copilot automatically route to the active model.\n- **API proxy**: Forward requests while staying compatible with OpenAI Chat Completions and Anthropic Messages APIs.\n- **Key management**: Store and manage multiple upstream API keys or bearer tokens.\n- **Usage metrics**: Built-in metrics collection for requests, tokens, and provider stats.\n- **Admin UI**: Static web interface for configuration and monitoring.\n- **Data migration**: Automatically migrate legacy `models.json` settings into SQLite on first run.\n\n## Getting Started\n\n### Prerequisites\n\n- [.NET 10 SDK](https://dotnet.microsoft.com/download)\n\n### Run\n\n```bash\ndotnet run --project copilot-auto-byok.csproj\n```\n\nThe service listens on `http://localhost:5000` by default. Open the root path to access the admin UI.\n\n### Environment Variables\n\nYou can configure the upstream BYOK connection via environment variables:\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `BYOK_PROVIDER_BASE_URL` | Upstream provider base URL | empty |\n| `BYOK_PROVIDER_TYPE` | Provider type: `openai` or `anthropic` | `openai` |\n| `BYOK_PROVIDER_API_KEY` | Upstream API key | empty |\n| `BYOK_PROVIDER_BEARER_TOKEN` | Bearer token (takes precedence over API key) | empty |\n| `BYOK_PROVIDER_WIRE_API` | Upstream API path: `completions` or `messages` | `completions` |\n| `BYOK_MODEL` | Default model ID | `auto-copilot` |\n| `BYOK_PROVIDER_MODEL_ID` | Actual upstream model ID | empty |\n| `BYOK_PROVIDER_WIRE_MODEL` | Model name sent in upstream requests | empty |\n\n## Configuration\n\nOn startup, the service persists configuration in `Data/app.db`:\n\n- **Providers**: name, type, base URL, available models, visible models.\n- **ApiKeys**: keys used to access this service.\n- **AutoCopilot**: the current Copilot model and provider binding.\n- **ByokEnv**: upstream connection and model mapping settings.\n\nYou can manage these through the admin UI or directly via API.\n\n## API Endpoints\n\n| Method | Path | Description |\n|--------|------|-------------|\n| `POST` | `/v1/chat/completions` | OpenAI Chat Completions proxy |\n| `POST` | `/v1/messages` | Anthropic Messages proxy |\n| `GET` | `/v1/models` | List available models (including `auto-copilot`) |\n| `GET` | `/metrics` | View request metrics |\n\n## Admin UI\n\n![Admin UI](docs/index.png)\n\n## Metrics\n\n![Metrics](docs/metrics.png)\n\n## Tech Stack\n\n- .NET 10\n- ASP.NET Core\n- Entity Framework Core + SQLite\n- OpenAPI\n- CORS\n\n## Notes\n\n- Do not commit `Data/app.db` to version control.\n- Configure HTTPS and proper authentication in production.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwosledon%2Fcopilot-auto-byok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwosledon%2Fcopilot-auto-byok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwosledon%2Fcopilot-auto-byok/lists"}