From a058ebeafc3ab7b046bd38ff9be5e630c7764af7 Mon Sep 17 00:00:00 2001 From: Jason Date: Thu, 9 Apr 2026 11:14:29 +0800 Subject: [PATCH] docs(user-manual): update to v3.13.0 across en/zh/ja Refresh the user manual to cover the v3.13.0 feature set so users can discover and correctly use new functionality without cross-referencing the release notes. All three language versions are updated line-by-line symmetric. Highlights: - Lightweight Mode: tray-only running state added in 1.5-settings, with a comparison table against "Minimize to tray" and a new OAuth Auth Center (Beta) section - Quota & Balance display restructured in 2.5-usage-query: split into auto-query (Claude/Codex/Gemini official, Copilot, Codex OAuth) vs manual-enable (Token Plan, third-party balances). Explains why manual enabling is required: the same API URL may expose both plan-quota and balance query modes - Codex OAuth reverse proxy: full usage guide in 2.1-add with two entry points (Add Provider panel / OAuth Auth Center), Device Code login flow, token auto-refresh, multi-account management, quota display, common failures, and risk notice - Full URL Endpoint Mode: new advanced option in 2.1-add - Per-app tray submenus: 2.2-switch refactored to reflect the 5-app submenu structure and cross-link to Lightweight Mode - Skills workflow: remove obsolete "automatic update not supported" section in 3.3-skills, add SHA-256 update detection, single/batch update, storage location switch, and skills.sh registry search - Directory picker for Claude terminal resume in 3.4-sessions - Usage stats in 4.4-usage: document the new CLI session log source (no proxy required) and per-app filtering for Claude/Codex/Gemini; note CNY->USD pricing corrections and MiniMax quota fixes - Stream Check coverage extended to OpenCode/OpenClaw in 4.5-model-test - New FAQs in 5.2-questions: quota visibility (auto vs manual), Codex OAuth risks and login flow, deep link wake in Lightweight Mode - v3.13.0 highlights navigation block added to top-level README and each per-language README; version bumped to v3.13.0 / 2026-04-08 --- docs/user-manual/README.md | 6 +- .../en/1-getting-started/1.5-settings.md | 40 +++++ docs/user-manual/en/2-providers/2.1-add.md | 166 ++++++++++++++++- docs/user-manual/en/2-providers/2.2-switch.md | 20 ++- .../en/2-providers/2.5-usage-query.md | 86 ++++++++- .../user-manual/en/3-extensions/3.3-skills.md | 68 ++++++- .../en/3-extensions/3.4-sessions.md | 16 ++ docs/user-manual/en/4-proxy/4.4-usage.md | 24 ++- docs/user-manual/en/4-proxy/4.5-model-test.md | 17 +- docs/user-manual/en/5-faq/5.2-questions.md | 49 +++++ docs/user-manual/en/README.md | 16 +- .../ja/1-getting-started/1.5-settings.md | 40 +++++ docs/user-manual/ja/2-providers/2.1-add.md | 168 +++++++++++++++++- docs/user-manual/ja/2-providers/2.2-switch.md | 20 ++- .../ja/2-providers/2.5-usage-query.md | 86 ++++++++- .../user-manual/ja/3-extensions/3.3-skills.md | 68 ++++++- .../ja/3-extensions/3.4-sessions.md | 16 ++ docs/user-manual/ja/4-proxy/4.4-usage.md | 24 ++- docs/user-manual/ja/4-proxy/4.5-model-test.md | 17 +- docs/user-manual/ja/5-faq/5.2-questions.md | 59 +++++- docs/user-manual/ja/README.md | 16 +- .../zh/1-getting-started/1.5-settings.md | 40 +++++ docs/user-manual/zh/2-providers/2.1-add.md | 168 +++++++++++++++++- docs/user-manual/zh/2-providers/2.2-switch.md | 20 ++- .../zh/2-providers/2.5-usage-query.md | 86 ++++++++- .../user-manual/zh/3-extensions/3.3-skills.md | 68 ++++++- .../zh/3-extensions/3.4-sessions.md | 16 ++ docs/user-manual/zh/4-proxy/4.4-usage.md | 24 ++- docs/user-manual/zh/4-proxy/4.5-model-test.md | 17 +- docs/user-manual/zh/5-faq/5.2-questions.md | 49 +++++ docs/user-manual/zh/README.md | 16 +- 31 files changed, 1441 insertions(+), 85 deletions(-) diff --git a/docs/user-manual/README.md b/docs/user-manual/README.md index 313733fd3..3a2bfec73 100644 --- a/docs/user-manual/README.md +++ b/docs/user-manual/README.md @@ -12,9 +12,9 @@ ## Version / 版本 / バージョン -- Documentation version: v3.12.3 -- Last updated: 2026-04-02 -- Compatible with CC Switch v3.12.0+ +- Documentation version: v3.13.0 +- Last updated: 2026-04-08 +- Compatible with CC Switch v3.13.0+ ## Links diff --git a/docs/user-manual/en/1-getting-started/1.5-settings.md b/docs/user-manual/en/1-getting-started/1.5-settings.md index 99b5032aa..83d1c4a88 100644 --- a/docs/user-manual/en/1-getting-started/1.5-settings.md +++ b/docs/user-manual/en/1-getting-started/1.5-settings.md @@ -46,6 +46,26 @@ When enabled, CC Switch automatically runs when the system starts. "Minimize to tray" is recommended for convenient provider switching via the tray. +### Lightweight Mode + +Starting from v3.13.0, CC Switch adds **Lightweight Mode** — a **tray-only** running state that minimizes desktop footprint when idle. + +**How to enter**: Right-click the tray icon → click **Lightweight Mode**. The main window is **destroyed** (not just hidden), freeing UI resources and memory. + +**How to exit**: Click **Open Main Window** from the tray menu, or trigger CC Switch via deep link / relaunch. The window is **rebuilt on demand**, with state preserved. + +| Aspect | Minimize to Tray | Lightweight Mode | +|--------|------------------|------------------| +| UI process | Kept in memory | Fully destroyed | +| Idle resource footprint | Same as normal run | Near zero | +| Reopen speed | Instant (direct show) | Slightly slower (window rebuild) | +| Tray switching | Available | Available | +| Deep link wake | Available | Available (on-demand rebuild) | + +> **Use case**: If CC Switch runs in the background for long periods and you mainly switch providers via the tray menu, enabling Lightweight Mode significantly reduces memory usage. + +> **Note**: Lightweight Mode state is not persistent — the next normal launch returns to normal mode. Combine with Launch on Startup for long-term use. + ### Claude Plugin Integration When enabled, CC Switch automatically syncs the configuration to the VS Code Claude Code extension (writes `primaryApiKey` to `~/.claude/config.json`) when switching providers. @@ -251,6 +271,26 @@ Log level descriptions: - **debug** - Detailed debugging information - **trace** - All verbose information +## OAuth Auth Center (Beta) + +Settings > **OAuth Auth Center** Tab + +Added in v3.13.0, the **OAuth Auth Center** (Beta) provides unified management for third-party OAuth credentials. It currently supports two account types: + +| Account Type | Purpose | +| ------------------------- | ---------------------------------------------------------- | +| **GitHub Copilot** | Used with the Copilot reverse proxy | +| **ChatGPT (Codex OAuth)** | Used with the Codex OAuth reverse proxy; manage ChatGPT accounts | + +**What you can do here**: + +- Log in to ChatGPT / GitHub accounts via the Device Code flow +- View the list of logged-in accounts and authentication status +- Set a default account when managing multiple accounts +- Remove individual accounts or log out all accounts at once + +> **Note**: Both features use reverse-engineered OAuth flows and carry account risk and Terms of Service risk. Before using, please read the full risk notice in [2.1 Add Provider → Codex OAuth Reverse Proxy](../2-providers/2.1-add.md#codex-oauth-reverse-proxy-claude-provider). + ## About Page Settings > About Tab diff --git a/docs/user-manual/en/2-providers/2.1-add.md b/docs/user-manual/en/2-providers/2.1-add.md index 2fa07ce68..d8e2a4ad6 100644 --- a/docs/user-manual/en/2-providers/2.1-add.md +++ b/docs/user-manual/en/2-providers/2.1-add.md @@ -154,19 +154,20 @@ Presets are pre-configured provider templates that only require an API Key to us ## Auto-Fetch Models -When adding or editing a provider, you can auto-fetch available models from the provider's endpoint: +When adding or editing a provider, you can automatically discover available models from the provider's endpoint — eliminating the tedious copy-and-paste of model IDs. 1. Ensure the **API Key** and **Endpoint URL** are filled in 2. Click the **Fetch Models** button (download icon) next to the model input field -3. CC Switch calls the provider's `/v1/models` endpoint to retrieve the model list -4. Select a model from the dropdown, grouped by vendor +3. CC Switch uses the configured API Key to call the OpenAI-compatible `/v1/models` endpoint +4. Select a model from the dropdown, grouped by category -This feature works for any provider that supports the OpenAI-compatible `/v1/models` API. It is available for Claude, Codex, Gemini, OpenCode, and OpenClaw providers. +This feature covers **all five apps** — **Claude / Codex / Gemini / OpenCode / OpenClaw** — and works for any provider that supports the `/v1/models` endpoint. **Common errors:** - **Authentication failed (401/403)**: Check your API Key -- **Endpoint not supported (404/405)**: The provider does not expose a `/v1/models` endpoint -- **Timeout**: The endpoint is slow to respond; try again later +- **Endpoint not supported (404/405)**: The provider does not expose a `/v1/models` endpoint; fall back to manual model ID entry +- **Parse failure**: The response does not match the OpenAI-compatible format +- **Timeout**: The endpoint is slow to respond; try again later or check your network ## Custom Configuration @@ -330,6 +331,135 @@ Batch import from SQL backup files: > **Note**: Importing will overwrite the existing database. It is recommended to export your current configuration as a backup first. The exported file name format is `cc-switch-export-{timestamp}.sql`. +## Codex OAuth Reverse Proxy (Claude Provider) + +Starting from v3.13.0, CC Switch adds a **Codex OAuth reverse proxy** path that lets you reuse your ChatGPT account's Codex service inside Claude Code. + +> **Location hint**: This feature appears as a **new Claude provider card type**, not as a Codex-side preset. Once added, it sits alongside regular API-Key providers in the Claude provider list. + +### Prerequisites + +- A **ChatGPT account** you can log in to +- Network access to `auth.openai.com` and `chatgpt.com` +- **Before using, please read the [⚠️ Risk Notice](#️-risk-notice-important) at the end of this section** + +### Two Entry Points + +You can start from either entry point: + +#### Entry A: From the Add Provider panel (recommended for new users) + +1. Switch to the **Claude** app +2. Click the **+** button in the top-right to open the Add Provider panel +3. Under the third-party category, select the **Codex (ChatGPT Plus/Pro)** preset (use the name as shown in the UI) +4. If no ChatGPT account is logged in yet, the panel **automatically guides** you into the login flow (see "Login Flow" below) +5. After login succeeds, the provider form shows the logged-in account — click **Save** to finish + +#### Entry B: From the OAuth Auth Center (better for multi-account management) + +1. Open **Settings → OAuth Auth Center** (tab marked with a **Beta** label) +2. In the **ChatGPT (Codex OAuth)** section, click **Log in with ChatGPT** +3. Complete the login flow (see below) +4. Once logged in, return to the **Claude** app → **Add Provider** → select the same Codex (ChatGPT Plus/Pro) preset +5. In the form's **Select Account** dropdown, choose the account you just logged in and save + +### Login Flow (Device Code) + +No matter which entry point you use, the login flow is the same: + +1. **Get the verification code**: CC Switch invokes OpenAI's Device Code flow and displays: + - An **8-character verification code** (e.g., `ABCD-1234`) + - A **Copy** button next to the code + - The authorization URL `https://auth.openai.com/codex/device` + - An "Waiting for authorization..." animation +2. **Browser authorization**: Click the link (or manually visit the URL) and in the browser: + - Log in to your ChatGPT account + - Enter the verification code you copied + - Confirm authorization +3. **Automatic polling**: CC Switch keeps polling the OpenAI server in the background and closes the waiting UI once authorization succeeds +4. **Account appears in the list**: The logged-in ChatGPT account (login email) shows up in **OAuth Auth Center → Logged-in Accounts** + +> ⏱️ **Verification codes are valid for about 15 minutes**. If it expires, the UI shows "Device Code has expired" — click **Retry** to get a new one. + +### Enable and Use + +After adding and saving a Codex OAuth provider: + +1. Find it in the Claude provider list +2. Click the **Enable** button on the card — same as any regular provider +3. Claude Code CLI then uses the reverse proxy to access the Codex service +4. The provider also appears in the tray menu's **Claude** submenu for quick switching + +> **Under the hood**: CC Switch routes requests to `https://chatgpt.com/backend-api/codex`, with the base URL forcibly rewritten — you **do not** need to manually fill in the endpoint. The API format is fixed to `openai_responses`. + +### Default Models + +The Codex OAuth preset's default model mapping: + +| Role | Default Model | +| -------------- | ------------- | +| Main model | `gpt-5.4` | +| Sonnet role | `gpt-5.4` | +| Opus role | `gpt-5.4` | +| Haiku role | `gpt-5.4-mini` | + +You can override the `ANTHROPIC_MODEL` and related environment variables in the provider's JSON editor to customize. + +### Multi-Account Management (OAuth Auth Center) + +The **OAuth Auth Center** supports managing multiple ChatGPT accounts at the same time: + +| Action | Description | +| ---------------------- | ----------------------------------------------------------------- | +| Add another account | Click **Add Another Account** to repeat the login flow | +| Set as default | Click **Set as Default** on an account row — new providers use it | +| Choose for a provider | In the provider form, use the **Select Account** dropdown | +| Remove account | Click the red × next to an account (the token is cleared) | +| Log out all accounts | The **Log Out All Accounts** button at the bottom clears all | + +> **Use case**: If you share a dev machine with teammates, create one provider per member's ChatGPT account and switch between them via the tray menu. + +### Token Auto-Refresh + +- Tokens are **automatically refreshed 60 seconds before expiry**, fully in the background — no manual action required +- Refresh tokens are stored in the local data directory and are never uploaded anywhere +- **Token export is not supported** (to prevent leaks) + +### Quota Display + +After login and enabling the provider, the **bottom of the provider card** automatically shows the account quota: + +| Display Element | Example | Color Rules | +| ------------------- | ---------------- | -------------------------------------------- | +| Usage percentage | `45%` | < 70% green, 70–89% orange, ≥ 90% red | +| Reset countdown | `7d12h until reset` | ChatGPT account's sliding window or daily limit | +| Refresh button | Circular arrow | Manually re-query quota | + +> ⚠️ **Session Expired**: If the token fails to refresh, the card displays a yellow "Session Expired" warning. Go to the **OAuth Auth Center**, remove the account, and log in again. + +### Common Failures + +| Scenario | Symptom | Resolution | +| --------------------------- | -------------------------------- | ------------------------------------------- | +| Verification code timeout | "Device Code has expired" shown | Click **Retry** to get a new code | +| Authorization denied | "User denied authorization" | Retry and click "Authorize" in the browser | +| Network error | Specific error details shown | Check network, confirm access to OpenAI domains | +| Not logged in before adding | "Please log in to ChatGPT first" | Complete login in OAuth Auth Center first | +| Token refresh failed | "Session Expired" in quota box | Remove the account and log in again | +| Quota query failed | "Query failed" in quota box | Click the **Refresh** button to retry | + +### ⚠️ Risk Notice (Important) + +The Codex OAuth reverse proxy accesses your ChatGPT account's Codex service through a **reverse-engineered OAuth flow**. Before enabling, please make sure you understand the following risks: + +1. **Terms of Service violations**: May violate OpenAI's Terms of Service, which prohibit unauthorized automated access, service replication, and bypassing established access paths +2. **Account risk**: OpenAI may flag unusual usage patterns as suspicious automation and impose temporary or permanent restrictions on your ChatGPT account +3. **No guarantee of long-term availability**: OpenAI may update its authentication and detection mechanisms at any time, and currently available methods may be blocked in the future + +**By enabling this feature, you assume all risks**. CC Switch is not responsible for any account restrictions, warnings, or service suspensions resulting from its use. + +> 📖 See the full disclaimer and background in the [v3.13.0 Release Notes](../../../release-notes/v3.13.0-en.md#️-risk-notice). + ## Advanced Options ### API Format (Claude Only) @@ -346,6 +476,30 @@ When adding a Claude provider that uses a third-party API, you may need to selec The Advanced Options section auto-expands when a non-default API format is configured. +### Full URL Endpoint Mode + +Added in v3.13.0. By default, CC Switch treats the configured `base_url` as a **prefix** and appends fixed paths like `/v1/chat/completions`. For some vendors (such as third-party services with non-standard URL layouts), this path concatenation causes requests to fail. + +**How to enable**: + +1. Edit the provider and expand **Advanced Options** +2. Check the **Full URL Mode** checkbox +3. Fill in the **complete upstream endpoint** (not a prefix) as `base_url` + +**Example comparison**: + +| Mode | `base_url` value | Actual request target | +| ------------------------- | ------------------------------------------------ | ------------------------------------------------ | +| Default (prefix concat) | `https://api.example.com` | `https://api.example.com/v1/chat/completions` | +| **Full URL Mode** | `https://api.example.com/custom/path/messages` | `https://api.example.com/custom/path/messages` | + +**When to use**: +- The vendor requires a non-standard path (not `/v1/chat/completions`) +- The vendor has a multi-level path structure +- Vendor-specific API gateway paths + +> **Note**: Both proxy forwarding and Stream Check respect the Full URL Mode setting, so no extra adjustments are needed after enabling. Disabling this option restores default path concatenation. + ### Claude Common Config Toggles When editing Claude providers, a set of **quick toggles** is available above the JSON editor: diff --git a/docs/user-manual/en/2-providers/2.2-switch.md b/docs/user-manual/en/2-providers/2.2-switch.md index 5b131ac71..688597823 100644 --- a/docs/user-manual/en/2-providers/2.2-switch.md +++ b/docs/user-manual/en/2-providers/2.2-switch.md @@ -30,10 +30,26 @@ Quickly switch providers via the system tray without opening the main interface. 3. Click the provider name you want to switch to 4. Switching completes with a brief tray notification -> Providers are organized into collapsible submenus by app type (Claude/Codex/Gemini). The submenu title shows the currently active provider name. - ### Tray Menu Structure +Starting from v3.13.0, the tray menu is refactored from a flat list into **per-app submenus**, with a dedicated submenu for each app: + +| Submenu | Description | +| ---------- | -------------------------------------------------------------- | +| Claude | All Claude providers (including Codex OAuth reverse proxy) | +| Codex | All Codex providers | +| Gemini | All Gemini providers | +| OpenCode | All OpenCode providers | +| OpenClaw | All OpenClaw providers | + +**Benefits of the refactor**: + +- **Prevents menu overflow**: With many providers, a flat list would exceed screen height; per-app submenus scale naturally +- **Submenu title shows the currently active provider**: You know at a glance which provider each app is using, without opening the submenu +- **Per-app isolation**: Switching Claude's provider doesn't disturb the Codex view + +> **Tip**: The combination of background residency + Lightweight Mode + per-app submenus is especially suited for heavy users who frequently switch among multiple apps. See [1.5 Personalization → Lightweight Mode](../1-getting-started/1.5-settings.md). + ![image-20260108004348993](../../assets/image-20260108004348993.png) ## Activation Methods diff --git a/docs/user-manual/en/2-providers/2.5-usage-query.md b/docs/user-manual/en/2-providers/2.5-usage-query.md index c9d782941..922341853 100644 --- a/docs/user-manual/en/2-providers/2.5-usage-query.md +++ b/docs/user-manual/en/2-providers/2.5-usage-query.md @@ -1,8 +1,72 @@ # 2.5 Usage Query -## Overview +CC Switch's quota / balance display is split into two categories: **Auto Query** (official subscription types, works out of the box) and **Manual Enable** (built-in templates + custom scripts, requires user configuration before showing). -The usage query feature allows you to configure custom scripts to query a provider's remaining balance, used amount, and other information in real time. +| Category | Scope | User Enable Required | +| ------------------------------ | -------------------------------------------------------------------------- | -------------------- | +| **Auto Query** | Claude / Codex / Gemini official subscriptions, GitHub Copilot, Codex OAuth reverse proxy | No (enabled by default) | +| **Manual Enable (built-in templates)** | Token Plan, third-party balance query | Yes (see below) | +| **Manual Enable (custom script)** | Proxies, private deployments, special APIs not covered by built-in templates | Yes (see below) | + +## Auto Query (Official Subscription Types) + +Starting from v3.13.0, the following three categories automatically display the quota at the bottom of the provider card after the provider is enabled — no additional configuration required: + +| Category | Covered Providers | Displayed Content | +| ---------------- | ----------------------------------------------------- | ----------------------------------------- | +| Official subscriptions | Claude / Codex / Gemini official login | Official subscription quota | +| GitHub Copilot | Copilot provider card | Premium interactions remaining | +| Codex OAuth | Codex OAuth reverse proxy card (Claude provider) | ChatGPT account Codex quota | + +These three share the common trait that **their data source is unique and semantically unambiguous** (the usage rate of an official subscription), so CC Switch directly calls the corresponding official or OAuth query endpoint. + +### Auto Query Interactions + +- **Card footer display**: Usage percentage + reset countdown, colored by usage (< 70% green / 70–89% orange / ≥ 90% red) +- **Manual refresh**: Click the refresh icon on the card to re-query +- **Simplified card**: For these three types, the **Health Check** and **Usage Query Config** buttons are hidden to avoid interfering with the built-in display +- **Session expired notice**: If a token fails to refresh, the card shows a yellow "Session Expired" warning (Copilot / Codex OAuth) + +--- + +## Manual Enable (Built-in Templates + Custom Scripts) + +Besides the three auto-query types above, **all other providers** (including Token Plan, third-party balance queries, and various proxy services) need to have the **Usage Query** switch manually turned on in the provider card before any quota is displayed. + +### Why do these need manual enabling? + +One important reason: **the same request URL (same vendor) may expose multiple query modes** — for example, both plan-based quota queries and account-level balance queries. CC Switch cannot automatically infer which one you want, so the built-in query for such providers is **disabled by default**, leaving you to pick the right template. + +### Built-in Template Coverage + +v3.13.0 provides **ready-to-use built-in templates** for the following categories — no script writing required: + +| Category | Covered Providers | Template Type | +| ------------------ | --------------------------------------------------------- | ------------------------------- | +| Token Plan | Kimi / Zhipu GLM / MiniMax | Plan quota (with usage progress) | +| Third-party balance| DeepSeek / StepFun / SiliconFlow / OpenRouter / Novita AI | Official balance query | + +> **Tip**: Beyond these built-in templates, for uncovered providers you can use the **custom script** approach (see below) to write your own query logic. + +### Enable Steps + +1. Hover over the provider card to reveal action buttons +2. Click the **Usage Query** button (chart icon) +3. At the top of the configuration panel, toggle on **Enable Usage Query** +4. Select the right built-in template (e.g., Token Plan, third-party balance) or choose "Custom" +5. Fill in API Key / Base URL / Access Token as needed (most cases can be left blank, reusing the provider's own credentials) +6. Click **Test Script** to verify the query returns successfully +7. Save — next time the provider is activated, the quota will show up at the bottom of the card + +> ⚠️ **Note**: The auto-refresh interval after enabling is controlled by the "Auto Query Interval" field (set to `0` to disable auto-refresh). Background queries only trigger when the provider is in "Currently Active" state. + +--- + +## Custom Script Query (Advanced) + +### Overview + +When a provider **is not covered by the built-in templates**, you can write a custom JavaScript query script. Suitable for proxy services, private deployments, special API formats, etc. **Use cases**: - Check API account remaining balance @@ -155,6 +219,24 @@ The following placeholders can be used in scripts and are automatically replaced ### Troubleshooting +### Auto Query Not Displayed (Official Subscription Types) + +**Check**: +1. Confirm the provider is an official subscription type — Claude / Codex / Gemini official login, GitHub Copilot, or Codex OAuth reverse proxy +2. The provider is in "Currently Active" state (inactive providers do not trigger queries) +3. For OAuth types (Copilot / Codex OAuth), check whether the token is still valid; if the card shows "Session Expired", log in again in the **OAuth Auth Center** +4. Network access to the official quota endpoint + +### Manual Enable Still Not Showing Quota + +**Check**: +1. Whether the **Enable Usage Query** toggle at the top of the "Usage Query" panel is on +2. Whether a suitable built-in template (Token Plan / third-party balance / custom) is selected +3. Click **Test Script** to see the specific error +4. Required fields such as API Key / Base URL are filled correctly +5. Network access to the provider's quota endpoint +6. Background auto-refresh only triggers when the provider is in "Currently Active" state + ### Query Failed **Check**: diff --git a/docs/user-manual/en/3-extensions/3.3-skills.md b/docs/user-manual/en/3-extensions/3.3-skills.md index 80736c57e..9c42913c6 100644 --- a/docs/user-manual/en/3-extensions/3.3-skills.md +++ b/docs/user-manual/en/3-extensions/3.3-skills.md @@ -192,11 +192,59 @@ Each skill card displays: ## Skill Updates -Automatic updates are not currently supported. To update a skill: +Starting from v3.13.0, Skills support **automatic update detection** and **batch updates** — no more uninstall-and-reinstall. -1. Uninstall the existing skill -2. Refresh the list -3. Reinstall +### Update Detection Mechanism + +CC Switch compares installed skills with the remote repository version using **SHA-256 content hashes**. Whenever the remote has any content changes, the corresponding local skill card automatically shows an "Update available" indicator. + +### Single Update + +For a skill with an available update: + +1. Find the skill card with the update indicator in the Skills panel +2. Click the **Update** button on the card +3. Wait for the download to finish — status refreshes automatically + +### Update All + +When multiple skills need updating: + +1. Click the **Update All** button at the top of the Skills panel (appears with a slide-in animation) +2. CC Switch batch-downloads all skills with pending updates +3. The panel refreshes automatically when done, and the update indicators disappear + +> **Tip**: Regularly click the **Refresh** button to trigger a remote scan so update detection stays current. + +## Storage Location Switch + +Starting from v3.13.0, the **source storage location** for skills can be switched between two locations: + +| Location | Description | +| ------------------------ | --------------------------------------------------------------------- | +| **CC Switch built-in** | Default location `~/.cc-switch/skills/`, managed by CC Switch | +| **`~/.agents/skills`** | A shared directory conforming to community agent tool conventions, better for cross-tool collaboration | + +### How to Switch + +Select the target storage location from the settings or management menu in the Skills panel. The switch **does not lose skill state** — CC Switch smoothly migrates existing skills to the new location. + +> ⚠️ **Distinction**: The "Storage Location Switch" here manages the **source storage** of skills. In contrast, [1.5 Personalization → Skill Sync Method](../1-getting-started/1.5-settings.md) controls how skills are **distributed to each app's directory** (symlink vs. copy). The two settings work together. + +## Public Registry Search (skills.sh) + +v3.13.0 integrates **skills.sh** public registry search so you can discover community skills directly inside CC Switch. + +### How to Use + +1. Click the **Repository Management** button to open the dialog +2. Use the **skills.sh Search** input inside the dialog +3. Type keywords to filter results in real time +4. Click a target skill to quickly add it to your repository list + +v3.13.0 also fixes broken link and empty description handling for skills.sh, so community skill metadata is displayed more reliably. + +## Troubleshooting ### Empty Skill List @@ -224,3 +272,15 @@ Solutions: - Check network connection - Check disk space - Check directory permissions + +### Update Button Not Showing + +Possible causes: + +- The remote repository has no new content +- CC Switch has not finished the latest scan + +Solutions: + +- Click **Refresh** to rescan +- Confirm the repository configuration points to the right branch and path diff --git a/docs/user-manual/en/3-extensions/3.4-sessions.md b/docs/user-manual/en/3-extensions/3.4-sessions.md index 73afde0b8..8dccbe19c 100644 --- a/docs/user-manual/en/3-extensions/3.4-sessions.md +++ b/docs/user-manual/en/3-extensions/3.4-sessions.md @@ -89,6 +89,22 @@ Click the **Resume** button (play icon) on a selected session to continue the co > The Resume button is disabled if the session has no resume command available. +#### Directory Picker (Claude Terminal Resume) + +Starting from v3.13.0, **Claude sessions** show a **directory picker** before resume, allowing you to override the default project directory. Useful when: + +- **Project was moved**: The original project directory was moved or renamed +- **Broken symlink**: The original path is no longer accessible +- **Temporary directory change**: You want to continue the conversation in a different working directory + +**How to use**: + +1. Click the **Resume** button on a Claude session +2. In the popup directory picker, confirm the default directory or choose a new one +3. CC Switch launches the Claude terminal session in the selected directory + +> **Note**: Codex / Gemini / OpenCode / OpenClaw session resume flows do not yet include the directory picker and still use the session's original project directory. + ### Delete Session Click the **Delete** button (trash icon) to permanently remove a session file. A confirmation dialog is shown before deletion. diff --git a/docs/user-manual/en/4-proxy/4.4-usage.md b/docs/user-manual/en/4-proxy/4.4-usage.md index d72b26c84..cc3c8af1d 100644 --- a/docs/user-manual/en/4-proxy/4.4-usage.md +++ b/docs/user-manual/en/4-proxy/4.4-usage.md @@ -9,14 +9,34 @@ The usage statistics feature records and analyzes API request data, helping you: - Analyze usage patterns - Troubleshoot issues +Starting from v3.13.0, usage data comes from two sources: + +| Data Source | Coverage | Proxy Interception Required? | +| ------------------------------- | ----------------------------------------- | ---------------------------- | +| **Proxy request log** | All requests forwarded through the proxy | Yes | +| **CLI session log** (new in v3.13) | Claude / Codex / Gemini session history | No | + +- **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 -Using the usage statistics feature requires: +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 @@ -212,7 +232,7 @@ When adding pricing entries, enter the normalized Model ID rather than the full ### Preset Prices -CC Switch includes preset official prices for common models (per million tokens): +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)**: diff --git a/docs/user-manual/en/4-proxy/4.5-model-test.md b/docs/user-manual/en/4-proxy/4.5-model-test.md index 144522ffa..fd606dee6 100644 --- a/docs/user-manual/en/4-proxy/4.5-model-test.md +++ b/docs/user-manual/en/4-proxy/4.5-model-test.md @@ -2,12 +2,15 @@ ## Overview -The model test feature verifies whether a provider's configured model is available by sending actual API requests to test: +The model test feature (also known as **Stream Check**) verifies whether a provider's configured model is available by sending actual API requests to test: - Whether the model exists - Whether the API Key is valid - Whether the endpoint responds normally - Whether the response latency is acceptable +- Time to first token (TTFB) for streaming responses + +Starting from v3.13.0, Stream Check coverage is extended to **all five apps** (Claude / Codex / Gemini / OpenCode / OpenClaw), including all OpenClaw protocol variants (such as `openai-completions`). OpenCode is auto-detected via npm package mapping; OpenClaw supports custom `auth-header` detection and handles edge cases like Bedrock error messages and `baseURL` fallback. ## Open Configuration @@ -17,11 +20,13 @@ Settings > Advanced > Model Test Config Configure the model used for testing per application: -| Application | Setting | Default | Notes | -|-------------|---------|---------|-------| -| Claude | Claude Model | System default | Recommend using Haiku series (low cost, fast) | -| Codex | Codex Model | System default | Recommend using mini series | -| Gemini | Gemini Model | System default | Recommend using Flash series | +| Application | Setting | Default | Notes | +| ----------- | -------------- | -------------- | ---------------------------------------------------- | +| Claude | Claude Model | System default | Recommend using Haiku series (low cost, fast) | +| Codex | Codex Model | System default | Recommend using mini series | +| Gemini | Gemini Model | System default | Recommend using Flash series | +| OpenCode | OpenCode Model | System default | Added in v3.13.0, auto-detected via npm package mapping | +| OpenClaw | OpenClaw Model | System default | Added in v3.13.0, covers all protocol variants and custom auth-header | ### Model Selection Tips diff --git a/docs/user-manual/en/5-faq/5.2-questions.md b/docs/user-manual/en/5-faq/5.2-questions.md index 7695aebe1..854fd7751 100644 --- a/docs/user-manual/en/5-faq/5.2-questions.md +++ b/docs/user-manual/en/5-faq/5.2-questions.md @@ -156,6 +156,51 @@ chmod +x CC-Switch-*.AppImage - [ ] Is log recording enabled - [ ] Have requests been going through the proxy +## Quota & Balance + +### Why do some providers show quota automatically while others need manual enabling? + +Only **official subscription types** (Claude / Codex / Gemini official login, GitHub Copilot, Codex OAuth reverse proxy) automatically display the quota after enabling the provider. **All other providers** (including Token Plan and third-party balance queries) need the **Usage Query** switch to be manually turned on and a built-in template selected in the provider card — because the same request URL may expose both "plan" and "balance" query modes, requiring you to pick the right one. See [2.5 Usage Query → Manual Enable](../2-providers/2.5-usage-query.md#manual-enable-built-in-templates--custom-scripts). + +### Official subscription provider shows no quota + +**Check**: +1. Confirm the provider is in "Currently Active" state (inactive providers do not trigger queries) +2. For Copilot / Codex OAuth, check whether the OAuth token is still valid; if the card shows "Session Expired", log in again in the **OAuth Auth Center** +3. Check network connectivity +4. Click the refresh icon on the card to manually re-query + +### Token Plan or third-party balance still not shown after enabling + +**Check**: +1. Confirm the **Enable Usage Query** toggle is on in the "Usage Query" panel +2. A suitable built-in template is selected and saved +3. Click **Test Script** to see the specific error +4. The provider must be in "Currently Active" state for background auto-refresh + +### Codex usage does not match the direct-connection numbers + +v3.13.0 switched Codex usage from estimation to **precise parsing based on JSONL session logs**, with normalized model names for consistent pricing lookup. New data aligns with official bills. If you still see old estimated data, delete the historical entries or wait for new session data to overwrite them. + +## Codex OAuth Reverse Proxy + +### How do I log in to Codex OAuth? + +See the complete Device Code login flow (verification code + browser authorization), both entry points (Add Provider panel / OAuth Auth Center), multi-account management, and common failure scenarios in [2.1 Add Provider → Codex OAuth Reverse Proxy (Claude Provider)](../2-providers/2.1-add.md#codex-oauth-reverse-proxy-claude-provider). + +### What are the risks of enabling the Codex OAuth reverse proxy? + +The Codex OAuth reverse proxy accesses your ChatGPT account's Codex service through a **reverse-engineered OAuth flow**. This may violate OpenAI's Terms of Service, carries the risk of account restrictions or suspensions, and provides no guarantee of long-term availability. **By enabling, you assume all risks**. + +See the full disclaimer in the [v3.13.0 Release Notes → Risk Notice](../../../release-notes/v3.13.0-en.md#️-risk-notice) and in [2.1 Add Provider → Codex OAuth Reverse Proxy](../2-providers/2.1-add.md#codex-oauth-reverse-proxy-claude-provider). + +### Codex OAuth logged in but no quota shown + +**Solutions**: +1. Confirm the OAuth login flow is completed in **OAuth Auth Center** (Settings → OAuth Auth Center, with the Beta label) +2. Check whether the token is still valid — if the card shows "Session Expired", the token cannot be refreshed +3. If expired, remove the account in the OAuth Auth Center and log in again + ## Other Issues ### Tray Icon Not Showing @@ -193,6 +238,10 @@ Toggle "Lightweight Mode" from the system tray menu. The main window closes, and Yes. Lightweight Mode destroys the main window and its web view, reducing memory usage significantly while keeping tray menu functionality available. +### Can deep links still wake the main window in Lightweight Mode? + +Yes. Starting from v3.13.0, CC Switch covers all window re-show paths (normal launch, deep links, singleton activation, tray `show_main`, and Lightweight Mode return). Clicking a `ccswitch://` link **rebuilds the main window on demand** and displays the import confirmation dialog. The first open is slightly slower than normal state (window rebuild required), but subsequent switches return to normal speed. + ## Getting Help ### Submit an Issue diff --git a/docs/user-manual/en/README.md b/docs/user-manual/en/README.md index 8c786f11c..acd6c3615 100644 --- a/docs/user-manual/en/README.md +++ b/docs/user-manual/en/README.md @@ -103,9 +103,19 @@ CC Switch User Manual ## Version Information -- Documentation version: v3.12.3 -- Last updated: 2026-04-04 -- Applicable to CC Switch v3.12.3+ +- Documentation version: v3.13.0 +- Last updated: 2026-04-08 +- Applicable to CC Switch v3.13.0+ + +### v3.13.0 Highlights + +- **Lightweight Mode**: Destroys the main window when minimizing to tray — near-zero idle footprint. See [1.5 Personalization](./1-getting-started/1.5-settings.md) +- **Quota & Balance Display**: Official subscriptions (Claude/Codex/Gemini/Copilot/Codex OAuth) auto-display quotas; Token Plan and third-party balances use built-in templates with one-click enable — see [2.5 Usage Query](./2-providers/2.5-usage-query.md) +- **Codex OAuth Reverse Proxy**: Reuse your ChatGPT account's Codex service inside Claude Code — see [2.1 Add Provider](./2-providers/2.1-add.md) +- **Per-App Tray Submenus**: Five independent app submenus to prevent tray overflow — see [2.2 Switch Provider](./2-providers/2.2-switch.md) +- **Skills Discovery & Batch Updates**: SHA-256 update detection, batch updates, skills.sh public registry search — see [3.3 Skills Management](./3-extensions/3.3-skills.md) +- **Full URL Endpoint Mode**: Advanced option to treat `base_url` as the full upstream endpoint — see [2.1 Add Provider](./2-providers/2.1-add.md) +- **OpenCode / OpenClaw Stream Check Coverage**: Stream Check panel extended to all five apps — see [4.5 Model Test](./4-proxy/4.5-model-test.md) ## Contributing diff --git a/docs/user-manual/ja/1-getting-started/1.5-settings.md b/docs/user-manual/ja/1-getting-started/1.5-settings.md index fa2f9e466..03a433423 100644 --- a/docs/user-manual/ja/1-getting-started/1.5-settings.md +++ b/docs/user-manual/ja/1-getting-started/1.5-settings.md @@ -46,6 +46,26 @@ CC Switch は 3 つの言語に対応しています: トレイからプロバイダーを素早く切り替えられるため、「トレイへ最小化」の使用を推奨します。 +### 軽量モード + +v3.13.0 より、CC Switch に **軽量モード** が追加されました — アイドル時のデスクトップ占有を最小限に抑える **トレイのみ実行状態** です。 + +**開始方法**:トレイアイコンを右クリック → **軽量モード** をクリック。メインウィンドウは **破棄**(単に非表示ではなく)され、UI リソースとメモリが解放されます。 + +**終了方法**:トレイメニューから **メインウィンドウを開く** をクリック、またはディープリンク / 再起動で CC Switch を呼び出します。ウィンドウは **必要に応じて再構築** され、状態は保持されます。 + +| 項目 | トレイへ最小化 | 軽量モード | +| -------------------- | ---------------- | ---------------------- | +| UI プロセス | メモリに保持 | 完全に破棄 | +| アイドル時リソース | 通常実行と同じ | ほぼゼロ | +| 再表示速度 | 瞬時(直接表示) | やや遅い(ウィンドウ再構築) | +| トレイ切り替え | 利用可能 | 利用可能 | +| ディープリンク起動 | 利用可能 | 利用可能(必要時再構築)| + +> **使用シーン**:CC Switch を長時間バックグラウンドに常駐させ、主にトレイメニューからプロバイダーを切り替える場合、軽量モードを有効にするとメモリ使用量を大幅に削減できます。 + +> **注意**:軽量モードの状態は永続化されません — 次回の通常起動では通常モードに戻ります。長期的に使用する場合は「起動時に自動実行」と組み合わせてください。 + ### Claude プラグイン連携 有効にすると、CC Switch はプロバイダー切り替え時に VS Code の Claude Code 拡張に設定を自動同期します(`~/.claude/config.json` の `primaryApiKey` に書き込み)。 @@ -251,6 +271,26 @@ WebDAV プロトコルを使用して複数のデバイス間で設定を同期 - **debug** - デバッグ情報を記録 - **trace** - すべての詳細情報を記録 +## OAuth 認証センター(Beta) + +設定 → **OAuth 認証センター** タブ + +v3.13.0 で追加された **OAuth 認証センター**(Beta)は、サードパーティの OAuth 認証情報を一元管理します。現在、以下の 2 種類のアカウントタイプをサポートしています: + +| アカウントタイプ | 用途 | +| ----------------------------- | --------------------------------------------------------------- | +| **GitHub Copilot** | Copilot リバースプロキシと組み合わせて使用 | +| **ChatGPT (Codex OAuth)** | Codex OAuth リバースプロキシと組み合わせて使用、ChatGPT アカウントを管理 | + +**ここでできること**: + +- Device Code フローで ChatGPT / GitHub アカウントにログイン +- ログイン済みアカウント一覧と認証状態の確認 +- マルチアカウント時のデフォルトアカウント設定 +- 個別アカウントの削除や全アカウントの一括ログアウト + +> **注意**:これら 2 つの機能はリバースエンジニアリングされた OAuth フローを使用するため、アカウントリスクおよび利用規約リスクが存在します。ご利用前に [2.1 プロバイダーの追加 → Codex OAuth リバースプロキシ](../2-providers/2.1-add.md#codex-oauth-リバースプロキシclaude-プロバイダー) の完全なリスク通知をお読みください。 + ## バージョン情報ページ 設定 → バージョン情報 タブ diff --git a/docs/user-manual/ja/2-providers/2.1-add.md b/docs/user-manual/ja/2-providers/2.1-add.md index 1dfc096de..63bd9bf71 100644 --- a/docs/user-manual/ja/2-providers/2.1-add.md +++ b/docs/user-manual/ja/2-providers/2.1-add.md @@ -154,19 +154,20 @@ ## モデル自動取得 -プロバイダーの追加や編集時に、プロバイダーのエンドポイントから利用可能なモデルを自動取得できます: +プロバイダーの追加や編集時に、プロバイダーのエンドポイントから利用可能なモデルを自動検出でき、モデル ID の手動コピー&ペーストの手間を省けます。 1. **API Key** と **エンドポイントアドレス** が入力されていることを確認 2. モデル入力フィールドの横にある **モデル取得** ボタン(ダウンロードアイコン)をクリック -3. CC Switch がプロバイダーの `/v1/models` エンドポイントを呼び出してモデルリストを取得 -4. ベンダー別にグループ化されたドロップダウンからモデルを選択 +3. CC Switch が設定された API Key で OpenAI 互換の `/v1/models` エンドポイントを呼び出し +4. カテゴリ別にグループ化されたドロップダウンからモデルを選択 -この機能は、OpenAI 互換の `/v1/models` API をサポートするすべてのプロバイダーで動作します。Claude、Codex、Gemini、OpenCode、OpenClaw のプロバイダーで利用可能です。 +この機能は **5 つのアプリ全対応** —— **Claude / Codex / Gemini / OpenCode / OpenClaw** のプロバイダーで利用可能で、`/v1/models` エンドポイントをサポートするすべてのプロバイダーに対応します。 **よくあるエラー:** -- **認証失敗(401/403)**:API Key を確認してください -- **エンドポイント未対応(404/405)**:プロバイダーが `/v1/models` エンドポイントを公開していません -- **タイムアウト**:エンドポイントの応答が遅いです。後ほど再試行してください +- **認証失敗(401/403)**:API Key が正しいか確認してください +- **エンドポイント未対応(404/405)**:プロバイダーが `/v1/models` エンドポイントを公開していません。手動でモデル ID を入力してください +- **解析失敗**:レスポンスが OpenAI 互換フォーマットに準拠していません +- **タイムアウト**:エンドポイントの応答が遅いです。後ほど再試行するかネットワークを確認してください ## カスタム設定 @@ -330,6 +331,135 @@ SQL バックアップファイルから一括インポート: > **注意**:インポートは既存のデータベースを上書きするため、事前に現在の設定をエクスポートしてバックアップすることをお勧めします。エクスポートファイル名の形式は `cc-switch-export-{タイムスタンプ}.sql` です。 +## Codex OAuth リバースプロキシ(Claude プロバイダー) + +v3.13.0 より、CC Switch は **Codex OAuth リバースプロキシ** 経路を追加しました。**ChatGPT アカウント** を使って Claude Code 内から Codex サービスを再利用できます。 + +> **位置ヒント**:この機能は **新しい Claude プロバイダーカードタイプ** として表示され、Codex 側のプリセットではありません。追加後は通常の API Key プロバイダーと並んで Claude のプロバイダーリストに表示されます。 + +### 前提条件 + +- ログイン可能な **ChatGPT アカウント** +- `auth.openai.com` および `chatgpt.com` にアクセスできる +- **利用前に必ず本節末尾の [⚠️ リスク通知](#️-リスク通知重要) をお読みください** + +### 2 つの入口 + +以下のどちらの入口からでも開始できます: + +#### 入口 A:プロバイダー追加パネルから(新規ユーザー推奨) + +1. **Claude** アプリに切り替える +2. 右上の **+** ボタンをクリックしてプロバイダー追加パネルを開く +3. プリセットリストの第三者カテゴリから **Codex (ChatGPT Plus/Pro)** プリセットを選択(UI に表示される名称を優先) +4. まだ ChatGPT アカウントにログインしていない場合、パネルが **自動的に** ログインフローへ誘導します(下記「ログインフロー」を参照) +5. ログイン成功後、プロバイダーフォームにログイン済みアカウントが表示されるので「保存」をクリックして完了 + +#### 入口 B:OAuth 認証センターから(マルチアカウント管理に適する) + +1. **設定 → OAuth 認証センター** を開く(タブに **Beta** マーク) +2. **ChatGPT (Codex OAuth)** セクションで **ChatGPT でログイン** ボタンをクリック +3. ログインフローを完了(下記参照) +4. ログイン完了後、**Claude** アプリに戻る → **プロバイダーの追加** → 同じ Codex (ChatGPT Plus/Pro) プリセットを選択 +5. フォーム内の「アカウント選択」ドロップダウンから、先ほどログインしたアカウントを選択して保存 + +### ログインフロー(Device Code) + +どちらの入口から入っても、ログインフローは同一です: + +1. **認証コードを取得**:CC Switch が OpenAI Device Code フローを呼び出し、以下を表示: + - **認証コード**(約 8 文字、例:`ABCD-1234`) + - 認証コード右側の **コピー** ボタン + - その下の認証 URL `https://auth.openai.com/codex/device` + - 「認証を待っています...」のアニメーション表示 +2. **ブラウザ認証**:リンクをクリック(または URL を手動で訪問)し、ブラウザで: + - ChatGPT アカウントにログイン + - 先ほどコピーした認証コードを入力 + - 認証を確認 +3. **自動ポーリング完了**:CC Switch はバックグラウンドで OpenAI サーバーをポーリングし、認証成功を検知すると待機画面を自動的に閉じます +4. **ログイン済みアカウントを表示**:ログインした ChatGPT アカウント(ログインメール)が **OAuth 認証センター → ログイン済みアカウント** リストに表示されます + +> ⏱️ **認証コードの有効期限は約 15 分** です。タイムアウトすると「Device Code の有効期限切れ」が表示されるので、**再試行** をクリックして新しい認証コードを取得してください。 + +### 有効化と使用 + +Codex OAuth プロバイダーを追加・保存した後: + +1. Claude のプロバイダーリストから探す +2. カードの **有効化** ボタンをクリック —— 通常のプロバイダーと同じ +3. Claude Code CLI がリバースプロキシ経由で Codex サービスを使用します +4. トレイメニューの **Claude** サブメニューにもこのプロバイダーが表示され、素早く切り替え可能 + +> **内部動作**:CC Switch はリクエストを `https://chatgpt.com/backend-api/codex` にルーティングし、base URL が強制的に書き換えられます —— フォームにエンドポイントを手動入力する **必要はありません**。API フォーマットは `openai_responses` に固定されます。 + +### デフォルトモデル + +Codex OAuth プリセットのデフォルトモデルマッピング: + +| 役割 | デフォルトモデル | +| ------------- | ---------------- | +| メインモデル | `gpt-5.4` | +| Sonnet 役割 | `gpt-5.4` | +| Opus 役割 | `gpt-5.4` | +| Haiku 役割 | `gpt-5.4-mini` | + +プロバイダーの JSON エディタで `ANTHROPIC_MODEL` などの環境変数を上書きしてカスタマイズできます。 + +### マルチアカウント管理(OAuth 認証センター) + +**OAuth 認証センター** は複数の ChatGPT アカウントの同時管理をサポートします: + +| 操作 | 説明 | +| -------------------------- | ---------------------------------------------------------------------- | +| 別のアカウントを追加 | 「別のアカウントを追加」をクリックしてログインフローを繰り返す | +| デフォルトに設定 | アカウント行の「デフォルトに設定」をクリック —— 新規プロバイダーに適用 | +| プロバイダー用に選択 | プロバイダーフォームの「アカウント選択」ドロップダウンで特定アカウントを指定 | +| アカウントを削除 | アカウント右側の赤い × をクリックして削除(Token がクリアされる) | +| すべてのアカウントをログアウト | 下部の「すべてのアカウントをログアウト」ボタンで一括クリア | + +> **使用シーン**:チームで開発マシンを共有する場合、各メンバーの ChatGPT アカウントごとに 1 つのプロバイダーを作成し、トレイメニューから素早く切り替えできます。 + +### Token 自動更新 + +- Token は **有効期限の 60 秒前** に自動更新され、すべてバックグラウンドで処理されるため手動介入は不要です +- Refresh Token はローカルデータディレクトリに保存され、どこにもアップロードされません +- Token のエクスポートは **サポートされていません**(漏洩防止) + +### クォータ表示 + +ログインしてプロバイダーを有効化すると、**プロバイダーカード下部** に自動的にアカウントクォータが表示されます: + +| 表示要素 | 例 | カラールール | +| ---------------- | ------------------- | --------------------------------------------- | +| 使用率 | `45%` | < 70% 緑、70–89% オレンジ、≥ 90% 赤 | +| リセットまでの時間 | `7d12h 後にリセット` | ChatGPT アカウントのスライディングウィンドウまたは日次制限 | +| 更新ボタン | 円形の矢印 | 手動でクォータを再取得 | + +> ⚠️ **セッション期限切れ**:Token が完全に無効になった(自動更新できない)場合、カード下部に黄色い警告枠「セッション期限切れ」が表示されます。**OAuth 認証センター** からこのアカウントを削除し、再ログインしてください。 + +### よくある失敗 + +| シナリオ | 表示 | 解決方法 | +| --------------------------- | --------------------------------- | --------------------------------------------- | +| 認証コードタイムアウト | 「Device Code の有効期限切れ」 | 「再試行」をクリックして新しい認証コードを取得 | +| ブラウザで認証拒否 | 「ユーザーが認証を拒否」 | 再ログインしブラウザで「認証」をクリック | +| ネットワークエラー | 具体的なエラー情報を表示 | ネットワーク接続を確認、OpenAI ドメインへのアクセス可否を確認 | +| ログイン前にプロバイダー作成 | 「ChatGPT アカウントにログインしてください」 | 先に OAuth 認証センターでログインを完了 | +| Token 更新失敗 | クォータ欄に「セッション期限切れ」 | アカウントを削除して再ログイン | +| クォータ取得失敗 | クォータ欄に「取得失敗」 | 「更新」ボタンをクリックして再試行 | + +### ⚠️ リスク通知(重要) + +Codex OAuth リバースプロキシは **リバースエンジニアリングされた OAuth フロー** で ChatGPT アカウントの Codex サービスにアクセスします。有効化前に必ず以下のリスクをご理解ください: + +1. **利用規約違反**:OpenAI の利用規約に違反する可能性があります。同規約は未承認の自動化アクセス、サービスの複製、および既定のアクセス経路の迂回を禁止しています +2. **アカウントリスク**:OpenAI は異常な使用パターンを疑わしい自動化として検知し、ChatGPT アカウントに一時的または永続的な制限を課す可能性があります +3. **長期的な可用性は保証されません**:OpenAI は認証および検出メカニズムをいつでも更新する可能性があり、現在利用可能な方法が将来ブロックされる可能性があります + +**この機能を有効化することは、すべてのリスクを自己責任で負うことを意味します**。CC Switch は本機能の使用による一切のアカウント制限、警告、サービス停止について責任を負いません。 + +> 📖 完全な免責事項と背景は [v3.13.0 Release Notes](../../../release-notes/v3.13.0-ja.md#️-リスク通知) をご覧ください。 + ## 高度なオプション ### API フォーマット(Claude のみ) @@ -346,6 +476,30 @@ SQL バックアップファイルから一括インポート: デフォルト以外の API フォーマットが設定されている場合、高度なオプションセクションが自動展開されます。 +### 完全URLエンドポイントモード + +v3.13.0 で追加された高度なオプション。デフォルトでは、CC Switch は設定された `base_url` を **プレフィックス** として扱い、`/v1/chat/completions` などの固定パスを後ろに連結します。一部のベンダー(非標準の URL レイアウトを必要とする第三者サービスなど)では、この連結方式ではリクエストが失敗します。 + +**有効化方法**: + +1. プロバイダーを編集し、「高度なオプション」を展開 +2. **完全 URL モード** チェックボックスにチェックを入れる +3. **完全なアップストリームエンドポイント**(プレフィックスではなく)を `base_url` に入力 + +**例の比較**: + +| モード | `base_url` の記入例 | 実際のリクエスト先 | +| ----------------------- | ------------------------------------------------ | ------------------------------------------------ | +| デフォルト(プレフィックス連結) | `https://api.example.com` | `https://api.example.com/v1/chat/completions` | +| **完全 URL モード** | `https://api.example.com/custom/path/messages` | `https://api.example.com/custom/path/messages` | + +**使用シーン**: +- ベンダーが非標準パスを要求する場合(`/v1/chat/completions` 以外) +- ベンダーに多階層のパス構造がある場合 +- ベンダー専用の API ゲートウェイパス + +> **ヒント**:プロキシ転送および Stream Check のいずれも「完全 URL モード」の設定に従うため、有効化後に追加調整は不要です。このオプションを無効化すると、パス連結はデフォルトの動作に戻ります。 + ### Claude 共通設定クイックトグル Claude プロバイダーの編集時、JSON エディタの上部に **クイックトグル** が利用できます: diff --git a/docs/user-manual/ja/2-providers/2.2-switch.md b/docs/user-manual/ja/2-providers/2.2-switch.md index fda323cde..8b358ceee 100644 --- a/docs/user-manual/ja/2-providers/2.2-switch.md +++ b/docs/user-manual/ja/2-providers/2.2-switch.md @@ -30,10 +30,26 @@ 3. 切り替えたいプロバイダー名をクリック 4. 切り替え完了、トレイに短い通知が表示 -> プロバイダーはアプリタイプ(Claude/Codex/Gemini)ごとに折りたたみサブメニューに整理されています。サブメニューのタイトルには現在有効なプロバイダー名が表示されます。 - ### トレイメニュー構造 +v3.13.0 より、トレイメニューがフラットなリストから **アプリ別サブメニュー** にリファクタリングされ、各アプリに独立したサブメニューが用意されました: + +| サブメニュー | 説明 | +| ------------ | -------------------------------------------------------------------- | +| Claude | Claude のすべてのプロバイダー(Codex OAuth リバースプロキシを含む) | +| Codex | Codex のすべてのプロバイダー | +| Gemini | Gemini のすべてのプロバイダー | +| OpenCode | OpenCode のすべてのプロバイダー | +| OpenClaw | OpenClaw のすべてのプロバイダー | + +**リファクタリングの利点**: + +- **メニューのオーバーフロー防止**:プロバイダーが多数ある場合、フラットなリストでは画面の高さを超えますが、アプリ別サブメニューは自然にスケールします +- **サブメニューのタイトルに現在有効なプロバイダーを表示**:サブメニューを開かなくても、各アプリがどのプロバイダーを使用中か一目でわかります +- **アプリ別の分離**:Claude のプロバイダーを切り替えても Codex のビューには影響しません + +> **ヒント**:バックグラウンド常駐 + 軽量モード + アプリ別サブメニューの組み合わせは、複数のアプリを頻繁に切り替えるヘビーユーザーに特に適しています。[1.5 個人設定 → 軽量モード](../1-getting-started/1.5-settings.md) を参照してください。 + ![image-20260108004348993](../../assets/image-20260108004348993.png) ## 反映方法 diff --git a/docs/user-manual/ja/2-providers/2.5-usage-query.md b/docs/user-manual/ja/2-providers/2.5-usage-query.md index 36d76ff8c..00dd4ec12 100644 --- a/docs/user-manual/ja/2-providers/2.5-usage-query.md +++ b/docs/user-manual/ja/2-providers/2.5-usage-query.md @@ -1,8 +1,72 @@ # 2.5 使用量クエリ -## 機能説明 +CC Switch のクォータ・残高表示は 2 つのカテゴリに分かれます:**自動クエリ**(公式サブスクリプション系、すぐに使える)と **手動有効化**(内蔵テンプレート + カスタムスクリプト、ユーザー設定後に表示)。 -使用量クエリ機能により、カスタムスクリプトを設定して、プロバイダーの残額や使用量などの情報をリアルタイムでクエリできます。 +| カテゴリ | 範囲 | ユーザー操作必要 | +| ---------------------------------- | --------------------------------------------------------------------------------- | ---------------- | +| **自動クエリ** | Claude / Codex / Gemini 公式サブスクリプション、GitHub Copilot、Codex OAuth リバースプロキシ | 不要(デフォルト有効) | +| **手動有効化(内蔵テンプレート)** | Token Plan、第三者残高クエリ | 必要(下記参照) | +| **手動有効化(カスタムスクリプト)** | 内蔵テンプレート未対応の中継サービス、プライベートデプロイ、特殊 API | 必要(下記参照) | + +## 自動クエリ(公式サブスクリプション系) + +v3.13.0 より、以下の 3 カテゴリはプロバイダー有効化後に **自動的** にカード下部にクォータが表示され、追加設定は不要です: + +| カテゴリ | 対象プロバイダー | 表示内容 | +| ---------------------- | --------------------------------------------- | ------------------------------------ | +| 公式サブスクリプション | Claude / Codex / Gemini 公式ログイン | 公式サブスクリプションクォータ | +| GitHub Copilot | Copilot プロバイダーカード | Premium interactions 残量 | +| Codex OAuth | Codex OAuth リバースプロキシカード(Claude プロバイダー) | ChatGPT アカウント Codex クォータ | + +これら 3 カテゴリの共通点は、**データソースが唯一かつ意味が明確** であることです(公式サブスクリプションの使用率)。そのため CC Switch は対応する公式または OAuth クエリエンドポイントを直接呼び出します。 + +### 自動クエリの操作 + +- **カード下部表示**:使用率 + リセットまでのカウントダウン、使用率に応じて色が変化(< 70% 緑 / 70–89% オレンジ / ≥ 90% 赤) +- **手動更新**:カード上の更新アイコンをクリックして再取得 +- **カードの簡略化**:これら 3 カテゴリでは、**ヘルスチェック** と **使用量クエリ設定** ボタンが自動的に非表示となり、内蔵表示への干渉を防ぎます +- **セッション期限切れ通知**:Token の更新に失敗した場合、カードに黄色の「セッション期限切れ」警告が表示されます(Copilot / Codex OAuth) + +--- + +## 手動有効化(内蔵テンプレート + カスタムスクリプト) + +上記 3 カテゴリの自動クエリ対応プロバイダー以外、**その他すべてのプロバイダー**(Token Plan、第三者残高クエリ、各種中継サービスを含む)では、プロバイダーカード上で **手動で「使用量クエリ」スイッチをオン** にして初めてクォータが表示されます。 + +### なぜ手動有効化が必要なのか? + +重要な理由の一つは:**同じリクエスト URL(同じベンダー)が複数のクエリモードを提供している場合がある** ことです —— プランごとのクォータクエリと、アカウント残高クエリの両方が存在する可能性があります。CC Switch はどちらをクエリすべきか自動判定できないため、このようなプロバイダーの内蔵クエリは **デフォルトで無効** になっており、適切なテンプレートを選択してから有効化する必要があります。 + +### 内蔵テンプレートの対象範囲 + +v3.13.0 では以下のカテゴリに **すぐに使える内蔵テンプレート** を提供しており、有効化後にスクリプトを書く必要はありません: + +| カテゴリ | 対象プロバイダー | テンプレートタイプ | +| --------------- | --------------------------------------------------------- | ------------------------- | +| Token Plan | Kimi / Zhipu GLM / MiniMax | プランクォータ(使用進捗付き) | +| 第三者残高 | DeepSeek / StepFun / SiliconFlow / OpenRouter / Novita AI | 公式残高クエリ | + +> **ヒント**:上記の内蔵テンプレート以外で対象外のプロバイダーには、**カスタムスクリプト** 方式(下記参照)で独自のクエリロジックを記述できます。 + +### 有効化手順 + +1. プロバイダーカードにマウスをホバーして操作ボタンを表示 +2. **使用量クエリ** ボタン(📊 アイコン)をクリック +3. 設定パネル上部の **使用量クエリを有効にする** スイッチをオンにする +4. 適切な内蔵テンプレート(Token Plan、第三者残高など)または「カスタム」を選択 +5. 必要に応じて API Key / Base URL / Access Token などのパラメータを入力(多くの場合は空欄のままプロバイダー自身の認証情報を使用可能) +6. 「スクリプトをテスト」をクリックして正常に応答するか確認 +7. 設定を保存 —— 次回プロバイダーを有効化すると、カード下部にクォータが表示されます + +> ⚠️ **注意**:有効化後の自動更新間隔は「自動クエリ間隔」フィールドで制御します(`0` に設定すると自動更新を無効化)。プロバイダーが「現在有効」状態のときのみバックグラウンドクエリがトリガーされます。 + +--- + +## カスタムスクリプトクエリ(高度) + +### 機能説明 + +プロバイダーが **内蔵テンプレートの対象範囲外** の場合、JavaScript でカスタムクエリスクリプトを記述できます。中継サービス、プライベートデプロイ、特殊な API 形式などに適しています。 **使用シーン**: - API アカウントの残額確認 @@ -155,6 +219,24 @@ New API タイプの中継サービス専用に設計されています: ### トラブルシューティング +### 自動クエリにクォータが表示されない(公式サブスクリプション系) + +**確認事項**: +1. プロバイダーが公式サブスクリプション系であることを確認 —— Claude / Codex / Gemini 公式ログイン、GitHub Copilot、Codex OAuth リバースプロキシ +2. プロバイダーが「現在有効」状態か(非アクティブ時はクエリがトリガーされません) +3. OAuth タイプ(Copilot / Codex OAuth)の場合、Token がまだ有効期限内か確認。カードに「セッション期限切れ」と表示される場合は **OAuth 認証センター** で再ログインしてください +4. 公式クォータエンドポイントへのネットワークアクセス可否 + +### 手動有効化後もクォータが表示されない + +**確認事項**: +1. プロバイダーカードの「使用量クエリ」パネル上部にある **使用量クエリを有効にする** スイッチがオンか +2. 適切な内蔵テンプレート(Token Plan / 第三者残高 / カスタム)が選択されているか +3. 「スクリプトをテスト」をクリックして具体的なエラー情報を確認 +4. API Key / Base URL などの必須フィールドが正しく入力されているか +5. プロバイダーのクォータエンドポイントへのネットワークアクセス可否 +6. プロバイダーが「現在有効」状態のときのみ、バックグラウンドの自動更新がトリガーされます + ### クエリ失敗 **確認事項**: diff --git a/docs/user-manual/ja/3-extensions/3.3-skills.md b/docs/user-manual/ja/3-extensions/3.3-skills.md index 1045ea8e5..d3e84f203 100644 --- a/docs/user-manual/ja/3-extensions/3.3-skills.md +++ b/docs/user-manual/ja/3-extensions/3.3-skills.md @@ -192,11 +192,59 @@ Subdirectory: skills ## スキルの更新 -現在、自動更新には対応していません。スキルを更新するには: +v3.13.0 より、Skills は **自動更新検出** と **一括更新** に対応しました —— アンインストール&再インストールの必要はありません。 -1. 既存のスキルをアンインストール -2. リストを更新 -3. 再度インストール +### 更新検出の仕組み + +CC Switch は **SHA-256 コンテンツハッシュ** によってローカルにインストールされた skill とリモートリポジトリのバージョンを比較します。リモートに何らかのファイル変更があれば、対応するローカル skill カードに「新しいバージョンあり」のインジケーターが自動的に表示されます。 + +### 単体更新 + +更新が必要な skill について: + +1. Skills パネルで更新インジケーター付きの skill カードを見つける +2. カード上の **更新** ボタンをクリック +3. ダウンロード完了を待つ —— ステータスは自動的に更新されます + +### 一括更新 + +複数の skill に更新が必要な場合: + +1. Skills パネル上部の **すべて更新** ボタンをクリック(スライドインアニメーション付きで表示) +2. CC Switch が更新が必要なすべての skill を一括ダウンロード +3. 完了後パネルが自動的に更新され、更新インジケーターは消えます + +> **ヒント**:定期的に「更新」ボタンをクリックしてリモートスキャンをトリガーし、更新検出の結果を最新に保ってください。 + +## 保存場所の切り替え + +v3.13.0 より、Skills の **ソース保存場所** は 2 つの場所から切り替え可能になりました: + +| 場所 | 説明 | +| ------------------------ | -------------------------------------------------------------------- | +| **CC Switch 内蔵保存** | デフォルト位置 `~/.cc-switch/skills/`、CC Switch が一元管理 | +| **`~/.agents/skills`** | コミュニティの agent ツール規約に準拠した共有ディレクトリ、他ツールとの連携に適する | + +### 切り替え方法 + +Skills パネルの設定または管理メニューから対象の保存場所を選択します。切り替えの際 **skill の状態は失われません** —— CC Switch が既存の skill を新しい場所へスムーズに移行します。 + +> ⚠️ **区別**:本節の「保存場所の切り替え」は skill の **ソース保存** を管理します。一方、[1.5 個人設定 → Skills 同期方式](../1-getting-started/1.5-settings.md) は skill を **各アプリディレクトリへどう配布するか**(シンボリックリンク vs コピー)を管理します。両者は併用します。 + +## 公式レジストリ検索(skills.sh) + +v3.13.0 では **skills.sh** 公式レジストリ検索を統合し、CC Switch 内から直接コミュニティ skill を発見できます。 + +### 使用手順 + +1. 「リポジトリ管理」ボタンをクリックしてダイアログを開く +2. ダイアログ内の **skills.sh 検索** 入力欄を使用 +3. キーワードを入力してリアルタイムで結果をフィルタリング +4. 対象の skill をクリックして自分のリポジトリリストに素早く追加 + +v3.13.0 では skills.sh のリンク切れと空の説明への対応も修正され、コミュニティ skill のメタデータ表示がより安定しました。 + +## トラブルシューティング ### スキルリストが空の場合 @@ -224,3 +272,15 @@ Subdirectory: skills - ネットワーク接続を確認 - ディスク容量を確認 - ディレクトリの権限を確認 + +### 更新ボタンが表示されない場合 + +考えられる原因: + +- リモートリポジトリに新しいコンテンツがない +- CC Switch が最新のスキャンを完了していない + +解決方法: + +- 「更新」をクリックして再スキャン +- リポジトリ設定が正しいブランチとパスを指していることを確認 diff --git a/docs/user-manual/ja/3-extensions/3.4-sessions.md b/docs/user-manual/ja/3-extensions/3.4-sessions.md index 7290fbeec..71f1a3c9b 100644 --- a/docs/user-manual/ja/3-extensions/3.4-sessions.md +++ b/docs/user-manual/ja/3-extensions/3.4-sessions.md @@ -89,6 +89,22 @@ > 再開コマンドが利用できないセッションでは、再開ボタンは無効になります。 +#### ディレクトリピッカー(Claude ターミナル再開) + +v3.13.0 より、**Claude セッション** の再開前に **ディレクトリピッカー** が表示され、デフォルトのプロジェクトディレクトリを上書きできます。以下のシナリオに対応します: + +- **プロジェクトが移動された**:元のプロジェクトディレクトリが移動・リネームされた +- **シンボリックリンク切れ**:元のパスにアクセスできない +- **一時的なディレクトリ変更**:異なる作業ディレクトリで会話を続けたい + +**使用方法**: + +1. Claude セッションの **再開** ボタンをクリック +2. 表示されるディレクトリピッカーで、デフォルトのディレクトリを確認するか、新しいディレクトリを選択 +3. CC Switch が選択したディレクトリで Claude ターミナルセッションを起動します + +> **ヒント**:Codex / Gemini / OpenCode / OpenClaw のセッション再開フローには現在ディレクトリピッカーは含まれず、セッション元のプロジェクトディレクトリを使用します。 + ### セッションの削除 **削除** ボタン(ゴミ箱アイコン)をクリックすると、セッションファイルが完全に削除されます。削除前に確認ダイアログが表示されます。 diff --git a/docs/user-manual/ja/4-proxy/4.4-usage.md b/docs/user-manual/ja/4-proxy/4.4-usage.md index 2c63d11c0..413a8e7ee 100644 --- a/docs/user-manual/ja/4-proxy/4.4-usage.md +++ b/docs/user-manual/ja/4-proxy/4.4-usage.md @@ -9,14 +9,34 @@ - 使用パターンの分析 - 問題のトラブルシューティング +v3.13.0 より、使用量データの取得元は 2 つあります: + +| データ取得元 | 対象範囲 | プロキシ経由が必要? | +| ---------------------------------- | --------------------------------------- | -------------------- | +| **プロキシリクエストログ** | プロキシを経由したすべてのリクエスト | 必要 | +| **CLI セッションログ**(v3.13 新規)| Claude / Codex / Gemini のセッション履歴 | 不要 | + +- **Codex セッション**:JSONL セッションログに基づく **精密な解析** に切り替え、従来の推定値を置き換え。モデル名を正規化することで料金検索の整合性を保証 +- **Gemini セッション**:Gemini CLI のセッションログから精密に同期 +- **Claude セッション**:セッションログから直接使用量をインポート可能 +- 使用量パネルは **アプリ別フィルタリング**(Claude / Codex / Gemini)に対応し、データが混在しません + ## 前提条件 -使用量統計機能を使用するには: +使用するデータ取得元によって前提条件が異なります: + +**プロキシリクエストログ**(すべてのアプリとプロキシリクエストを対象): 1. プロキシサービスを起動 2. アプリケーション接管を有効化 3. ログ記録を有効化 +**CLI セッションログ**(v3.13 新規、プロキシ不要): + +1. CC Switch で対応するアプリ(Claude / Codex / Gemini)を有効化 +2. 対応する CLI にセッション履歴ファイルがあること +3. CC Switch が定期的にセッションディレクトリをスキャンして使用量をインポートします + ## 使用量統計を開く 設定 → 使用量 タブ @@ -212,7 +232,7 @@ Token 使用量の変化を表示: ### プリセット価格 -CC Switch は一般的なモデルの公式価格(100 万 Token あたり)をプリセットしています: +CC Switch は一般的なモデルの公式価格(100 万 Token あたり)をプリセットしています。v3.13.0 では一部モデルの **CNY → USD 価格を修正** し、これまで欠けていたモデル定義を補完したほか、**MiniMax のプランクォータ計算** と **0% → 100% の使用進捗** 表示を修正し、費用見積もりとプラン進捗の表示がより正確になりました。 **Claude シリーズ(ドル)**: diff --git a/docs/user-manual/ja/4-proxy/4.5-model-test.md b/docs/user-manual/ja/4-proxy/4.5-model-test.md index a1e0fa7c7..c8daff054 100644 --- a/docs/user-manual/ja/4-proxy/4.5-model-test.md +++ b/docs/user-manual/ja/4-proxy/4.5-model-test.md @@ -2,12 +2,15 @@ ## 機能説明 -モデルテスト機能は、プロバイダーに設定されたモデルが使用可能かどうかを確認するために、実際の API リクエストを送信してテストします: +モデルテスト機能(**Stream Check** とも呼ばれる)は、プロバイダーに設定されたモデルが使用可能かどうかを確認するために、実際の API リクエストを送信してテストします: - モデルが存在するか - API Key が有効か - エンドポイントが正常に応答するか - 応答レイテンシが正常か +- ストリーミングレスポンスの初回トークン時間(TTFB) + +v3.13.0 より、Stream Check の対応範囲が **5 つのアプリ全対応**(Claude / Codex / Gemini / OpenCode / OpenClaw)に拡張され、OpenClaw の全プロトコルバリアント(`openai-completions` など)も含まれます。OpenCode は npm パッケージマッピングで自動識別、OpenClaw はカスタム `auth-header` 検出、Bedrock エラーメッセージ、`baseURL` フォールバックなどのエッジケースにも対応しています。 ## 設定を開く @@ -17,11 +20,13 @@ 各アプリのテスト用モデルを設定します: -| アプリ | 設定項目 | デフォルト値 | 説明 | -|------|--------|--------|------| -| Claude | Claude モデル | システムデフォルト | Haiku シリーズの使用を推奨(低コスト・高速) | -| Codex | Codex モデル | システムデフォルト | mini シリーズの使用を推奨 | -| Gemini | Gemini モデル | システムデフォルト | Flash シリーズの使用を推奨 | +| アプリ | 設定項目 | デフォルト値 | 説明 | +| ---------- | ---------------- | ------------------ | ------------------------------------------------------- | +| Claude | Claude モデル | システムデフォルト | Haiku シリーズの使用を推奨(低コスト・高速) | +| Codex | Codex モデル | システムデフォルト | mini シリーズの使用を推奨 | +| Gemini | Gemini モデル | システムデフォルト | Flash シリーズの使用を推奨 | +| OpenCode | OpenCode モデル | システムデフォルト | v3.13.0 で追加、npm パッケージマッピングで自動検出 | +| OpenClaw | OpenClaw モデル | システムデフォルト | v3.13.0 で追加、全プロトコルバリアントとカスタム auth-header に対応 | ### モデル選択のアドバイス diff --git a/docs/user-manual/ja/5-faq/5.2-questions.md b/docs/user-manual/ja/5-faq/5.2-questions.md index 313348b5a..930b81c57 100644 --- a/docs/user-manual/ja/5-faq/5.2-questions.md +++ b/docs/user-manual/ja/5-faq/5.2-questions.md @@ -156,6 +156,51 @@ chmod +x CC-Switch-*.AppImage - [ ] ログ記録が有効か - [ ] プロキシ経由でリクエストがあったか +## クォータ・残高 + +### なぜ一部のプロバイダーは自動的にクォータが表示され、他は手動で有効化する必要があるのですか? + +**公式サブスクリプション系**(Claude / Codex / Gemini 公式ログイン、GitHub Copilot、Codex OAuth リバースプロキシ)のみ、プロバイダーを有効化すると自動的にクォータが表示されます。**その他すべてのプロバイダー**(Token Plan および第三者残高クエリを含む)は、プロバイダーカードの「使用量クエリ」パネルで手動でスイッチをオンにし、内蔵テンプレートを選択する必要があります。同じリクエスト URL が「プラン」と「残高」の両方のクエリモードを持つ可能性があるため、ユーザー自身が選択する必要があるからです。詳細は [2.5 使用量クエリ → 手動有効化](../2-providers/2.5-usage-query.md#手動有効化内蔵テンプレート--カスタムスクリプト) を参照してください。 + +### 公式サブスクリプションのプロバイダーにクォータが表示されない + +**確認事項**: +1. プロバイダーが「現在有効」状態であることを確認(非アクティブ時はクエリがトリガーされません) +2. Copilot / Codex OAuth の場合、OAuth Token がまだ有効期限内か確認。カードに「セッション期限切れ」と表示されたら **OAuth 認証センター** で再ログインしてください +3. ネットワーク接続を確認 +4. カード上の更新アイコンをクリックして手動で再取得 + +### Token Plan や第三者残高を有効化しても表示されない + +**確認事項**: +1. 「使用量クエリ」パネルで「使用量クエリを有効にする」スイッチがオンになっているか +2. 適切な内蔵テンプレートが選択されて保存されているか +3. 「スクリプトをテスト」をクリックして具体的なエラーを確認 +4. プロバイダーが「現在有効」状態のときのみバックグラウンド自動更新が動作します + +### Codex の使用量が直接接続時と合わない + +v3.13.0 で Codex の使用量が推定値から **JSONL セッションログに基づく精密解析** に切り替わり、モデル名が正規化されて料金検索の整合性が保たれます。新しいデータは公式の請求と一致します。古い推定データが残っている場合は、履歴エントリを削除するか、新しいセッションデータによる上書きを待ってください。 + +## Codex OAuth リバースプロキシ + +### Codex OAuth のログイン方法は? + +完全な Device Code ログインフロー(認証コード + ブラウザ認証)、2 つの入口(プロバイダー追加パネル / OAuth 認証センター)、マルチアカウント管理、よくある失敗シナリオは [2.1 プロバイダーの追加 → Codex OAuth リバースプロキシ(Claude プロバイダー)](../2-providers/2.1-add.md#codex-oauth-リバースプロキシclaude-プロバイダー) を参照してください。 + +### Codex OAuth リバースプロキシを有効化するリスクは? + +Codex OAuth リバースプロキシは **リバースエンジニアリングされた OAuth フロー** で ChatGPT アカウントの Codex サービスにアクセスします。OpenAI の利用規約に違反する可能性があり、アカウント制限や停止のリスクがあり、長期的な可用性も保証されません。**有効化すると自己責任となります**。 + +完全な免責事項は [v3.13.0 Release Notes → リスク通知](../../../release-notes/v3.13.0-ja.md#️-リスク通知) と [2.1 プロバイダーの追加 → Codex OAuth リバースプロキシ](../2-providers/2.1-add.md#codex-oauth-リバースプロキシclaude-プロバイダー) を参照してください。 + +### Codex OAuth にログインしたがクォータが表示されない + +**解決方法**: +1. **OAuth 認証センター**(設定 → OAuth 認証センター、Beta ラベル付き)で OAuth ログインフローが完了していることを確認 +2. Token がまだ有効期限内か確認。カードに「セッション期限切れ」と表示される場合は Token が更新できない状態 +3. 期限切れの場合は、OAuth 認証センターでアカウントを削除して再ログインしてください + ## その他の問題 ### トレイアイコンが表示されない @@ -183,15 +228,19 @@ chmod +x CC-Switch-*.AppImage 2. 最新版を手動でダウンロードしてインストール 3. Homebrew を使用する場合:`brew upgrade --cask cc-switch` -## ライトウェイトモード +## 軽量モード -### ライトウェイトモードに入るには? +### 軽量モードに入るには? -システムトレイメニューから「ライトウェイトモード」をトグルします。メインウィンドウが閉じ、CC Switch はトレイ専用アプリとして動作します。再度トグルするか「メインウィンドウを開く」をクリックすると終了します。 +システムトレイメニューから「軽量モード」をトグルします。メインウィンドウが閉じ、CC Switch はトレイ専用アプリとして動作します。再度トグルするか「メインウィンドウを開く」をクリックすると終了します。 -### ライトウェイトモードではメモリ使用量が少なくなる? +### 軽量モードではメモリ使用量が少なくなる? -はい。ライトウェイトモードではメインウィンドウとその Web ビューを破棄するため、トレイメニュー機能を維持しながらメモリ使用量を大幅に削減します。 +はい。軽量モードではメインウィンドウとその Web ビューを破棄するため、トレイメニュー機能を維持しながらメモリ使用量を大幅に削減します。 + +### 軽量モードでもディープリンクでメインウィンドウを呼び出せる? + +はい。CC Switch v3.13.0 より、すべてのウィンドウ再表示パス(通常起動、ディープリンク、シングルトン起動、トレイ `show_main`、軽量モードからの復帰)をカバーしています。`ccswitch://` リンクをクリックするとメインウィンドウが **必要に応じて再構築** され、インポート確認ダイアログが表示されます。初回起動は通常状態より若干遅くなります(ウィンドウの再構築が必要なため)が、以降の切り替えは通常速度に戻ります。 ## ヘルプの入手 diff --git a/docs/user-manual/ja/README.md b/docs/user-manual/ja/README.md index f6a738449..7856be42e 100644 --- a/docs/user-manual/ja/README.md +++ b/docs/user-manual/ja/README.md @@ -103,9 +103,19 @@ CC Switch ユーザーマニュアル ## バージョン情報 -- ドキュメントバージョン:v3.12.3 -- 最終更新:2026-04-04 -- CC Switch v3.12.3+ 対応 +- ドキュメントバージョン:v3.13.0 +- 最終更新:2026-04-08 +- CC Switch v3.13.0+ 対応 + +### v3.13.0 の注目機能 + +- **軽量モード**:トレイへ最小化時にメインウィンドウを破棄、アイドル時のリソース使用量をほぼゼロに — 詳細は [1.5 個人設定](./1-getting-started/1.5-settings.md) +- **クォータ・残高表示**:公式サブスクリプション系(Claude/Codex/Gemini/Copilot/Codex OAuth)はカードに自動表示、Token Plan および第三者残高は内蔵テンプレートでワンクリック有効化 — 詳細は [2.5 使用量クエリ](./2-providers/2.5-usage-query.md) +- **Codex OAuth リバースプロキシ**:ChatGPT アカウントで Claude Code 内から Codex サービスを再利用 — 詳細は [2.1 プロバイダーの追加](./2-providers/2.1-add.md) +- **アプリ別トレイサブメニュー**:5 アプリ独立サブメニュー、メニューのオーバーフローを防止 — 詳細は [2.2 プロバイダーの切り替え](./2-providers/2.2-switch.md) +- **Skills の発見と一括更新**:SHA-256 ハッシュによる更新検出、一括更新、skills.sh 公式レジストリ検索 — 詳細は [3.3 Skills スキル管理](./3-extensions/3.3-skills.md) +- **完全URLエンドポイントモード**:高度なオプションで `base_url` を完全なアップストリームエンドポイントとして扱う — 詳細は [2.1 プロバイダーの追加](./2-providers/2.1-add.md) +- **OpenCode / OpenClaw ストリームチェック完全対応**:Stream Check パネルを 5 アプリ全対応に拡張 — 詳細は [4.5 モデルテスト](./4-proxy/4.5-model-test.md) ## コントリビュート diff --git a/docs/user-manual/zh/1-getting-started/1.5-settings.md b/docs/user-manual/zh/1-getting-started/1.5-settings.md index 2ac4748b4..bd6e93f9b 100644 --- a/docs/user-manual/zh/1-getting-started/1.5-settings.md +++ b/docs/user-manual/zh/1-getting-started/1.5-settings.md @@ -46,6 +46,26 @@ CC Switch 支持三种语言: 推荐使用「最小化到托盘」,方便通过托盘快速切换供应商。 +### 轻量模式 + +v3.13.0 起新增「轻量模式」——一种**仅托盘运行**的状态,用于把空闲时的桌面占用降到最低。 + +**触发方式**:右键系统托盘图标 → 点击「轻量模式」。主窗口会被**销毁**(而不是隐藏),UI 资源和内存随之释放。 + +**退出方式**:从托盘菜单点击「打开主界面」,或通过深链接 / 再次启动 CC Switch。窗口会按需**重建**,状态保持一致。 + +| 特性 | 最小化到托盘 | 轻量模式 | +| ------------ | -------------------- | ------------------------ | +| UI 进程 | 保留在内存中 | 完全销毁 | +| 空闲资源占用 | 与正常运行相当 | 接近零 | +| 再次打开速度 | 瞬时(直接显示) | 略慢(需要重建窗口) | +| 托盘切换功能 | 可用 | 可用 | +| 深链接唤起 | 可用 | 可用(按需重建) | + +> 💡 **使用场景**:如果你 CC Switch 长时间常驻后台,主要通过托盘菜单切换供应商,开启轻量模式能显著降低内存占用。 + +> ⚠️ **注意**:轻量模式状态不持久 — 下次正常启动时会回到普通模式。需要长期使用可搭配开机自启。 + ### Claude 插件集成 开启后,CC Switch 在切换供应商时会自动同步配置到 VS Code 中的 Claude Code 插件(写入 `~/.claude/config.json` 的 `primaryApiKey`)。 @@ -251,6 +271,26 @@ CC Switch 自身数据的存储位置,默认为 `~/.cc-switch/`。 - **debug** - 记录调试信息 - **trace** - 记录所有详细信息 +## OAuth 认证中心(Beta) + +设置 → **OAuth 认证中心** Tab + +v3.13.0 新增的 **OAuth 认证中心**(Beta)统一管理第三方 OAuth 凭据,目前支持两类账号: + +| 账号类型 | 用途 | +| ---------------------------- | ----------------------------------------------- | +| **GitHub Copilot** | 配合 Copilot 反向代理使用 | +| **ChatGPT (Codex OAuth)** | 配合 Codex OAuth 反向代理使用,管理 ChatGPT 账号 | + +**你可以在这里**: + +- 通过 Device Code 流程登录 ChatGPT / GitHub 账号 +- 查看已登录账号列表和认证状态 +- 为多账号设置默认账号 +- 移除单个账号或一键注销所有账号 + +> ⚠️ **注意**:这两项功能使用逆向 OAuth 流程,存在账号风险和服务条款风险。使用前请阅读 [2.1 添加供应商 → Codex OAuth 反向代理](../2-providers/2.1-add.md#codex-oauth-反向代理claude-供应商) 的完整风险提示。 + ## 关于页面 设置 → 关于 Tab diff --git a/docs/user-manual/zh/2-providers/2.1-add.md b/docs/user-manual/zh/2-providers/2.1-add.md index 563476837..b44b6f0d4 100644 --- a/docs/user-manual/zh/2-providers/2.1-add.md +++ b/docs/user-manual/zh/2-providers/2.1-add.md @@ -154,19 +154,20 @@ ## 自动获取模型 -添加或编辑供应商时,可以自动从供应商端点获取可用模型列表: +添加或编辑供应商时,可以自动从供应商端点发现可用模型列表,免去手动复制粘贴模型 ID 的繁琐流程。 1. 确保已填写 **API Key** 和 **端点地址** 2. 点击模型输入框旁的 **获取模型** 按钮(下载图标) -3. CC Switch 调用供应商的 `/v1/models` 端点获取模型列表 -4. 从按供应商分组的下拉菜单中选择模型 +3. CC Switch 使用配置的 API Key 调用 OpenAI 兼容的 `/v1/models` 端点 +4. 从按类别分组的下拉菜单中选择模型 -此功能适用于所有支持 OpenAI 兼容 `/v1/models` API 的供应商。Claude、Codex、Gemini、OpenCode 和 OpenClaw 供应商均可使用。 +此功能覆盖全部五个应用 —— **Claude / Codex / Gemini / OpenCode / OpenClaw**,适用于所有支持 `/v1/models` 端点的供应商。 **常见错误**: -- **认证失败(401/403)**:检查你的 API Key -- **端点不支持(404/405)**:该供应商未提供 `/v1/models` 端点 -- **超时**:端点响应缓慢,请稍后重试 +- **认证失败(401/403)**:检查你的 API Key 是否正确 +- **端点不支持(404/405)**:该供应商未提供 `/v1/models` 端点,需手动填写模型 ID +- **解析失败**:返回内容不符合 OpenAI 兼容格式 +- **超时**:端点响应缓慢,请稍后重试或检查网络 ## 自定义配置 @@ -330,6 +331,135 @@ CC Switch 支持两种方式导入供应商配置: > ⚠️ **注意**:导入会覆盖现有数据库,建议先导出当前配置作为备份。导出的文件名格式为 `cc-switch-export-{时间戳}.sql`。 +## Codex OAuth 反向代理(Claude 供应商) + +v3.13.0 起,CC Switch 新增了 **Codex OAuth 反向代理**路径,让你可以**用 ChatGPT 账号**在 Claude Code 中复用 Codex 服务。 + +> 💡 **位置提示**:这项功能作为一个**新的 Claude 供应商卡片类型**出现,而不是 Codex 侧的预设。添加后会和普通 API-Key 型供应商并列在 Claude 的供应商列表中。 + +### 前提条件 + +- 拥有可登录的 **ChatGPT 账号** +- 能够访问 `auth.openai.com` 和 `chatgpt.com` +- **在使用前请先阅读本节末尾的 [⚠️ 风险提示](#️-风险提示重要)** + +### 两个入口 + +你可以从下面任意一个入口开始: + +#### 入口 A:从添加供应商面板开始(推荐新用户) + +1. 切换到 **Claude** 应用 +2. 点击右上角的 **+** 按钮打开添加供应商面板 +3. 在预设列表的第三方分类下选择 **Codex (ChatGPT Plus/Pro)** 预设(以 UI 中显示的名称为准) +4. 如果尚未登录 ChatGPT 账号,面板会**自动引导**你进入登录流程(见下文"登录流程") +5. 登录成功后,供应商表单会显示已登录的账号,点击「保存」完成添加 + +#### 入口 B:从 OAuth 认证中心开始(适合多账号管理) + +1. 打开 **设置 → OAuth 认证中心**(标签页顶部带 **Beta** 标记) +2. 在 **ChatGPT (Codex OAuth)** 区块点击 **使用 ChatGPT 登录** 按钮 +3. 完成登录流程(见下文) +4. 登录完成后,回到 **Claude** 应用 → **添加供应商** → 选择同一个 Codex (ChatGPT Plus/Pro) 预设 +5. 在表单中的「选择账号」下拉框选择刚登录的账号,保存即可 + +### 登录流程(Device Code) + +不管从哪个入口进入,登录流程都一致: + +1. **获取验证码**:CC Switch 调用 OpenAI Device Code 流程,并在界面上显示: + - 一个 **验证码**(约 8 位字符,例如 `ABCD-1234`) + - 验证码右侧的 **复制** 按钮 + - 下方的授权链接 `https://auth.openai.com/codex/device` + - "等待授权中..." 的动画提示 +2. **浏览器授权**:点击链接(或手动访问该 URL),在浏览器中: + - 登录你的 ChatGPT 账号 + - 输入上一步复制的验证码 + - 确认授权 +3. **自动轮询完成**:CC Switch 会在后台持续轮询 OpenAI 服务器,检测到授权成功后自动关闭等待界面 +4. **显示已登录账号**:登录的 ChatGPT 账号会出现在 **OAuth 认证中心 → 已登录账号**列表中,显示登录邮箱 + +> ⏱️ **验证码有效期约 15 分钟**。如果超时,界面会显示"Device Code 已过期",点击「重试」即可重新获取验证码。 + +### 启用与使用 + +添加并保存 Codex OAuth 供应商后: + +1. 在 Claude 供应商列表中找到它 +2. 点击卡片的 **启用** 按钮 — 和普通供应商完全一致 +3. Claude Code CLI 即可通过反向代理使用 ChatGPT 订阅 +4. 托盘菜单的 **Claude** 子菜单中也会出现这个供应商,支持快速切换 + +> 💡 **底层细节**:CC Switch 会将请求路由到 `https://chatgpt.com/backend-api/codex`,Base URL 被强制重写 — 你**无需**在表单中手动填写端点地址。API 格式固定为 `openai_responses`。 + +### 默认模型 + +Codex OAuth 预设的默认模型映射: + +| 角色 | 默认模型 | +| ------------- | -------------- | +| 主模型 | `gpt-5.4` | +| Sonnet 角色 | `gpt-5.4` | +| Opus 角色 | `gpt-5.4` | +| Haiku 角色 | `gpt-5.4-mini` | + +你可以在供应商的 JSON 编辑器中覆盖 `ANTHROPIC_MODEL` 等环境变量来自定义。 + +### 多账号管理(OAuth 认证中心) + +**OAuth 认证中心**支持同时管理多个 ChatGPT 账号: + +| 操作 | 说明 | +| ---------------- | ---------------------------------------------------- | +| 添加其他账号 | 点击「添加其他账号」重复登录流程 | +| 设为默认 | 在账号行点击「设为默认」—— 新建供应商默认使用该账号 | +| 为供应商选账号 | 供应商表单中通过「选择账号」下拉框指定特定账号 | +| 移除账号 | 点击账号右侧的红色 × 移除(Token 被清除) | +| 注销所有账号 | 底部「注销所有账号」按钮一键清除 | + +> 💡 **使用场景**:如果你和团队共享一台开发机,可以为每个成员的 ChatGPT 账号各建一个供应商,通过托盘菜单快速切换。 + +### Token 自动刷新 + +- Token 会在**过期前 60 秒**自动刷新,全程后台进行,无需手动干预 +- Refresh Token 存储在本地数据目录,不会上传到任何地方 +- **不支持**导出 Token(防止泄露) + +### 配额展示 + +登录并启用供应商后,**供应商卡片底部**会自动显示账号配额: + +| 显示元素 | 示例 | 颜色规则 | +| ------------ | ------------------ | ------------------------------------------- | +| 使用百分比 | `45%` | < 70% 绿色,70–89% 橙色,≥ 90% 红色 | +| 重置倒计时 | `7d12h 后重置` | ChatGPT 账号的滑动窗口或每日限额 | +| 刷新按钮 | 圆形箭头 | 手动重新查询配额 | + +> ⚠️ **会话已过期**:如果 Token 完全失效(无法自动刷新),卡片底部会显示黄色警告框「会话已过期」。此时请到 **OAuth 认证中心**移除该账号并重新登录。 + +### 常见失败 + +| 场景 | 表现 | 解决方法 | +| -------------------- | ------------------------------- | --------------------------------------- | +| 验证码超时 | 显示"Device Code 已过期" | 点击「重试」重新获取验证码 | +| 浏览器拒绝授权 | 显示"用户拒绝授权" | 重新登录,在浏览器中点击"授权" | +| 网络错误 | 显示具体错误信息 | 检查网络连接,确认能访问 OpenAI 域名 | +| 创建供应商前未登录 | "请先登录 ChatGPT 账号"提示 | 先到 OAuth 认证中心完成登录 | +| Token 失效无法刷新 | 配额框显示"会话已过期" | 移除账号后重新登录 | +| 配额查询失败 | 配额框显示"查询失败" | 点击「刷新」按钮重试 | + +### ⚠️ 风险提示(重要) + +Codex OAuth 反向代理通过**逆向工程的 OAuth 流程**访问 ChatGPT 账号的 Codex 服务。启用前请务必理解以下风险: + +1. **违反服务条款**:可能违反 OpenAI 的服务条款,该条款禁止未经授权的自动化访问、服务复制和绕过既定访问路径 +2. **账号风险**:OpenAI 可能将异常使用模式标记为可疑自动化,对 ChatGPT 账号施加临时或永久限制 +3. **无法保证长期可用**:OpenAI 随时可能更新其认证和检测机制,当前可用的方式未来可能被封堵 + +**启用此功能即表示你自行承担所有风险**。CC Switch 不对因使用本功能产生的账号限制、警告或服务暂停承担责任。 + +> 📖 完整免责声明及更多背景参见 [v3.13.0 Release Notes](../../../release-notes/v3.13.0-zh.md#️-风险提示)。 + ## 高级选项 ### API 格式(仅 Claude) @@ -346,6 +476,30 @@ CC Switch 支持两种方式导入供应商配置: 当配置了非默认 API 格式时,高级选项区域会自动展开。 +### 完整 URL 端点模式 + +v3.13.0 起新增的高级选项。默认情况下,CC Switch 会把配置的 `base_url` 视作**前缀**,再在其后拼接 `/v1/chat/completions` 等固定路径。对于部分厂商(如需要非标准 URL 布局的第三方服务),这种拼接方式会导致请求失败。 + +**启用方式**: + +1. 编辑供应商,展开「高级选项」 +2. 勾选 **完整 URL 模式** 复选框 +3. 将**完整的上游端点**(而非前缀)填入 `base_url` + +**示例对比**: + +| 模式 | `base_url` 填写 | 实际请求目标 | +| ----------------------- | ------------------------------------------------ | ------------------------------------------------ | +| 默认(前缀拼接) | `https://api.example.com` | `https://api.example.com/v1/chat/completions` | +| **完整 URL 模式** | `https://api.example.com/custom/path/messages` | `https://api.example.com/custom/path/messages` | + +**适用场景**: +- 供应商要求使用非标准路径(不是 `/v1/chat/completions`) +- 供应商有多层级路径结构 +- 厂商专属的 API 网关路径 + +> 💡 **提示**:代理转发和 Stream Check 都会遵循「完整 URL 模式」配置,因此启用后无需额外调整。如果关闭此选项,路径拼接恢复为默认行为。 + ### Claude 通用配置快捷开关 编辑 Claude 供应商时,JSON 编辑器上方提供一组 **快捷开关**: diff --git a/docs/user-manual/zh/2-providers/2.2-switch.md b/docs/user-manual/zh/2-providers/2.2-switch.md index fcc79a27f..78f2e6484 100644 --- a/docs/user-manual/zh/2-providers/2.2-switch.md +++ b/docs/user-manual/zh/2-providers/2.2-switch.md @@ -30,10 +30,26 @@ 3. 点击要切换到的供应商名称 4. 切换完成,托盘会短暂提示 -> 供应商按应用类型(Claude/Codex/Gemini)组织到折叠子菜单中。子菜单标题显示当前激活的供应商名称。 - ### 托盘菜单结构 +v3.13.0 起,托盘菜单从原来的扁平列表重构为**按应用分组的分级子菜单**,为每个应用独立建立子菜单: + +| 子菜单 | 说明 | +| ----------- | -------------------------------------------- | +| Claude | Claude 所有供应商(含 Codex OAuth 反向代理) | +| Codex | Codex 所有供应商 | +| Gemini | Gemini 所有供应商 | +| OpenCode | OpenCode 所有供应商 | +| OpenClaw | OpenClaw 所有供应商 | + +**重构带来的好处**: + +- **防止菜单溢出**:有大量供应商时,扁平列表会超出屏幕高度;分级子菜单天然支持无限扩展 +- **子菜单标题显示当前激活供应商**:无需打开子菜单即可知道每个应用当前用的是哪个供应商 +- **按应用隔离操作**:切换 Claude 的供应商不会干扰到 Codex 的视图 + +> 💡 **提示**:后台常驻 + 轻量模式 + 分级子菜单的组合特别适合频繁切换多个应用的重度用户。参考 [1.5 个性化配置 → 轻量模式](../1-getting-started/1.5-settings.md)。 + ![image-20260108004348993](../../assets/image-20260108004348993.png) ## 生效方式 diff --git a/docs/user-manual/zh/2-providers/2.5-usage-query.md b/docs/user-manual/zh/2-providers/2.5-usage-query.md index d811ae92b..858cc8e49 100644 --- a/docs/user-manual/zh/2-providers/2.5-usage-query.md +++ b/docs/user-manual/zh/2-providers/2.5-usage-query.md @@ -1,8 +1,72 @@ # 2.5 用量查询 -## 功能说明 +CC Switch 的配额/余额展示分为两大类:**自动查询**(官方订阅类,开箱即用)和**手动启用**(内置模板 + 自定义脚本,需要用户配置后再显示)。 -用量查询功能允许你配置自定义脚本,实时查询供应商的剩余额度、已用量等信息。 +| 类别 | 范围 | 是否需要用户启用 | +| -------------------------- | --------------------------------------------------------------------- | ---------------- | +| **自动查询** | Claude / Codex / Gemini 官方订阅、GitHub Copilot、Codex OAuth 反向代理 | 否(默认启用) | +| **手动启用(内置模板)** | Token Plan、第三方余额查询 | 是(见下文) | +| **手动启用(自定义脚本)** | 未被内置模板覆盖的中转服务、私有部署、特殊 API | 是(见下文) | + +## 自动查询(官方订阅类) + +v3.13.0 起,以下三类供应商在启用后会**自动**在卡片底部显示配额,用户无需任何额外配置: + +| 类别 | 覆盖供应商 | 显示内容 | +| --------------- | ----------------------------------------- | --------------------------- | +| 官方订阅 | Claude / Codex / Gemini 官方登录 | 官方订阅配额 | +| GitHub Copilot | Copilot 供应商卡片 | Premium interactions 剩余量 | +| Codex OAuth | Codex OAuth 反向代理卡片(Claude 供应商) | ChatGPT 账号 Codex 配额 | + +这三类的共同特点是**数据来源唯一且语义明确**(官方订阅的使用率),不存在歧义,因此 CC Switch 直接调用对应的官方或 OAuth 查询接口。 + +### 自动查询的交互 + +- **卡片底部显示**:使用百分比 + 重置倒计时,颜色随使用率变化(< 70% 绿 / 70–89% 橙 / ≥ 90% 红) +- **手动刷新**:点击卡片上的刷新图标按钮重新查询 +- **卡片简化**:对这三类供应商,**健康检查**和**用量查询配置**按钮会被自动隐藏,避免干扰内置展示 +- **会话过期提示**:如果 Token 无法刷新,卡片会显示「会话已过期」警告(Copilot / Codex OAuth) + +--- + +## 手动启用(内置模板 + 自定义脚本) + +除了上述三类自动查询的供应商,**所有其他供应商**(包括 Token Plan、第三方余额查询、以及各类中转服务)都需要在供应商卡片上**手动打开「用量查询」开关**后才会显示配额。 + +### 为什么需要手动启用? + +一个重要原因是:**同一个请求地址(同一家供应商)可能同时提供多种查询模式** —— 既可能有按套餐的配额查询,也可能有按账户余额的查询。CC Switch 无法自动推断你想查哪一种,所以这类供应商的内置查询**默认关闭**,由你选择合适的模板后启用。 + +### 覆盖的内置模板 + +v3.13.0 为以下类别提供了**开箱即用的内置模板**,启用后无需手写脚本: + +| 类别 | 覆盖供应商 | 模板类型 | +| ---------- | --------------------------------------------------------- | ----------------------- | +| Token Plan | Kimi / Zhipu GLM / MiniMax | 套餐配额(带使用进度) | +| 第三方余额 | DeepSeek / StepFun / SiliconFlow / OpenRouter / Novita AI | 官方余额查询 | + +> 💡 除了以上内置模板外,对未被覆盖的供应商,你可以使用**自定义脚本**方式(见下文)编写自己的查询逻辑。 + +### 启用步骤 + +1. 鼠标悬停在供应商卡片上,显示操作按钮 +2. 点击 **用量查询** 按钮(📊 图标) +3. 在配置面板顶部打开 **启用用量查询** 开关 +4. 选择合适的内置模板(例如 Token Plan、第三方余额)或选择「自定义」 +5. 按需填入 API Key / Base URL / Access Token 等参数(大多数情况可留空,使用供应商本身的凭据) +6. 点击「测试脚本」确认能正常返回 +7. 保存配置 —— 下次激活该供应商时,配额将显示在卡片底部 + +> ⚠️ **注意**:启用后的自动刷新间隔通过「自动查询间隔」字段控制(设为 `0` 禁用自动刷新),仅当供应商处于「当前启用」状态时才会触发后台查询。 + +--- + +## 自定义脚本查询(高级) + +### 功能说明 + +当供应商**不在内置模板覆盖范围**内时,你可以用 JavaScript 编写自定义查询脚本。适用于中转服务、私有部署、特殊格式 API 等。 **使用场景**: - 查看 API 账户剩余余额 @@ -155,6 +219,24 @@ CC Switch 提供三种预设模板: ### 故障排除 +### 自动查询未显示配额(官方订阅类) + +**检查**: +1. 确认供应商是官方订阅类 —— Claude / Codex / Gemini 官方登录、GitHub Copilot、Codex OAuth 反向代理 +2. 供应商是否处于「当前启用」状态(非激活时不会触发查询) +3. 对于 OAuth 类型(Copilot / Codex OAuth),检查 Token 是否仍在有效期内;如果卡片显示「会话已过期」,请到 **OAuth 认证中心**重新登录 +4. 网络是否可访问官方配额接口 + +### 手动启用后仍未显示配额 + +**检查**: +1. 供应商卡片的「用量查询」面板顶部**启用用量查询**开关是否已打开 +2. 是否选择了合适的内置模板(Token Plan / 第三方余额 / 自定义) +3. 点击「测试脚本」查看返回的具体错误信息 +4. API Key / Base URL 等必要字段是否填写正确 +5. 网络是否可访问供应商的配额端点 +6. 仅当供应商处于「当前启用」状态时,后台自动查询才会生效 + ### 查询失败 **检查**: diff --git a/docs/user-manual/zh/3-extensions/3.3-skills.md b/docs/user-manual/zh/3-extensions/3.3-skills.md index 5354f9235..7af6dda0a 100644 --- a/docs/user-manual/zh/3-extensions/3.3-skills.md +++ b/docs/user-manual/zh/3-extensions/3.3-skills.md @@ -192,11 +192,59 @@ Subdirectory: skills ## 技能更新 -目前不支持自动更新。如需更新技能: +v3.13.0 起,Skills 支持**自动更新检测**和**批量更新**,不再需要卸载后重新安装。 -1. 卸载现有技能 -2. 刷新列表 -3. 重新安装 +### 更新检测原理 + +CC Switch 基于 **SHA-256 内容哈希**比较本地已安装的 skill 与远端仓库版本。只要远端有任何文件内容变化,本地对应的 skill 卡片会自动显示「有新版本」标识。 + +### 单项更新 + +对于有新版本的 skill: + +1. 在 Skills 面板找到带更新标识的 skill 卡片 +2. 点击卡片上的 **更新** 按钮 +3. 等待下载完成,状态自动刷新 + +### 全部更新 + +当有多个 skill 需要更新时: + +1. 点击 Skills 面板顶部的 **全部更新** 按钮(出现时带滑入动画) +2. CC Switch 会批量下载所有需要更新的 skill +3. 完成后面板自动刷新,更新标识消失 + +> 💡 **建议**:定期点击「刷新」按钮触发一次远端扫描,确保更新检测结果最新。 + +## 存储位置切换 + +v3.13.0 起,Skills 的**源存储位置**可以在两个位置之间切换: + +| 位置 | 说明 | +| ------------------------ | -------------------------------------------------------- | +| **CC Switch 内置存储** | 默认位置 `~/.cc-switch/skills/`,由 CC Switch 统一管理 | +| **`~/.agents/skills`** | 符合社区 agent 工具约定的共享目录,便于与其他工具协同 | + +### 切换方式 + +在 Skills 面板的设置或管理菜单中选择目标存储位置。切换过程**不会丢失 skill 状态** —— CC Switch 会平滑迁移现有 skill 到新位置。 + +> ⚠️ **区别提示**:本节的「存储位置切换」管理的是 skill 的**源存储**。而 [1.5 个性化配置 → Skills 同步方式](../1-getting-started/1.5-settings.md) 管理的是 skill 如何**分发到各应用目录**(软链接 vs 复制),两者配合使用。 + +## 公共注册表搜索(skills.sh) + +v3.13.0 集成了 **skills.sh** 公共注册表搜索,让你直接在 CC Switch 内发现社区 skill。 + +### 使用步骤 + +1. 点击「仓库管理」按钮打开对话框 +2. 在对话框内使用 **skills.sh 搜索** 输入框 +3. 输入关键词实时筛选结果 +4. 点击目标 skill 即可快速添加到你的仓库列表 + +v3.13.0 还修复了 skills.sh 链接失效和空描述的兼容处理,社区 skill 的元数据显示更稳定。 + +## 常见问题 ### 技能列表为空 @@ -224,3 +272,15 @@ Subdirectory: skills - 检查网络连接 - 检查磁盘空间 - 检查目录权限 + +### 更新按钮不出现 + +可能原因: + +- 远端仓库没有新内容 +- CC Switch 尚未完成最新扫描 + +解决方法: + +- 点击「刷新」重新扫描 +- 确认仓库配置指向正确的分支和路径 diff --git a/docs/user-manual/zh/3-extensions/3.4-sessions.md b/docs/user-manual/zh/3-extensions/3.4-sessions.md index ecd4c7759..0e29dca65 100644 --- a/docs/user-manual/zh/3-extensions/3.4-sessions.md +++ b/docs/user-manual/zh/3-extensions/3.4-sessions.md @@ -89,6 +89,22 @@ > 如果会话没有可用的恢复命令,恢复按钮将被禁用。 +#### 目录选择器(Claude 终端恢复) + +v3.13.0 起,**Claude 会话**恢复前会弹出**目录选择器**,让你可以覆盖默认的项目目录。适用于下列场景: + +- **项目已迁移**:原项目目录已被移动或重命名 +- **软链接断裂**:原始路径无法访问 +- **临时换目录**:想在不同的工作目录中继续对话 + +**使用方法**: + +1. 点击 Claude 会话的 **恢复** 按钮 +2. 在弹出的目录选择器中,确认默认目录或选择新目录 +3. CC Switch 会在所选目录下启动 Claude 终端会话 + +> 💡 **提示**:Codex / Gemini / OpenCode / OpenClaw 会话的恢复流程暂不包含目录选择器,仍使用会话原始项目目录。 + ### 删除会话 点击 **删除** 按钮(垃圾桶图标)永久删除会话文件。删除前会显示确认对话框。 diff --git a/docs/user-manual/zh/4-proxy/4.4-usage.md b/docs/user-manual/zh/4-proxy/4.4-usage.md index 98d6d88d7..7e0b79ab0 100644 --- a/docs/user-manual/zh/4-proxy/4.4-usage.md +++ b/docs/user-manual/zh/4-proxy/4.4-usage.md @@ -9,14 +9,34 @@ - 分析使用模式 - 排查问题 +v3.13.0 起,用量数据有两个来源: + +| 数据来源 | 覆盖范围 | 是否需要代理拦截 | +| -------------------------- | -------------------------------- | ---------------- | +| **代理请求日志** | 通过代理转发的所有请求 | 需要 | +| **CLI 会话日志**(v3.13 新增) | Claude / Codex / Gemini 会话历史 | 不需要 | + +- **Codex 会话**:改用 JSONL 会话日志**精确解析**,替代原先的估算,并对模型名称做归一化保证定价查询一致 +- **Gemini 会话**:通过 Gemini CLI 会话日志精确同步 +- **Claude 会话**:同样支持从会话日志直接导入用量 +- 用量面板支持**按应用筛选**(Claude / Codex / Gemini),数据互不干扰 + ## 前提条件 -使用用量统计功能需要: +根据你使用的数据来源,前提条件不同: + +**代理请求日志**(覆盖全部应用和所有代理请求): 1. ✅ 启动代理服务 2. ✅ 开启应用接管 3. ✅ 开启日志记录 +**CLI 会话日志**(v3.13 新增,无需代理): + +1. ✅ 在 CC Switch 中启用对应应用(Claude / Codex / Gemini) +2. ✅ 确保对应 CLI 有会话历史文件 +3. ✅ CC Switch 会定期扫描会话目录并导入用量 + ## 打开用量统计 设置 → 用量 Tab @@ -212,7 +232,7 @@ ### 预设价格 -CC Switch 预设了常用模型的官方价格(每百万 Token): +CC Switch 预设了常用模型的官方价格(每百万 Token)。v3.13.0 修正了部分模型的 **CNY → USD 定价**并补齐了此前缺失的模型定义,同时修复了 **MiniMax 套餐配额数学**与 **0% → 100% 用量进度**,使费用估算和套餐进度展示更准确。 **Claude 系列(美元)**: diff --git a/docs/user-manual/zh/4-proxy/4.5-model-test.md b/docs/user-manual/zh/4-proxy/4.5-model-test.md index b3a98522a..3cecea69b 100644 --- a/docs/user-manual/zh/4-proxy/4.5-model-test.md +++ b/docs/user-manual/zh/4-proxy/4.5-model-test.md @@ -2,12 +2,15 @@ ## 功能说明 -模型检查功能用于验证供应商配置的模型是否可用,通过发送实际的 API 请求来测试: +模型检查功能(也称为 **Stream Check**)用于验证供应商配置的模型是否可用,通过发送实际的 API 请求来测试: - 模型是否存在 - API Key 是否有效 - 端点是否正常响应 - 响应延迟是否正常 +- 流式响应首字节时间(TTFB) + +v3.13.0 起,Stream Check 覆盖范围扩展到**全部五个应用**(Claude / Codex / Gemini / OpenCode / OpenClaw),包括 OpenClaw 的全部协议变体(`openai-completions` 等)。OpenCode 通过 npm 包映射自动识别;OpenClaw 支持自定义 `auth-header` 检测,并处理了 Bedrock 错误消息、`baseURL` 回退等边界情况。 ## 打开配置 @@ -17,11 +20,13 @@ 为每个应用配置用于测试的模型: -| 应用 | 配置项 | 默认值 | 说明 | -|------|--------|--------|------| -| Claude | Claude 模型 | 系统默认 | 建议使用 Haiku 系列(成本低、速度快) | -| Codex | Codex 模型 | 系统默认 | 建议使用 mini 系列 | -| Gemini | Gemini 模型 | 系统默认 | 建议使用 Flash 系列 | +| 应用 | 配置项 | 默认值 | 说明 | +| -------- | ------------- | -------- | -------------------------------------------- | +| Claude | Claude 模型 | 系统默认 | 建议使用 Haiku 系列(成本低、速度快) | +| Codex | Codex 模型 | 系统默认 | 建议使用 mini 系列 | +| Gemini | Gemini 模型 | 系统默认 | 建议使用 Flash 系列 | +| OpenCode | OpenCode 模型 | 系统默认 | v3.13.0 新增,通过 npm 包映射自动检测 | +| OpenClaw | OpenClaw 模型 | 系统默认 | v3.13.0 新增,覆盖全部协议变体及自定义 auth-header | ### 模型选择建议 diff --git a/docs/user-manual/zh/5-faq/5.2-questions.md b/docs/user-manual/zh/5-faq/5.2-questions.md index 3f0a5e82d..927824dd3 100644 --- a/docs/user-manual/zh/5-faq/5.2-questions.md +++ b/docs/user-manual/zh/5-faq/5.2-questions.md @@ -156,6 +156,51 @@ chmod +x CC-Switch-*.AppImage - [ ] 日志记录是否开启 - [ ] 是否有请求通过代理 +## 配额与余额 + +### 为什么有的供应商自动显示配额,有的需要手动启用? + +只有**官方订阅类**(Claude / Codex / Gemini 官方登录、GitHub Copilot、Codex OAuth 反向代理)会在启用供应商后自动显示配额。**其他所有供应商**(包括 Token Plan 和第三方余额查询)都需要手动到供应商卡片的「用量查询」面板中打开开关并选择内置模板,因为同一个请求地址可能同时有"套餐"和"余额"两种查询模式,需要你自行选择。详见 [2.5 用量查询 → 手动启用](../2-providers/2.5-usage-query.md#手动启用内置模板--自定义脚本)。 + +### 官方订阅供应商没有显示配额 + +**检查**: +1. 确认供应商处于「当前启用」状态(非激活时不触发查询) +2. 对于 Copilot / Codex OAuth,检查 OAuth Token 是否仍在有效期内;如果卡片显示「会话已过期」,请到 **OAuth 认证中心**重新登录 +3. 检查网络连通性 +4. 点击卡片上的刷新图标手动重新查询 + +### Token Plan 或第三方余额启用后仍不显示 + +**检查**: +1. 确认在「用量查询」面板中已打开「启用用量查询」开关 +2. 已经选择了合适的内置模板并保存 +3. 点击「测试脚本」查看具体错误信息 +4. 供应商需要处于「当前启用」状态后台才会自动刷新 + +### Codex 用量和直连时对不上 + +v3.13.0 将 Codex 用量从估算切换为**基于 JSONL 会话日志的精确解析**,同时对模型名称做归一化以保证定价查询一致。新数据会与官方账单对齐;若仍看到旧的估算数据,可以删除历史条目或等待新会话数据覆盖。 + +## Codex OAuth 反向代理 + +### 启用 Codex OAuth 反向代理有什么风险? + +Codex OAuth 反向代理通过**逆向工程的 OAuth 流程**访问 ChatGPT 账号的 Codex 服务,可能违反 OpenAI 的服务条款,存在账号被限制或暂停的风险,且长期可用性无法保证。**启用即表示自行承担所有风险**。 + +完整免责声明参见 [v3.13.0 Release Notes → 风险提示](../../../release-notes/v3.13.0-zh.md#️-风险提示) 和 [2.1 添加供应商 → Codex OAuth 反向代理](../2-providers/2.1-add.md)。 + +### 如何登录 Codex OAuth? + +完整的 Device Code 登录流程(验证码 + 浏览器授权)、两个入口(添加供应商面板 / OAuth 认证中心)、多账号管理和常见失败场景,参见 [2.1 添加供应商 → Codex OAuth 反向代理(Claude 供应商)](../2-providers/2.1-add.md#codex-oauth-反向代理claude-供应商)。 + +### Codex OAuth 登录后配额没显示 + +**解决方法**: +1. 确认在 **OAuth 认证中心**(设置 → OAuth 认证中心,带 Beta 标记)中已完成 OAuth 登录流程 +2. 检查 Token 是否仍在有效期内 — 卡片上如果显示"会话已过期"表示 Token 无法刷新 +3. 如果过期,在 OAuth 认证中心移除该账号后重新登录 + ## 其他问题 ### 托盘图标不显示 @@ -193,6 +238,10 @@ chmod +x CC-Switch-*.AppImage 是的。轻量模式会销毁主窗口及其 Web 视图,显著减少内存占用,同时保留托盘菜单功能。 +### 轻量模式下深链接还能唤起主界面吗? + +可以。CC Switch v3.13.0 起会覆盖所有窗口重新显示路径(正常启动、深链接、单例激活、托盘 `show_main` 以及轻量模式返程),点击 `ccswitch://` 链接会**按需重建**主窗口并显示导入确认对话框。第一次打开会比普通状态略慢(需要重建窗口),但后续切换恢复正常速度。 + ## 获取帮助 ### 提交 Issue diff --git a/docs/user-manual/zh/README.md b/docs/user-manual/zh/README.md index 918194bde..1f6efba15 100644 --- a/docs/user-manual/zh/README.md +++ b/docs/user-manual/zh/README.md @@ -103,9 +103,19 @@ ## 版本信息 -- 文档版本:v3.12.3 -- 最后更新:2026-04-04 -- 适用于 CC Switch v3.12.3+ +- 文档版本:v3.13.0 +- 最后更新:2026-04-08 +- 适用于 CC Switch v3.13.0+ + +### v3.13.0 亮点 + +- **轻量模式**:退出到托盘时销毁主窗口,空闲占用接近零 — 详见 [1.5 个性化配置](./1-getting-started/1.5-settings.md) +- **配额与余额展示**:官方订阅类(Claude/Codex/Gemini/Copilot/Codex OAuth)自动展示剩余额度;Token Plan 和第三方余额通过内置模板一键启用 — 详见 [2.5 用量查询](./2-providers/2.5-usage-query.md) +- **Codex OAuth 反向代理**:用 ChatGPT 账号在 Claude Code 中复用 Codex 服务 — 详见 [2.1 添加供应商](./2-providers/2.1-add.md) +- **托盘按应用分级菜单**:五应用独立子菜单,防止菜单溢出 — 详见 [2.2 切换供应商](./2-providers/2.2-switch.md) +- **Skills 发现与批量更新**:SHA-256 更新检测、批量更新、skills.sh 公共注册表搜索 — 详见 [3.3 Skills 技能管理](./3-extensions/3.3-skills.md) +- **完整 URL 端点模式**:高级选项支持将 base_url 视作完整上游端点 — 详见 [2.1 添加供应商](./2-providers/2.1-add.md) +- **OpenCode / OpenClaw 流式检测全覆盖**:Stream Check 面板扩展到全部五个应用 — 详见 [4.5 模型检查](./4-proxy/4.5-model-test.md) ## 贡献