|
| 1 | +#= |
| 2 | +Mutation Injection Test |
| 3 | +======================== |
| 4 | +
|
| 5 | +This example demonstrates routing Anthropic API calls through CLIProxyAPI |
| 6 | +before and after applying the mutation injection. |
| 7 | +
|
| 8 | +## Prerequisites |
| 9 | +
|
| 10 | +### 1. Install CLIProxyAPI |
| 11 | +```bash |
| 12 | +curl -fsSL https://raw.githubusercontent.com/brokechubb/cliproxyapi-installer/refs/heads/master/cliproxyapi-installer | bash |
| 13 | +``` |
| 14 | +
|
| 15 | +### 2. Login to providers (one-time setup) |
| 16 | +```bash |
| 17 | +cd ~/cliproxyapi |
| 18 | +
|
| 19 | +# Login commands (prints URL, use --no-browser to avoid auto-open): |
| 20 | +./cli-proxy-api --claude-login --no-browser # Claude/Anthropic |
| 21 | +./cli-proxy-api --codex-login --no-browser # OpenAI/Codex |
| 22 | +./cli-proxy-api --login --no-browser # Gemini/Google |
| 23 | +./cli-proxy-api --qwen-login --no-browser # Qwen |
| 24 | +./cli-proxy-api --iflow-login --no-browser # iFlow |
| 25 | +``` |
| 26 | +
|
| 27 | +### 3. Start the proxy server |
| 28 | +```bash |
| 29 | +# Manual: |
| 30 | +cd ~/cliproxyapi && ./cli-proxy-api |
| 31 | +
|
| 32 | +# Or via systemd: |
| 33 | +systemctl --user enable cliproxyapi.service |
| 34 | +systemctl --user start cliproxyapi.service |
| 35 | +systemctl --user status cliproxyapi.service |
| 36 | +``` |
| 37 | +
|
| 38 | +### 4. Set API key environment variable |
| 39 | +The API key is stored in `~/cliproxyapi/config.yaml` under the `api-keys:` key. |
| 40 | +Export the first key: |
| 41 | +```bash |
| 42 | +export CLIPROXYAPI_API_KEY="your-api-key-from-config.yaml" |
| 43 | +``` |
| 44 | +
|
| 45 | +Or add to your shell profile (~/.bashrc, ~/.zshrc, etc.): |
| 46 | +```bash |
| 47 | +echo 'export CLIPROXYAPI_API_KEY="your-api-key"' >> ~/.bashrc |
| 48 | +``` |
| 49 | +
|
| 50 | +## Troubleshooting |
| 51 | +
|
| 52 | +- **Model not found after mutate**: CLIProxyAPI not logged in for that provider. |
| 53 | + Run the appropriate login command above. |
| 54 | +- **Connection refused**: Proxy server not running. Start it with `./cli-proxy-api`. |
| 55 | +- **401 Unauthorized**: CLIPROXYAPI_API_KEY not set or incorrect. |
| 56 | +
|
| 57 | +## Default endpoint |
| 58 | +CLIProxyAPI runs on `http://localhost:8317/v1` (OpenAI-compatible API). |
| 59 | +=# |
| 60 | + |
1 | 61 | using OpenRouter |
2 | 62 | using OpenRouterCLIProxyAPI |
3 | 63 |
|
|
0 commit comments