|
1 | 1 | # Command Line Interface |
2 | 2 |
|
3 | | -The Copilot API provides a command-line interface with various configuration options. |
| 3 | +The Copilot API provides a command-line interface powered by `citty`. |
4 | 4 |
|
5 | | -## Usage |
| 5 | +## Name and Description |
6 | 6 |
|
7 | | -```bash |
8 | | -copilot-api [options] |
| 7 | +``` |
| 8 | +Name: copilot-api |
| 9 | +Description: A wrapper around GitHub Copilot API to make it OpenAI compatible, making it usable for other tools. |
9 | 10 | ``` |
10 | 11 |
|
11 | 12 | ## Options |
12 | 13 |
|
13 | | -| Option | Alias | Description | Default | |
14 | | -|-------------|-------|-------------------------------------------------|---------| |
15 | | -| --help | -h | Show help message | false | |
16 | | -| --stream | -s | Enable streaming response for chat completions | true | |
17 | | -| --no-stream | | Disable streaming response | | |
18 | | -| --port | -p | Port to listen on | 4141 | |
| 14 | +| Option | Description | Type | Default | |
| 15 | +|--------------------|--------------------------------------------------|-----------|---------| |
| 16 | +| --help, -h | Display help information | boolean | false | |
| 17 | +| --emulate-streaming| Emulate streaming response for chat completions | boolean | false | |
| 18 | +| --port, -p | Port number to listen on | string | "4141" | |
| 19 | + |
| 20 | +## Environment Variables |
| 21 | + |
| 22 | +The following environment variables are required: |
| 23 | + |
| 24 | +- `GITHUB_CLIENT_ID`: GitHub OAuth client ID |
| 25 | +- `GITHUB_OAUTH_SCOPES`: Required OAuth scopes for GitHub |
| 26 | + |
| 27 | +Optional environment variables: |
| 28 | +- `EMULATE_STREAMING`: Alternative way to enable streaming emulation |
19 | 29 |
|
20 | 30 | ## Examples |
21 | 31 |
|
22 | | -Start server on default port: |
| 32 | +Start server with default settings: |
23 | 33 | ```bash |
24 | | -copilot-api |
| 34 | +bun run start |
25 | 35 | ``` |
26 | 36 |
|
27 | | -Start server with streaming enabled: |
| 37 | +Start with streaming emulation: |
28 | 38 | ```bash |
29 | | -copilot-api --stream |
| 39 | +bun run start --emulate-streaming |
30 | 40 | ``` |
31 | 41 |
|
32 | | -Start server on custom port: |
| 42 | +Start on a custom port: |
33 | 43 | ```bash |
34 | | -copilot-api --port 8080 |
| 44 | +bun run start --port 8080 |
35 | 45 | ``` |
36 | 46 |
|
37 | | -Show help message: |
| 47 | +Display help: |
38 | 48 | ```bash |
39 | | -copilot-api --help |
| 49 | +bun run start --help |
40 | 50 | ``` |
| 51 | + |
| 52 | +## Development Mode |
| 53 | + |
| 54 | +Run in development mode with hot reloading: |
| 55 | +```bash |
| 56 | +bun run dev |
| 57 | +``` |
| 58 | + |
| 59 | +## Notes |
| 60 | + |
| 61 | +- The server will print available models on startup |
| 62 | +- Authentication tokens are automatically refreshed (every 8 hours for GitHub token) |
| 63 | +- Streaming emulation can be enabled via CLI flag or environment variable |
0 commit comments