Back to Cc Switch

2.1 Add Provider

docs/user-manual/en/2-providers/2.1-add.md

3.14.122.5 KB
Original Source

2.1 Add Provider

Open the Add Panel

Click the + button in the top-right corner of the main interface to open the Add Provider panel.

The panel has two tabs:

  • App-specific Provider: Only for the currently selected app (Claude/Codex/Gemini/OpenCode/OpenClaw)
  • Universal Provider: Shared configuration across apps

Add Using Presets

Presets are pre-configured provider templates that only require an API Key to use.

Steps

  1. Select a provider from the "Preset" dropdown
  2. Name and endpoint are auto-filled
  3. Enter your API Key
  4. (Optional) Add notes
  5. Click "Add"

Common Presets

Claude Presets

Preset NameDescription
Claude OfficialLog in with an Anthropic official account
DeepSeekDeepSeek model
Zhipu GLMZhipu AI GLM model
Zhipu GLM enZhipu AI (English version)
BailianAlibaba Cloud Bailian (Qwen)
KimiMoonshot Kimi model
Kimi For CodingKimi coding-specific model
StepFunStepFun model
ModelScopeModelScope community
KAT-CoderKAT-Coder model
LongcatLongcat AI
MiniMaxMiniMax model
MiniMax enMiniMax (English version)
DouBaoSeedDouBao Seed model
BaiLingBaiLing AI
AiHubMixAiHubMix aggregation service
SiliconFlowSiliconFlow
SiliconFlow enSiliconFlow (English version)
DMXAPIDMXAPI proxy service
PackyCodePackyCode proxy service
CubenceCubence service
AIGoCodeAIGoCode service
RightCodeRightCode service
AICodeMirrorAICodeMirror service
OpenRouterAggregation routing service
NvidiaNvidia AI service
Xiaomi MiMoXiaomi MiMo model

The preset list may be updated with new versions. Refer to the actual list shown in the app.

Codex Presets

Preset NameDescription
OpenAI OfficialLog in with an OpenAI official account
Azure OpenAIAzure OpenAI service
AiHubMixAiHubMix aggregation service
DMXAPIDMXAPI proxy service
PackyCodePackyCode proxy service
CubenceCubence service
AIGoCodeAIGoCode service
RightCodeRightCode service
AICodeMirrorAICodeMirror service
OpenRouterAggregation routing service

Gemini Presets

Preset NameDescription
Google OfficialLog in with Google OAuth
PackyCodePackyCode proxy service
CubenceCubence service
AIGoCodeAIGoCode service
AICodeMirrorAICodeMirror service
OpenRouterAggregation routing service
CustomManually configure all parameters

OpenCode Presets

Preset NameDescription
DeepSeekDeepSeek model
Zhipu GLMZhipu AI GLM model
Zhipu GLM enZhipu AI (English version)
BailianAlibaba Cloud Bailian
Kimi k2.5Moonshot Kimi-k2.5 model
Kimi For CodingKimi coding-specific model
StepFunStepFun model
ModelScopeModelScope community
KAT-CoderKAT-Coder model
LongcatLongcat AI
MiniMaxMiniMax model
MiniMax enMiniMax (English version)
DouBaoSeedDouBao Seed model
BaiLingBaiLing AI
Xiaomi MiMoXiaomi MiMo model
AiHubMixAiHubMix aggregation service
DMXAPIDMXAPI proxy service
OpenRouterAggregation routing service
NvidiaNvidia AI service
PackyCodePackyCode proxy service
CubenceCubence service
AIGoCodeAIGoCode service
RightCodeRightCode service
AICodeMirrorAICodeMirror service
OpenAI CompatibleOpenAI-compatible interface
Oh My OpenCodeOh My OpenCode service

The preset list is continuously updated. Refer to the actual list shown in the app.

OpenClaw Presets

