|
9 | 9 |
|
10 | 10 | A reverse-engineered proxy for the GitHub Copilot API that exposes it as an OpenAI and Anthropic compatible service. This allows you to use GitHub Copilot with any tool that supports the OpenAI Chat Completions API or the Anthropic Messages API, including to power [Claude Code](https://docs.anthropic.com/en/docs/claude-code/overview). |
11 | 11 |
|
| 12 | +### New Features |
| 13 | + |
| 14 | +- **Copilot Usage Viewer**: Integrated web interface to view your GitHub Copilot usage statistics and quota information |
| 15 | +- **Token Display**: View the current Copilot token being used by the API |
| 16 | +- **Real-time Monitoring**: Track your usage and remaining quotas in real-time |
| 17 | + |
12 | 18 | ## Demo |
13 | 19 |
|
14 | 20 | https://github.com/user-attachments/assets/7654b383-669d-4eb9-b23c-06d7aefee8c5 |
@@ -113,6 +119,16 @@ These endpoints are designed to be compatible with the Anthropic Messages API. |
113 | 119 | | `POST /v1/messages` | `POST` | Creates a model response for a given conversation. | |
114 | 120 | | `POST /v1/messages/count_tokens` | `POST` | Calculates the number of tokens for a given set of messages. | |
115 | 121 |
|
| 122 | +### Usage Monitoring Endpoints |
| 123 | + |
| 124 | +New endpoints for monitoring your Copilot usage and quotas. |
| 125 | + |
| 126 | +| Endpoint | Method | Description | |
| 127 | +| --------------------------- | ------ | --------------------------------------------------------- | |
| 128 | +| `GET /usage` | `GET` | Get detailed Copilot usage statistics and quota information. | |
| 129 | +| `GET /token` | `GET` | Get the current Copilot token being used by the API. | |
| 130 | +| `GET /public/usage.html` | `GET` | Web interface for viewing usage statistics (accessible via browser). | |
| 131 | + |
116 | 132 | ## Example Usage |
117 | 133 |
|
118 | 134 | Using with npx: |
@@ -149,6 +165,34 @@ npx copilot-api@latest auth |
149 | 165 | npx copilot-api@latest auth --verbose |
150 | 166 | ``` |
151 | 167 |
|
| 168 | +## Using the Usage Viewer |
| 169 | + |
| 170 | +After starting the server, you can access the Copilot Usage Viewer through your web browser: |
| 171 | + |
| 172 | +1. Start the server: `npx copilot-api@latest start` |
| 173 | +2. Open your browser and navigate to: `http://localhost:4141/public/usage.html` |
| 174 | +3. The page will automatically load your usage data when opened |
| 175 | +4. Use the controls to: |
| 176 | + - **Fetch Usage**: Manually refresh usage data |
| 177 | + - **Show Current Token**: View the current Copilot token |
| 178 | + - **Enable Auto Refresh**: Automatically refresh data every 30 seconds |
| 179 | + |
| 180 | +### Auto Refresh Feature |
| 181 | + |
| 182 | +The usage viewer includes an automatic refresh feature that: |
| 183 | +- Updates usage data every 30 seconds when enabled |
| 184 | +- Shows a countdown timer to the next refresh |
| 185 | +- Displays the last update time |
| 186 | +- Can be toggled on/off at any time |
| 187 | +- Continues running in the background without interrupting your view |
| 188 | + |
| 189 | +The usage viewer provides: |
| 190 | +- Account information (plan type, access type, assigned date) |
| 191 | +- Quota information (remaining usage, total quota, overage count) |
| 192 | +- Real-time token display with automatic refresh |
| 193 | +- Support for Chinese and English interfaces |
| 194 | +- Auto-refresh functionality for continuous monitoring |
| 195 | + |
152 | 196 | ## Using with Claude Code |
153 | 197 |
|
154 | 198 | This proxy can be used to power [Claude Code](https://docs.anthropic.com/en/claude-code), an experimental conversational AI assistant for developers from Anthropic. |
|
0 commit comments