Back to Cc Switch

4.4 Usage Statistics

docs/user-manual/en/4-proxy/4.4-usage.md

3.14.110.3 KB
Original Source

4.4 Usage Statistics

Overview

The usage statistics feature records and analyzes API request data, helping you:

  • Understand API usage patterns
  • Estimate cost expenditure
  • Analyze usage patterns
  • Troubleshoot issues

Starting from v3.13.0, usage data comes from two sources:

Data SourceCoverageProxy Interception Required?
Proxy request logAll requests forwarded through the proxyYes
CLI session log (new in v3.13)Claude / Codex / Gemini session historyNo
  • Codex sessions: Switched to precise parsing based on JSONL session logs, replacing the previous estimation; model names are normalized for consistent pricing lookup
  • Gemini sessions: Synced precisely from Gemini CLI session logs
  • Claude sessions: Also supports direct usage import from session logs
  • The usage panel supports per-app filtering (Claude / Codex / Gemini) so data from different apps does not mix

Prerequisites

Depending on which data source you use, the prerequisites differ:

Proxy request log (covers all apps and all proxy requests):

  1. Proxy service started
  2. App takeover enabled
  3. Log recording enabled

CLI session log (new in v3.13, no proxy required):

  1. The corresponding app (Claude / Codex / Gemini) is enabled in CC Switch
  2. The corresponding CLI has session history files
  3. CC Switch periodically scans session directories and imports usage data

Open Usage Statistics

Settings > Usage Tab

Statistics Overview

Summary Cards

Key metrics displayed at the top of the page:

MetricDescription
Total RequestsTotal number of requests in the time period
Total TokensTotal input + output tokens
Estimated CostCost calculated based on pricing configuration
Success RatePercentage of successful requests

Time Range

Select the time range for statistics:

OptionRange
TodayFrom 00:00 today to now
Last 7 DaysPast 7 days
Last 30 DaysPast 30 days

Trend Charts

Request Trend

Line chart showing the trend of request counts:

  • X-axis: Time
  • Y-axis: Request count
  • Viewable by hour/day
  • Supports zoom and drag

Token Trend

Shows token usage trends:

  • Input Tokens (blue) - Prompt content sent by the user
  • Output Tokens (green) - Response content generated by AI
  • Cache Creation Tokens (orange) - Tokens consumed when first creating cache
  • Cache Hit Tokens (purple) - Tokens saved by reusing cache
  • Cost (red dashed line, right Y-axis) - Estimated cost

Cache Token explanation: Anthropic API supports Prompt Caching. Creating cache incurs a higher fee (typically 1.25x input price), but subsequent cache hits only charge 0.1x, significantly reducing costs for repeated requests.

Time Granularity

  • Today: Displayed by hour (24 data points)
  • 7 Days/30 Days: Displayed by day

Detailed Data

Three data tabs at the bottom of the page:

Request Logs

Detailed record of each request:

FieldDescription
TimeRequest time
ProviderProvider name used
ModelRequested model (billing model)
Input TokensNumber of input tokens
Output TokensNumber of output tokens
Cache ReadCache hit token count
Cache CreationCache creation token count
Total CostEstimated cost (USD)
Timing InfoRequest duration, time to first token, streaming/non-streaming
StatusHTTP status code

Timing Information

The timing info column displays multiple badges:

BadgeDescriptionColor Rules
Total DurationTotal request time (seconds)<=5s green, <=120s orange, >120s red
First TokenTime to first token in streaming requests<=5s green, <=120s orange, >120s red
Stream/Non-streamRequest typeStreaming blue, non-streaming purple

View Details

Click a request row to view detailed information:

  • Complete request parameters
  • Response content summary
  • Error messages (if failed)

Filter Logs

Supports filtering by the following criteria:

FilterOptions
App TypeAll / Claude / Codex / Gemini
Status CodeAll / 200 / 400 / 401 / 429 / 500
ProviderText search
ModelText search
Time RangeStart time - End time (datetime picker)

Action buttons:

  • Search: Apply filter criteria
  • Reset: Restore defaults (past 24 hours)
  • Refresh: Reload data

Provider Statistics

Statistics grouped by provider:

FieldDescription
ProviderProvider name
RequestsTotal requests for this provider
SuccessesNumber of successful requests
FailuresNumber of failed requests
Success RateSuccess percentage
Total TokensTotal token usage
Estimated CostCost for this provider

Model Statistics

Statistics grouped by model:

FieldDescription
ModelModel name
RequestsTotal requests for this model
Input TokensTotal input tokens
Output TokensTotal output tokens
Avg LatencyAverage response time
Estimated CostCost for this model

Pricing Configuration

Open Pricing Configuration

Settings > Advanced > Pricing Configuration

Configure Model Prices

Set prices for each model (per million tokens):

FieldDescription
Model IDModel identifier (e.g., claude-3-sonnet)
Display NameCustom display name
Input PricePrice per million input tokens
Output PricePrice per million output tokens
Cache Read PricePrice per million cache hit tokens
Cache Creation PricePrice per million cache creation tokens

Model ID Normalization Rules

Before matching pricing, CC Switch normalizes the requested model ID:

  • Remove everything before the last /
  • Remove everything after :
  • Replace @ with -

When adding pricing entries, enter the normalized Model ID rather than the full raw model name from the request.

Raw model nameModel ID to enterNote
stepfun-ai/step-3.5-flashstep-3.5-flashRemoves the provider prefix
moonshotai/kimi-k2-0905:exakimi-k2-0905Removes the prefix and the : suffix
gpt-5.2-codex@lowgpt-5.2-codex-lowReplaces @ with -

Operations

  • Add: Click the "Add" button to add model pricing
  • Edit: Click the edit icon at the end of the row to modify
  • Delete: Click the delete icon at the end of the row to remove

Preset Prices

CC Switch includes preset official prices for common models (per million tokens). v3.13.0 corrects CNY → USD pricing for several models and adds previously missing model definitions; it also fixes MiniMax plan quota math and the 0% → 100% usage progress display, making cost estimates and plan progress more accurate.

Claude Series (USD):

ModelInputOutputCache ReadCache Creation
Claude 4.5 Series
claude-opus-4-5$5$25$0.50$6.25
claude-sonnet-4-5$3$15$0.30$3.75
claude-haiku-4-5$1$5$0.10$1.25
Claude 4 Series
claude-opus-4$15$75$1.50$18.75
claude-opus-4-1$15$75$1.50$18.75
claude-sonnet-4$3$15$0.30$3.75
Claude 3.5 Series
claude-3-5-sonnet$3$15$0.30$3.75
claude-3-5-haiku$0.80$4$0.08$1.00

OpenAI Series / Codex (USD):

ModelInputOutputCache Read
GPT-5.2 Series
gpt-5.2$1.75$14$0.175
GPT-5.1 Series
gpt-5.1$1.25$10$0.125
GPT-5 Series
gpt-5$1.25$10$0.125

Note: Codex presets include low/medium/high variants with prices identical to the base model.

Gemini Series (USD):

ModelInputOutputCache Read
Gemini 3 Series
gemini-3-pro-preview$2$12$0.20
gemini-3-flash-preview$0.50$3$0.05
Gemini 2.5 Series
gemini-2.5-pro$1.25$10$0.125
gemini-2.5-flash$0.30$2.50$0.03

Chinese Provider Models:

Note: Currency follows each provider's official pricing page. StepFun is currently listed in USD.

ModelInputOutputCache Read
StepFun
step-3.5-flash$0.10$0.30$0.02
DeepSeek
deepseek-v3.2¥2.00¥3.00¥0.40
deepseek-v3.1¥4.00¥12.00¥0.80
deepseek-v3¥2.00¥8.00¥0.40
Kimi (Moonshot)
kimi-k2-thinking¥4.00¥16.00¥1.00
kimi-k2¥4.00¥16.00¥1.00
kimi-k2-turbo¥8.00¥58.00¥1.00
MiniMax
minimax-m2.1¥2.10¥8.40¥0.21
minimax-m2.1-lightning¥2.10¥16.80¥0.21
Others
glm-4.7¥2.00¥8.00¥0.40
doubao-seed-code¥1.20¥8.00¥0.24
mimo-v2-flashFreeFree-

Custom Prices

If using proxy services, prices may differ:

  1. Click the "Edit" button
  2. Modify prices
  3. Save

FAQ

Statistics Data Is Empty

Check:

  • Is the proxy service running
  • Is app takeover enabled
  • Is log recording enabled
  • Have requests been going through the proxy

Cost Estimates Are Inaccurate

Possible causes:

  • Pricing configuration doesn't match actual prices
  • Using a proxy service with special pricing

Solutions:

  • Update pricing configuration
  • Refer to the provider's actual invoices

Token Count Differs from Provider

CC Switch uses its own method to estimate token counts, which may slightly differ from the provider's calculation. Refer to the provider's invoice for authoritative numbers.