CLIProxyAPI Integration
ZeroLimit acts as a frontend for CLIProxyAPI, providing a GUI for managing authentication, viewing quotas, and configuring the proxy server.Architecture Overview
Management API Endpoints
ZeroLimit communicates with CLIProxyAPI through its Management API (default:http://localhost:25100/v0/management). All requests require Bearer token authentication.
Base Configuration
src/services/api/client.ts:26
Authentication Management
List Auth Files
Retrieves all stored authentication files. Endpoint:GET /v0/management/auth-files
Response:
src/services/api/auth.service.ts:9
Upload Auth File
Uploads a new authentication file (e.g.,.har, .txt, .json).
Endpoint: POST /v0/management/auth-files
Request: multipart/form-data with file field
Usage:
src/services/api/auth.service.ts:17
Delete Auth File
Deletes a specific authentication file by name. Endpoint:DELETE /v0/management/auth-files?name={filename}
Usage:
src/services/api/auth.service.ts:11
Delete All Auth Files
Deletes all stored authentication files. Endpoint:DELETE /v0/management/auth-files?all=true
Usage:
src/services/api/auth.service.ts:13
Configuration Management
Get Configuration (JSON)
Retrieves the current CLIProxyAPI configuration as JSON. Endpoint:GET /v0/management/config
Usage:
src/services/api/config.service.ts:12
Get Configuration (YAML)
Retrieves the raw YAML configuration for editing. Endpoint:GET /v0/management/config.yaml
Response: Plain text YAML
Usage:
src/services/api/config.service.ts:20
Update Configuration
Updates the CLIProxyAPI configuration by uploading new YAML content. Endpoint:PUT /v0/management/config.yaml
Request: application/yaml body
Response:
src/services/api/config.service.ts:30
OAuth Flows
Start OAuth Flow
Initiates an OAuth authentication flow for a provider. Endpoint:GET /v0/management/{provider}-auth-url
Supported providers: codex, anthropic, antigravity, gemini-cli, kiro, copilot
Response:
src/services/api/oauth.service.ts:11
Check OAuth Status
Polls the OAuth flow status using the state parameter. Endpoint:GET /v0/management/get-auth-status?state={state}
Response:
src/services/api/oauth.service.ts:25
Submit OAuth Callback
Manually submits an OAuth redirect URL (for web UI flows). Endpoint:POST /v0/management/oauth-callback
Request:
src/services/api/oauth.service.ts:30
Generic API Call Proxy
The/v0/management/api-call endpoint allows making authenticated requests to AI providers through CLIProxyAPI.
Endpoint: POST /v0/management/api-call
Request:
src/services/api/apiCall.ts:57
Server Version Detection
ZeroLimit automatically detects the CLIProxyAPI server version from response headers. Headers checked:x-cpa-versionorx-server-versionx-cpa-build-dateorx-server-build-date
apiClient interceptor automatically dispatches a server-version-update event when version headers are detected.
src/services/api/client.ts:102
Error Handling
All API calls return structured errors:unauthorized event on the window object for global handling.
Implementation: src/services/api/client.ts:122