Preset NameDescription
DeepSeekDeepSeek model
Zhipu GLMZhipu AI GLM model
Zhipu GLM enZhipu AI (English version)
Qwen CoderQwen coding model
Kimi k2.5Moonshot Kimi-k2.5 model
Kimi For CodingKimi coding-specific model
StepFunStepFun model
MiniMaxMiniMax model
MiniMax enMiniMax (English version)
KAT-CoderKAT-Coder model
LongcatLongcat AI
DouBaoSeedDouBao Seed model
BaiLingBaiLing AI
Xiaomi MiMoXiaomi MiMo model
AiHubMixAiHubMix aggregation service
DMXAPIDMXAPI proxy service
OpenRouterAggregation routing service
ModelScopeModelScope community
SiliconFlowSiliconFlow
SiliconFlow enSiliconFlow (English version)
NvidiaNvidia AI service
PackyCodePackyCode proxy service
CubenceCubence service
AIGoCodeAIGoCode service
RightCodeRightCode service
AICodeMirrorAICodeMirror service
AICodingAICoding service
CrazyRouterCrazyRouter service
SSSAiCodeSSSAiCode service
AWS BedrockAWS Bedrock service
OpenAI CompatibleOpenAI-compatible interface

Auto-Fetch Models

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 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 covers all five appsClaude / 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; 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

After selecting the "Custom" preset, you need to manually edit the JSON configuration.

Claude Configuration Format

json
{
  "env": {
    "ANTHROPIC_API_KEY": "your-api-key",
    "ANTHROPIC_BASE_URL": "https://api.example.com"
  }
}
FieldRequiredDescription
ANTHROPIC_API_KEYYesAPI key
ANTHROPIC_BASE_URLNoCustom endpoint URL
ANTHROPIC_AUTH_TOKENNoAlternative authentication method to API_KEY

Codex Configuration Format

Codex uses two configuration files:

1. auth.json (~/.codex/auth.json) - Stores API key:

json
{
  "OPENAI_API_KEY": "your-api-key"
}

2. config.toml (~/.codex/config.toml) - Stores model and endpoint configuration:

toml
# Basic configuration
model_provider = "custom"
model = "gpt-5.2"
model_reasoning_effort = "high"
disable_response_storage = true

# Custom provider configuration
[model_providers.custom]
name = "custom"
base_url = "https://api.example.com/v1"
wire_api = "responses"
requires_openai_auth = true

auth.json field descriptions:

FieldRequiredDescription
OPENAI_API_KEYYesAPI key

config.toml field descriptions:

FieldRequiredDescription
model_providerYesModel provider name (must match [model_providers.xxx])
modelYesModel to use (e.g., gpt-5.2, gpt-4o)
model_reasoning_effortNoReasoning effort: low / medium / high
disable_response_storageNoWhether to disable response storage
base_urlYesAPI endpoint URL
wire_apiNoAPI protocol type (usually responses)
requires_openai_authNoWhether to use OpenAI authentication

Gemini Configuration Format

json
{
  "env": {
    "GEMINI_API_KEY": "your-api-key",
    "GOOGLE_GEMINI_BASE_URL": "https://api.example.com"
  }
}
FieldRequiredDescription
GEMINI_API_KEYYesAPI key
GOOGLE_GEMINI_BASE_URLNoCustom endpoint URL
GEMINI_MODELNoSpecify model

Authentication type is automatically detected by CC Switch (PackyCode API proxy / Google OAuth / generic API Key), no manual configuration needed.

Universal Provider

Universal providers can share configurations across Claude/Codex/Gemini/OpenCode/OpenClaw, suitable for proxy services that support multiple API formats.

Create a Universal Provider

  1. Switch to the "Universal Provider" tab
  2. Click "Add Universal Provider"
  3. Fill in the common configuration:
    • Name
    • API Key
    • Endpoint URL
  4. Check the apps to sync to (Claude/Codex/Gemini/OpenCode/OpenClaw)
  5. Save

Sync Mechanism

Universal providers automatically sync to the selected apps:

  • After modifying a universal provider, all linked app configurations are updated
  • After deleting a universal provider, linked app configurations are also deleted

Save and Sync

When editing a universal provider, you can choose:

ActionDescription
SaveSave configuration only, without immediate sync
Save and SyncSave configuration and immediately sync to all enabled apps

Manual Sync

If you need to manually trigger a sync:

  1. Click the "Sync" button on the universal provider card
  2. Confirm the sync operation
  3. Configuration will overwrite the linked provider in each app

Import Providers

CC Switch supports two ways to import provider configurations:

One-click import via ccswitch:// protocol links:

  1. Click or visit the deep link
  2. CC Switch opens automatically and shows the import confirmation
  3. Preview the configuration information
  4. Click "Confirm Import"

