### Getting Started with Gemini Provider (Bash) Source: https://docs.ccs.kaitran.ca/providers/concepts/overview Illustrates the basic command to start using the Gemini provider for the first time. This example includes a simple query and highlights the browser-based authentication flow. ```bash ccs gemini "your first query" # Browser opens → Google login → Start coding ``` -------------------------------- ### Kiro Provider CLI Quick Start Source: https://docs.ccs.kaitran.ca/providers/oauth/kiro Demonstrates basic usage of the 'ccs kiro' command for interacting with the Kiro Provider. Includes examples for default device code flow, Google OAuth login, token import, and disabling incognito mode. ```bash # First run (device code flow - default) ccs kiro "explain this code" # Use Google OAuth instead ccs kiro --kiro-google-login # Import token from Kiro IDE ccs kiro --import # Use normal browser (not incognito) ccs kiro --no-incognito ``` -------------------------------- ### Kiro Provider Token Import CLI Example Source: https://docs.ccs.kaitran.ca/providers/oauth/kiro Demonstrates the command to import an authentication token directly from a Kiro IDE installation, bypassing the browser-based OAuth flow. Includes example output showing successful import and account registration. ```bash # Import token from Kiro IDE installation ccs kiro --import # Output: # [i] Searching for Kiro IDE token... # [OK] Token imported from Kiro IDE # [OK] Account registered: github-ABC123 ``` -------------------------------- ### Install CCS CLI Tool Source: https://docs.ccs.kaitran.ca/ Installs the CCS CLI tool globally using npm. This command is the first step to getting started with CCS. ```bash npm install -g @kaitranntt/ccs ``` -------------------------------- ### Simultaneous Provider Usage Example Source: https://docs.ccs.kaitran.ca/providers Illustrates how to use different CCS providers concurrently without conflicts. Each provider runs in an isolated session, allowing for parallel tasks. ```bash # Terminal 1 operatorname{ccs} gemini "task A" # Terminal 2 operatorname{ccs} codex "task B" # No conflicts ``` -------------------------------- ### Install CCS via npm, yarn, pnpm, or bun Source: https://docs.ccs.kaitran.ca/getting-started/installation Install the CCS CLI globally using your preferred package manager. This makes the 'ccs' command available system-wide. Ensure Node.js is installed and configured in your PATH. ```bash npm install -g @kaitranntt/ccs ``` ```bash yarn global add @kaitranntt/ccs ``` ```bash pnpm add -g @kaitranntt/ccs ``` ```bash bun add -g @kaitranntt/ccs ``` -------------------------------- ### Get Profile Settings Not Found Error (JSON) Source: https://docs.ccs.kaitran.ca/reference/api-settings Example JSON response when the requested profile settings are not found. ```json { "error": "Settings not found" } ``` -------------------------------- ### Get Presets Response (JSON) Source: https://docs.ccs.kaitran.ca/reference/api-settings Example JSON response listing available presets for a profile, including different model configurations for various tiers (e.g., Opus, Sonnet, Haiku). ```json { "presets": [ { "name": "Opus Thinking", "default": "gemini-claude-opus-4-5-thinking", "opus": "gemini-claude-opus-4-5-thinking", "sonnet": "gemini-claude-opus-4-5-thinking", "haiku": "gemini-3-flash-preview" }, { "name": "Balanced", "default": "gemini-claude-sonnet-4", "opus": "gemini-claude-opus-4-5", "sonnet": "gemini-claude-sonnet-4", "haiku": "gemini-claude-haiku-4" } ] } ``` -------------------------------- ### Install and Check CCS Version Source: https://docs.ccs.kaitran.ca/getting-started/first-session Ensures the CCS CLI is installed and checks its version. This is a prerequisite for using CCS. ```bash ccs --version # If not installed: npm install -g @kaitranntt/ccs ``` -------------------------------- ### Interact with Alibaba Coding Plan (Qwen3 Coder) Source: https://docs.ccs.kaitran.ca/providers Provides access to Qwen3 Coder models via API key through the Alibaba Coding Plan. Supports quick setup with presets and default profile names. ```bash # Quick setup with preset ccs api create --preset alibaba-coding-plan # Use default profile name ccs albb "implement this feature" ``` -------------------------------- ### Model Mapping Example (Bash Comment) Source: https://docs.ccs.kaitran.ca/providers/oauth/ghcp Provides an example comment illustrating how CLIProxyAPI internally maps GitHub Copilot requests to Claude model IDs. It clarifies that users do not need to specify the model, as the routing is handled automatically by the API. This simplifies the user experience by abstracting model selection. ```bash # Claude requests "claude-opus-4-5" # CLIProxyAPI routes to GitHub Copilot equivalent ``` -------------------------------- ### Execute CCS Commands with OpenRouter (Bash) Source: https://docs.ccs.kaitran.ca/features/proxy/openrouter These bash commands demonstrate how to use the CCS tool with OpenRouter profiles. The first example shows how to initiate a task using the default OpenRouter model. The second example illustrates running parallel workflows by assigning different tasks to different terminals and models. ```bash # Use OpenRouter profile ccs openrouter "implement the authentication service" ``` ```bash # Parallel workflows ccs openrouter "design the system" # Terminal 1: Architecture ccs glm "implement the service" # Terminal 2: Bulk coding ``` -------------------------------- ### CCS CLI Usage Examples Source: https://docs.ccs.kaitran.ca/features/workflow/droid-adapter Provides examples of how to use the CCS CLI for various tasks, including running GLM on Droid, running Codex and Antigravity on Droid, and running GLM on Claude as a default. ```bash ccs glm --target droid # Run GLM on Droid (explicit flag) ccsd glm # Same via ccsd alias ccs glm # Run GLM on Claude (default) ccsd codex "prompt" # Run Codex on Droid ccsd agy "prompt" # Run Antigravity on Droid ``` -------------------------------- ### Install Droid CLI (Bash) Source: https://docs.ccs.kaitran.ca/features/workflow/droid-adapter Provides the command to install the Droid CLI globally using npm. This is a prerequisite for using the Droid adapter. ```bash npm i -g @factory/cli ``` -------------------------------- ### Start CLIProxy Service (Bash) Source: https://docs.ccs.kaitran.ca/reference/api-cliproxy Initiates the CLIProxy service to run in the background. The response indicates if the service was successfully started, if it was already running, and the port it is assigned. This is essential for enabling other CLIProxy functionalities. ```bash curl -X POST http://localhost:3000/api/cliproxy/proxy-start ``` -------------------------------- ### Dockerfile for CLIProxyAPI Deployment Source: https://docs.ccs.kaitran.ca/features/proxy/remote-proxy This Dockerfile defines the steps to build a Docker image for CLIProxyAPI. It starts from a Debian base image, installs necessary tools like curl and unzip, downloads the latest release of CLIProxyAPI, unzips it into the /opt/cliproxy directory, and makes it executable. It also exposes port 8317 and sets the default command to run the CLIProxyAPI executable. ```dockerfile # Dockerfile for CLIProxyAPI FROM debian:bookworm-slim # Download and install CLIProxyAPI RUN apt-get update && apt-get install -y curl unzip \ && curl -L -o cliproxy.zip https://github.com/router-for-me/CLIProxyAPI/releases/latest/download/linux-amd64.zip \ && unzip cliproxy.zip -d /opt/cliproxy \ && chmod +x /opt/cliproxy/cli-proxy-api EXPOSE 8317 CMD ["/opt/cliproxy/cli-proxy-api", "--port", "8317"] ``` -------------------------------- ### Quick Start for Gemini CLI Source: https://docs.ccs.kaitran.ca/providers/oauth/gemini Provides essential commands to quickly start using the Gemini provider via the CCS CLI. This includes initiating the OAuth flow, configuring models, and specifying accounts. ```bash # First run (browser opens for OAuth) ccs gemini "explain this code" # Select model interactively ccs gemini --config # Use specific account ccs gemini --use work ``` -------------------------------- ### CLIProxy Configuration Example Source: https://docs.ccs.kaitran.ca/providers/oauth/claude Example configuration settings for CLIProxy, including authentication API keys and management secrets, typically found in `~/.ccs/config.yaml`. ```yaml # CLIProxy settings cliproxy: auth: api_key: "ccs-internal-managed" management_secret: "ccs" # Dashboard login password ``` -------------------------------- ### Kiro Provider Multi-Account Management CLI Examples Source: https://docs.ccs.kaitran.ca/providers/oauth/kiro Provides examples of managing multiple Kiro accounts using the CLI. Includes commands to add a new account, list available accounts, and switch the default account. ```bash # Add second account ccs kiro --auth --add # List accounts ccs kiro --accounts # Output: # Available Kiro accounts: # * github-ABC123 (default) # github-XYZ789 # Switch default account ccs kiro --use github-XYZ789 ``` -------------------------------- ### Quick Start Kimi Commands Source: https://docs.ccs.kaitran.ca/providers/oauth/kimi Demonstrates basic usage for both OAuth (CLIProxy) and API key modes of the Kimi provider, along with commands for listing and switching accounts. ```bash # OAuth mode (CLIProxy) — no API key needed ccs kimi "explain this code" # API preset mode — requires API key (Kimi for Coding) ccs km "explain this code" # List accounts (OAuth mode) ccs kimi --accounts # Switch account ccs kimi --use work ``` -------------------------------- ### Quick Setup CLIProxy Source: https://docs.ccs.kaitran.ca/features/proxy/cliproxy-api Provides the command to initiate the CLIProxy configuration process. This typically involves navigating through a menu-driven interface to set up the proxy. ```bash # Start CLIProxy ccs config # Navigate to CLiProxy → Quick Setup ``` -------------------------------- ### Verify Authentication Tokens (Bash) Source: https://docs.ccs.kaitran.ca/tutorials/remote-proxy-deployment This example shows how to check if the client and server authentication tokens match. It involves grepping the configuration files on both the server and client to ensure consistency, which is vital for successful authentication. ```bash # Server grep api_key ~/.ccs/config.yaml # Client grep auth_token ~/.ccs/config.yaml ``` -------------------------------- ### Example: CCS PROXY_ERROR (Exit Code 8) Source: https://docs.ccs.kaitran.ca/reference/error-codes Illustrates a scenario where the CCS CLI encounters a PROXY_ERROR (Exit Code 8), typically due to the proxy failing to start or crashing. This example shows a common command that might trigger this error and the corresponding debug output. ```bash # Port in use ccs gemini # Exit 8: "Failed to start proxy: port 8317 already in use" # Binary crashed ccs gemini # Exit 8: "Proxy process exited unexpectedly: exit code 1" # Permission denied ccs gemini # Exit 8: "Cannot bind to port 8317: EACCES" ``` -------------------------------- ### Antigravity Provider First-Time Setup (Bash) Source: https://docs.ccs.kaitran.ca/providers/oauth/agy Initiates the Antigravity provider for the first time, triggering an OAuth login flow in the browser. The authentication token is then cached locally for future use, eliminating the need for re-authentication. ```bash # Run Antigravity for the first time ccs agy "analyze this code" # Browser opens automatically # → Complete OAuth login # → Token cached at ~/.ccs/cliproxy/auth/ # → Future runs require no re-auth ``` -------------------------------- ### Kimi API Key Authentication Setup Source: https://docs.ccs.kaitran.ca/providers/oauth/kimi Details the process for setting up authentication for the `ccs km` command using a direct API key. It includes obtaining the key and the initial configuration prompt. ```bash # Obtain a `sk-...` key from Moonshot AI platform # Run `ccs km` — prompted for API key on first use # All requests use extended thinking by default ``` -------------------------------- ### Get Profile Settings Response (JSON) Source: https://docs.ccs.kaitran.ca/reference/api-settings Example JSON response for retrieving profile settings, showing masked sensitive information. ```json { "profile": "gemini", "settings": { "env": { "ANTHROPIC_BASE_URL": "http://127.0.0.1:8317/api/provider/gemini", "ANTHROPIC_AUTH_TOKEN": "********", "ANTHROPIC_MODEL": "gemini-3-flash-preview" } }, "mtime": 1704467400000, "path": "/home/user/.ccs/gemini.settings.json" } ``` -------------------------------- ### Example Raw JSON Configuration Source: https://docs.ccs.kaitran.ca/features/proxy/cliproxy-api Illustrates a sample raw JSON configuration for the environment variables used by the Anthropic provider. This includes base URLs, authentication tokens, and default model settings. ```json { "env": { "ANTHROPIC_BASE_URL": "http://127.0.0.1:8317/api/provider/agy", "ANTHROPIC_AUTH_TOKEN": "", "ANTHROPIC_DEFAULT_MODEL": "gemini-claude-opus-4-5-thinking", "ANTHROPIC_DEFAULT_OPUS_MODEL": "gemini-claude-opus-4-5-thinking", "ANTHROPIC_DEFAULT_SONNET_MODEL": "gemini-claude-opus-4-5-thinking", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gemini-3-flash-preview" } } ``` -------------------------------- ### Get CCS CLI Version Source: https://docs.ccs.kaitran.ca/reference/cli-commands Displays the current version of the CCS CLI and installation details, including the location of the executable and configuration files. ```bash ccs --version ``` -------------------------------- ### iFlow Provider First-Time Setup (Bash) Source: https://docs.ccs.kaitran.ca/providers/oauth/iflow Initiates the first-time authentication for the iFlow provider. This process automatically opens a browser for OAuth consent and sets up a callback server on port 11451. Subsequent runs will use the cached token. ```bash # Run iFlow for the first time ccs iflow "review this code" # Browser OAuth flow starts automatically # → Browser opens for iFlow OAuth consent # → Callback server spawns on port 11451 # → Token cached at ~/.ccs/cliproxy/auth/ # → Future runs require no re-auth ``` -------------------------------- ### Interact with MiniMax (Long-Context) Source: https://docs.ccs.kaitran.ca/providers Facilitates interaction with MiniMax, a model specialized for long-context tasks. Supports quick setup with presets and profile usage. ```bash # Quick setup with preset ccs api create mm --preset mm # Use profile ccs mm "analyze large document" ``` -------------------------------- ### Get Raw Profile Settings Response (JSON) Source: https://docs.ccs.kaitran.ca/reference/api-settings Example JSON response for retrieving raw profile settings, including unmasked sensitive API keys. ```json { "profile": "gemini", "settings": { "env": { "ANTHROPIC_BASE_URL": "http://127.0.0.1:8317/api/provider/gemini", "ANTHROPIC_AUTH_TOKEN": "actual-token-here", "ANTHROPIC_MODEL": "gemini-3-flash-preview" } }, "mtime": 1704467400000, "path": "/home/user/.ccs/gemini.settings.json" } ``` -------------------------------- ### Rate Limiting Wait Strategy Example (Bash) Source: https://docs.ccs.kaitran.ca/providers/oauth/ghcp Demonstrates the user experience when rate limits are exceeded and the wait strategy is enabled. It shows the CLI output indicating a rate limit breach, the wait time, and the expected reset time. This strategy is useful for non-interactive sessions where automatic retries are desired. ```bash ccs ghcp "long prompt" # Output: # [!] Rate limit exceeded # [i] Waiting 47 minutes until reset at 14:30:00 # Press Ctrl+C to cancel ``` -------------------------------- ### Configure CLIProxy Backend via YAML Source: https://docs.ccs.kaitran.ca/features/proxy/cliproxy-api Demonstrates how to set the default CLIProxy backend in the configuration YAML file. This allows users to choose between 'original' and 'plus' backends for different provider capabilities. ```yaml cliproxy: backend: plus # original | plus (default: plus) ``` -------------------------------- ### Upgrade and Uninstall CCS Source: https://docs.ccs.kaitran.ca/getting-started/installation Commands to update the CCS CLI to the latest version using npm or to uninstall it completely. Uninstalling removes the command-line tool but preserves the configuration directory. ```bash # npm (recommended) npm update -g @kaitranntt/ccs # Or force reinstall ccs update --force ``` ```bash npm uninstall -g @kaitranntt/ccs ``` -------------------------------- ### Run Qwen Provider Command Source: https://docs.ccs.kaitran.ca/providers/oauth/qwen Execute a command using the Qwen provider. This can be a specific instruction or an interactive chat session. ```bash # Run with Qwen ccs qwen "implement binary search algorithm" # Interactive chat ccs qwen ``` -------------------------------- ### View CCS Configuration Directory Structure Source: https://docs.ccs.kaitran.ca/getting-started/installation This bash snippet displays the directory structure of the CCS configuration, located at `~/.ccs/`. It includes subdirectories for profiles, tokens, and shared commands. ```bash ls ~/.ccs/ ├── config.json # Profile configuration ├── glm.settings.json # GLM profile ├── instances/ # Account-based profile instances ├── cliproxy/ # OAuth provider auth tokens └── shared/ # Shared commands/skills/agents ``` -------------------------------- ### Configure Nginx Reverse Proxy Source: https://docs.ccs.kaitran.ca/tutorials/docker-deployment An example Nginx configuration for a reverse proxy setup. This is typically used in production to route external traffic to the appropriate backend services, handling SSL/TLS termination. ```nginx server { listen 443 ssl http2; server_name ccs.example.com; location / { proxy_pass http://localhost:3000; } } ``` -------------------------------- ### Set System Proxy for Downloads (Bash) Source: https://docs.ccs.kaitran.ca/tutorials/remote-proxy-deployment This example demonstrates how to configure system-wide proxy settings using environment variables in Bash. These settings are used by CCS for downloading binaries and making network requests, especially when behind a corporate firewall. ```bash # Set system proxy before running CCS export http_proxy=http://proxy.corp.com:8080 export https_proxy=http://proxy.corp.com:8080 export NO_PROXY=localhost,127.0.0.1 ccs cliproxy update # Will use proxy for binary download ``` -------------------------------- ### Configure Multi-Region Proxy Deployment (YAML) Source: https://docs.ccs.kaitran.ca/tutorials/remote-proxy-deployment This configuration syntax is reserved for future use, enabling multi-region auto-selection of proxies. Clients will automatically select the fastest available proxy based on ping times. This feature is planned but not yet implemented. ```yaml cliproxy_server: remote: hosts: - host: "us-east.proxy.com" region: "us-east" - host: "eu-west.proxy.com" region: "eu-west" auto_select: true # Ping-based selection ``` -------------------------------- ### Set Claude CLI Path on Windows Source: https://docs.ccs.kaitran.ca/getting-started/installation This PowerShell command allows you to manually set the environment variable `CCS_CLAUDE_PATH` to specify the location of the Claude executable on Windows. This is useful if automatic detection fails. ```powershell $env:CCS_CLAUDE_PATH = "C:\custom\path\to\Claude.exe" ``` -------------------------------- ### Usage Examples for Local Ollama Source: https://docs.ccs.kaitran.ca/providers/api/ollama Demonstrates how to use the CCS CLI with a local Ollama instance. Includes basic usage, switching models by setting the ANTHROPIC_MODEL environment variable, and adjusting the temperature. ```bash # Basic usage ccs ollama "explain this function" # Switch models ANTHROPIC_MODEL=deepseek-coder ccs ollama "review this code" # Custom temperature ANTHROPIC_TEMPERATURE=0.7 ccs ollama "generate unit tests" ``` -------------------------------- ### Rate Limiting Fail Fast Strategy Example (Bash) Source: https://docs.ccs.kaitran.ca/providers/oauth/ghcp Illustrates the user experience when rate limits are exceeded and the fail-fast strategy is enabled. The output shows an error message, the reset time, and a suggestion to enable auto-waiting. This strategy is suitable for scenarios where immediate feedback on exceeding limits is preferred over automatic retries. ```bash ccs ghcp "prompt" # Output: # [X] Rate limit exceeded # [i] Limit resets at 14:30:00 (in 47 minutes) # [i] Set copilot.wait_on_limit: true to auto-wait ``` -------------------------------- ### Get Hourly Usage Trends Response (JSON) Source: https://docs.ccs.kaitran.ca/reference/api-usage Example JSON response for the hourly usage trends endpoint. It shows a list of hourly records, including the hour, token counts, cost, and models used during that hour. ```json { "hourly": [ { "hour": "2026-01-05 14:00", "inputTokens": 50000, "outputTokens": 20000, "cacheReadTokens": 10000, "cacheWriteTokens": 2500, "cost": 0.21, "modelsUsed": ["claude-sonnet-4"] }, { "hour": "2026-01-05 15:00", "inputTokens": 0, "outputTokens": 0, "cost": 0, "modelsUsed": [] } ] } ``` -------------------------------- ### Get Usage Anomalies and Insights Response (JSON) Source: https://docs.ccs.kaitran.ca/reference/api-usage Example JSON response for the usage insights endpoint. It lists detected anomalies with their type, date, value, threshold, and a descriptive message, along with configured thresholds for various metrics. ```json { "anomalies": [ { "type": "cost_spike", "date": "2026-01-04", "value": 5.20, "threshold": 2.50, "message": "Daily cost 208% above average" }, { "type": "high_input", "date": "2026-01-03", "value": 12000000, "threshold": 10000000, "message": "Input tokens exceeded 10M threshold" } ], "thresholds": { "highInput": 10000000, "highIoRatio": 100, "costSpikeMultiplier": 2, "highCacheRead": 1000000000 } } ``` -------------------------------- ### Authenticate and Run First Query with Gemini Source: https://docs.ccs.kaitran.ca/getting-started/first-session Demonstrates the initial authentication process with the Gemini provider and executing a basic query. This involves opening a browser for OAuth and saving credentials. ```bash ccs gemini "explain what CCS does" # Example of running a query after authentication: ccs gemini "show me how to create a React component" ``` -------------------------------- ### Get Per-Model Usage Statistics Response (JSON) Source: https://docs.ccs.kaitran.ca/reference/api-usage Example JSON response for the per-model usage statistics endpoint. It lists each model used, its token counts, cost, percentage of total cost, and I/O ratio, along with the total cost. ```json { "models": [ { "model": "claude-sonnet-4", "inputTokens": 8000000, "outputTokens": 3500000, "cacheReadTokens": 1500000, "cacheWriteTokens": 400000, "cost": 32.50, "percentage": 71.4, "ioRatio": 2.29 }, { "model": "gemini-3-flash", "inputTokens": 2000000, "outputTokens": 1500000, "cost": 13.00, "percentage": 28.6, "ioRatio": 1.33 } ], "totalCost": 45.50 } ``` -------------------------------- ### Kimi CLI Commands Reference Source: https://docs.ccs.kaitran.ca/providers/oauth/kimi A comprehensive reference of available commands for interacting with the Kimi provider, covering basic usage, authentication, and account management. ```bash # Basic usage ccs kimi "your prompt" ccs km "your prompt" # API preset # Authentication ccs kimi --kimi-login # Trigger device code OAuth ccs kimi --kimi-login --add # Add second account ccs kimi --logout # Clear tokens # Account management ccs kimi --accounts # List all accounts ccs kimi --use work # Switch default account ccs kimi --nickname personal # Rename current account ``` -------------------------------- ### Troubleshooting Authorization and Account Issues Source: https://docs.ccs.kaitran.ca/providers/oauth/qwen This section provides bash commands for troubleshooting common issues related to authorization and account management. It includes verifying token file existence, re-authenticating, listing accounts, and switching between accounts. ```bash # Verify token file exists ls ~/.ccs/cliproxy/auth/qwen-*.json # Re-authenticate if missing ccs qwen --logout ccs qwen --auth # List all accounts to verify state ccs qwen --accounts # Switch to specific account ccs qwen --use # Re-authenticate for token expiry issues ccs qwen --auth ``` -------------------------------- ### Get Daily Usage Trends Response (JSON) Source: https://docs.ccs.kaitran.ca/reference/api-usage Example JSON response for the daily usage trends endpoint. It includes a list of daily records, each detailing date, token counts, cost, models used, and a breakdown per model. ```json { "daily": [ { "date": "2026-01-05", "inputTokens": 450000, "outputTokens": 200000, "cacheReadTokens": 100000, "cacheWriteTokens": 25000, "cost": 1.85, "modelsUsed": ["claude-sonnet-4", "gemini-3-flash"], "modelBreakdown": { "claude-sonnet-4": { "inputTokens": 300000, "outputTokens": 150000, "cost": 1.35 }, "gemini-3-flash": { "inputTokens": 150000, "outputTokens": 50000, "cost": 0.50 } } } ] } ``` -------------------------------- ### Get Overall Usage Summary Response (JSON) Source: https://docs.ccs.kaitran.ca/reference/api-usage Example JSON response for the overall usage summary endpoint, detailing total tokens, cost, input/output tokens, cache usage, daily averages, date range, and models used. ```json { "totalTokens": 15000000, "totalCost": 45.50, "inputTokens": 10000000, "outputTokens": 5000000, "cacheReadTokens": 2000000, "cacheWriteTokens": 500000, "dailyAverage": { "tokens": 500000, "cost": 1.52 }, "dateRange": { "from": "2026-01-01", "to": "2026-01-31" }, "modelsUsed": ["claude-sonnet-4", "gemini-3-flash"] } ``` -------------------------------- ### Antigravity Provider Basic Usage (Bash) Source: https://docs.ccs.kaitran.ca/providers/oauth/agy Provides basic command examples for interacting with the Antigravity provider. This includes running a prompt directly or initiating an interactive chat session. ```bash # Run with Antigravity ccs agy "explain this architecture" # Interactive chat ccs agy ``` -------------------------------- ### Get Session History (Bash) Source: https://docs.ccs.kaitran.ca/reference/api-usage Retrieves session history with support for pagination. Accepts `limit` and `offset` query parameters to control the number of sessions returned and the starting point for pagination. The response includes session details, total count, limit, and offset. ```bash curl "http://localhost:3000/api/usage/sessions?limit=10&offset=0" ``` -------------------------------- ### Scenario: Testing Different Tiers (Bash) Source: https://docs.ccs.kaitran.ca/tutorials/multi-account-setup Shows how to use different accounts, potentially associated with different service tiers (e.g., free vs. paid), to test behavior across these tiers. ```bash # Free tier account ccs agy --use free-tier "Test request" # Paid tier account ccs agy --use paid-tier "Test request" ``` -------------------------------- ### Quick Setup for Alibaba Coding Plan API Profile Source: https://docs.ccs.kaitran.ca/providers/concepts/api-profiles These commands set up the Alibaba Coding Plan API profile, which provides access to Qwen3 Coder models. Aliases 'alibaba' and 'acp' are also supported for convenience. This is useful for cost-effective coding tasks on Alibaba Cloud. ```bash ccs api create --preset alibaba-coding-plan # or use aliases: ccs api create --preset alibaba ccs api create --preset acp ``` -------------------------------- ### Get CLIProxy Service Status (Bash) Source: https://docs.ccs.kaitran.ca/reference/api-cliproxy Retrieves the current status of the CLIProxy service. It returns details such as whether the service is running, the port it's using, its process ID (PID), the number of active sessions, and the start time. This is useful for monitoring the health and operational state of the proxy. ```bash curl http://localhost:3000/api/cliproxy/proxy-status ``` -------------------------------- ### GitLab CI: Code Quality Gate Implementation Source: https://docs.ccs.kaitran.ca/tutorials/headless-ci-cd This GitLab CI configuration sets up a code quality gate. It installs the CCS tool, configures sessions, analyzes the code using the 'agy' command to get a quality score, and fails the pipeline if the score is below 7. This ensures that code merged into the repository meets a minimum quality standard. ```yaml stages: - test - review quality-check: stage: test image: node:20 before_script: - npm install -g @kaitranntt/ccs@latest - mkdir -p ~/.ccs/cliproxy - base64 -d $CCS_SESSIONS | tar -xzf - -C ~/.ccs/cliproxy script: - | ccs agy -p "Analyze code in src/ and rate quality 1-10. Output only the number." > score.txt SCORE=$(cat score.txt | grep -oE '[0-9]+' | head -1) echo "Code quality score: $SCORE/10" if [ "$SCORE" -lt 7 ]; then echo "Quality gate failed: score below 7" exit 1 fi only: - merge_requests ``` -------------------------------- ### Verify Ollama Installation Source: https://docs.ccs.kaitran.ca/providers/api/ollama Check if Ollama is installed and accessible on your system by verifying its version. This command is part of the Ollama installation prerequisite. ```bash ollama --version ``` -------------------------------- ### Execute GitHub Copilot Commands with CCS Source: https://docs.ccs.kaitran.ca/providers/oauth/ghcp Provides examples for executing commands using the CCS CLI with GitHub Copilot integration. This includes basic prompt execution and a one-shot mode for quick explanations. ```bash # Execute with GitHub Copilot ccs ghcp "your prompt" # One-shot mode ccs ghcp "explain this function" ``` -------------------------------- ### GET /api/usage/insights Source: https://docs.ccs.kaitran.ca/reference/api-usage Get usage anomalies and insights for cost optimization. ```APIDOC ## GET /api/usage/insights ### Description Get usage anomalies and insights for cost optimization. ### Method GET ### Endpoint /api/usage/insights ### Response #### Success Response (200) - **anomalies** (array) - List of detected anomalies. - **type** (string) - The type of anomaly (e.g., 'cost_spike', 'high_input'). - **date** (string) - The date the anomaly occurred. - **value** (float/integer) - The value associated with the anomaly. - **threshold** (float/integer) - The threshold that was exceeded. - **message** (string) - A human-readable message describing the anomaly. - **thresholds** (object) - The current thresholds used for anomaly detection. - **highInput** (integer) - Threshold for high input tokens. - **highIoRatio** (integer) - Threshold for high input-output ratio. - **costSpikeMultiplier** (integer) - Multiplier for detecting cost spikes. - **highCacheRead** (integer) - Threshold for high cache read tokens. #### Response Example ```json { "anomalies": [ { "type": "cost_spike", "date": "2026-01-04", "value": 5.20, "threshold": 2.50, "message": "Daily cost 208% above average" }, { "type": "high_input", "date": "2026-01-03", "value": 12000000, "threshold": 10000000, "message": "Input tokens exceeded 10M threshold" } ], "thresholds": { "highInput": 10000000, "highIoRatio": 100, "costSpikeMultiplier": 2, "highCacheRead": 1000000000 } } ``` **Anomaly Types:** * `cost_spike`: Daily cost significantly above average * `high_input`: Input tokens exceed 10M threshold * `high_io_ratio`: Input-to-output ratio exceeds 100:1 * `high_cache_read`: Cache read tokens exceed 1B ``` -------------------------------- ### iFlow Provider Basic Usage (Bash) Source: https://docs.ccs.kaitran.ca/providers/oauth/iflow Demonstrates basic command-line usage for the iFlow provider. This includes running a specific prompt for analysis and initiating an interactive chat session. ```bash # Run with iFlow ccs iflow "analyze this database schema" # Interactive chat ccs iflow ``` -------------------------------- ### GET /api/usage/daily Source: https://docs.ccs.kaitran.ca/reference/api-usage Get daily usage trends with per-day breakdowns. ```APIDOC ## GET /api/usage/daily ### Description Get daily usage trends with per-day breakdowns. ### Method GET ### Endpoint /api/usage/daily ### Response #### Success Response (200) - **daily** (array) - Array of daily usage objects. - **date** (string) - The date of the usage data. - **inputTokens** (integer) - Input tokens for the day. - **outputTokens** (integer) - Output tokens for the day. - **cacheReadTokens** (integer) - Cache read tokens for the day. - **cacheWriteTokens** (integer) - Cache write tokens for the day. - **cost** (float) - Cost for the day. - **modelsUsed** (array) - List of models used on that day. - **modelBreakdown** (object) - Breakdown of usage by model. - **[model_name]** (object) - Usage details for a specific model. - **inputTokens** (integer) - Input tokens for the model. - **outputTokens** (integer) - Output tokens for the model. - **cost** (float) - Cost for the model. #### Response Example ```json { "daily": [ { "date": "2026-01-05", "inputTokens": 450000, "outputTokens": 200000, "cacheReadTokens": 100000, "cacheWriteTokens": 25000, "cost": 1.85, "modelsUsed": ["claude-sonnet-4", "gemini-3-flash"], "modelBreakdown": { "claude-sonnet-4": { "inputTokens": 300000, "outputTokens": 150000, "cost": 1.35 }, "gemini-3-flash": { "inputTokens": 150000, "outputTokens": 50000, "cost": 0.50 } } } ] } ``` ``` -------------------------------- ### Troubleshoot GLMT Proxy Startup Timeout Source: https://docs.ccs.kaitran.ca/features/ai/glmt-controls Provides commands to help diagnose and resolve GLMT proxy startup timeouts. This includes trying a non-thinking mode, checking the Node.js version, verifying port usage, and enabling verbose logging for more details. ```bash # Try non-thinking mode ccs glm "your prompt" # Check Node.js version (Requires >=14) node --version # Check port usage netstat -an | grep 127.0.0.1 # Enable verbose details ccs glmt --verbose "test" ``` -------------------------------- ### GitHub Actions: Automated Documentation Generation Source: https://docs.ccs.kaitran.ca/tutorials/headless-ci-cd This GitHub Actions workflow automates the generation of API documentation. It checks out the code, installs the CCS tool, sets up sessions, generates Markdown documentation using the 'gemini' command, and commits the updated documentation back to the repository. ```yaml name: Generate Docs on: push: branches: [main] paths: - 'src/**' jobs: docs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install CCS run: npm install -g @kaitranntt/ccs@latest - name: Setup Sessions run: | mkdir -p ~/.ccs/cliproxy echo "${{ secrets.CCS_SESSIONS }}" | base64 -d | tar -xzf - -C ~/.ccs/cliproxy - name: Generate API Docs run: | ccs gemini -p "Generate API documentation from src/ directory in Markdown format" > docs/api.md - name: Commit Docs run: | git config user.name "AI Docs Bot" git config user.email "bot@example.com" git add docs/api.md git commit -m "docs: update API documentation [skip ci]" || exit 0 git push ``` -------------------------------- ### Shell Completion Installation Source: https://docs.ccs.kaitran.ca/reference/cli-commands Installs shell auto-completion scripts for bash, zsh, and fish. ```APIDOC ## POST /websites/ccs_kaitran_ca/shell-completion ### Description Installs shell auto-completion scripts for bash, zsh, and fish. ### Method POST ### Endpoint /websites/ccs_kaitran_ca/shell-completion ### Parameters #### Query Parameters - **shell** (string) - Optional - The shell to install completion for. Options: `bash`, `zsh`, `fish`. Defaults to auto-detection. ### Request Example ```bash ccs --shell-completion ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating completion installation. #### Response Example ```json { "message": "Shell completion installed successfully for bash." } ``` ``` -------------------------------- ### GET /api/usage/models Source: https://docs.ccs.kaitran.ca/reference/api-usage Get per-model usage statistics with cost breakdowns and I/O ratios. ```APIDOC ## GET /api/usage/models ### Description Get per-model usage statistics with cost breakdowns and I/O ratios. ### Method GET ### Endpoint /api/usage/models ### Response #### Success Response (200) - **models** (array) - Array of model usage statistics. - **model** (string) - The name of the model. - **inputTokens** (integer) - Input tokens for the model. - **outputTokens** (integer) - Output tokens for the model. - **cacheReadTokens** (integer) - Cache read tokens for the model. - **cacheWriteTokens** (integer) - Cache write tokens for the model. - **cost** (float) - Cost incurred by the model. - **percentage** (float) - Percentage of total cost attributed to the model. - **ioRatio** (float) - Input-to-output token ratio. - **totalCost** (float) - Total cost across all models. #### Response Example ```json { "models": [ { "model": "claude-sonnet-4", "inputTokens": 8000000, "outputTokens": 3500000, "cacheReadTokens": 1500000, "cacheWriteTokens": 400000, "cost": 32.50, "percentage": 71.4, "ioRatio": 2.29 }, { "model": "gemini-3-flash", "inputTokens": 2000000, "outputTokens": 1500000, "cost": 13.00, "percentage": 28.6, "ioRatio": 1.33 } ], "totalCost": 45.50 } ``` ``` -------------------------------- ### Antigravity Provider Multi-Account Management (Bash) Source: https://docs.ccs.kaitran.ca/providers/oauth/agy Illustrates commands for managing multiple Antigravity accounts, including adding new accounts, listing all authenticated accounts with their quota status, switching between accounts, and renaming accounts. ```bash # Add new account (preserves existing) ccs agy --auth --add # Show all authenticated Antigravity accounts ccs agy --accounts # Output: # Accounts for agy: # [default] work (work@company.com) - Quota: 85% # personal (personal@gmail.com) - Quota: 12% # Switch to specific account by nickname ccs agy --use personal # Next command uses personal's account ccs agy "your prompt" # Rename default account nickname ccs agy --nickname main-account ``` -------------------------------- ### Add a New Qwen Account Source: https://docs.ccs.kaitran.ca/providers/oauth/qwen Add a new Qwen account for authentication, preserving any existing accounts. This allows managing multiple Qwen accounts for different projects or purposes. ```bash # Add new account (preserves existing) ccs qwen --auth --add ``` -------------------------------- ### Install Gemini CLI Source: https://docs.ccs.kaitran.ca/features/ai/websearch Install the Gemini CLI tool using npm. This is the first priority tool in the WebSearch fallback chain. ```bash npm install -g @google/gemini-cli ```