Getting deep links:

Option 2: Database Backup Import

Batch import from SQL backup files:

  1. Open "Settings > Advanced > Data Management"
  2. Click "Select File"
  3. Select a previously exported .sql backup file
  4. Click "Import"
  5. Confirm to overwrite existing configuration

Imported contents:

  • All provider configurations
  • MCP server configurations
  • Prompt presets
  • Usage logs

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 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:

RoleDefault Model
Main modelgpt-5.4
Sonnet rolegpt-5.4
Opus rolegpt-5.4
Haiku rolegpt-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:

ActionDescription
Add another accountClick Add Another Account to repeat the login flow
Set as defaultClick Set as Default on an account row — new providers use it
Choose for a providerIn the provider form, use the Select Account dropdown
Remove accountClick the red × next to an account (the token is cleared)
Log out all accountsThe 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 ElementExampleColor Rules
Usage percentage45%< 70% green, 70–89% orange, ≥ 90% red
Reset countdown7d12h until resetChatGPT account's sliding window or daily limit
Refresh buttonCircular arrowManually 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

ScenarioSymptomResolution
Verification code timeout"Device Code has expired" shownClick Retry to get a new code
Authorization denied"User denied authorization"Retry and click "Authorize" in the browser
Network errorSpecific error details shownCheck 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 boxRemove the account and log in again
Quota query failed"Query failed" in quota boxClick 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.

Advanced Options

API Format (Claude Only)

When adding a Claude provider that uses a third-party API, you may need to select the correct API Format in the Advanced Options section:

FormatDescriptionWhen to Use
Anthropic MessagesNative Anthropic API format (default)Direct Anthropic API or compatible proxies
OpenAI Chat CompletionsOpenAI Chat API format, auto-converted by proxyProvider only supports OpenAI Chat format
OpenAI Responses APIOpenAI Responses API format, auto-converted by proxyProvider only supports OpenAI Responses format

Note: API format conversion is handled by the proxy service. When using non-Anthropic formats, the proxy must be running with takeover enabled for correct request/response conversion. See 4.1 Proxy Service for details.

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:

Modebase_url valueActual request target
Default (prefix concat)https://api.example.comhttps://api.example.com/v1/chat/completions
Full URL Modehttps://api.example.com/custom/path/messageshttps://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:

ToggleEffectConfig Change
Hide AttributionClears commit/PR attribution metadataSets attribution: {commit: "", pr: ""}
Enable TeammatesEnables the agent teams featureSets env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS = "1"
Enable Tool SearchEnables tool search functionalitySets env.ENABLE_TOOL_SEARCH = "true"
Max EffortSets effort level to maxSets effortLevel = "max"
Disable Auto UpgradePrevents Claude Code auto-updatesSets env.DISABLE_AUTOUPDATER = "1"

When a toggle is unchecked, its corresponding config entry is removed entirely. Changes are reflected in the JSON editor in real-time.

Additionally, the Write Common Config checkbox enables merging a global config snippet into the provider. Click Edit Common Config to customize the shared snippet.

Codex 1M Context Window

When adding a Codex provider, an Enable 1M Context Window toggle is available:

  • When enabled: Sets model_context_window = 1000000 and auto-fills model_auto_compact_token_limit = 900000 in config.toml
  • When disabled: Removes both fields

The auto-compact limit can be customized in the text field that appears when the toggle is on.

Custom Icon

Click the icon area to the left of the name to:

  • Select a preset icon
  • Customize icon color

Enter the provider's website or console URL for quick access:

  • Click the link icon on the provider card to open directly
  • Useful for checking balance, obtaining API keys, etc.

Notes

Add notes such as:

  • Account purpose (personal/work)
  • Plan information
  • Expiration date

Notes are displayed on the provider card and are searchable.

Endpoint Speed Test

After adding a provider, you can speed-test API endpoints:

  1. Click the "Speed Test" button on the provider card
  2. Add multiple endpoint URLs in the speed test panel
  3. Click "Test" to run the test
  4. Select the endpoint with the lowest latency

Test results:

  • Green: Latency < 500ms (Excellent)
  • Yellow: Latency 500-1000ms (Fair)
  • Red: Latency > 1000ms (Slow)