Page summary

Use deep links to open pages or trigger specific CC Switch actions quickly.

5.3 Deep Link Protocol

Overview

CC Switch supports the ccswitch:// deep link protocol, enabling one-click configuration import via links.

Use cases:

Online Generator Tool

CC Switch provides an online deep link generator tool:

URL: https://ccswitch.io/deplink.html

Running an API service and want a one-click "Import to CC Switch" button on your site? See the site owner integration guide: how to generate per-user links, how to wire the button, and how to show the balance right after import.

How to Use

  1. Open the above URL
  2. Select the import type (Provider / MCP / Prompt / Skill repository)
  3. Fill in the configuration information
  4. Click "Generate Link"
  5. Copy the generated deep link
  6. Share with others or use on other devices

Protocol Format

V1 Protocol

Uses URL parameter format, easy to read and generate:

ccswitch://v1/import?resource={type}&app={app}&name={name}&...

Common parameters:

ParameterRequiredDescription
resourceYesResource type: provider / mcp / prompt / skill
appYesApp type (needed for provider and prompt): claude / codex / gemini / agy / grokbuild / opencode / openclaw / hermes / pi; prompt also supports mcode. Provider deep-link import is not yet supported for Claude Desktop or MiniMax Code
nameRequired for provider and promptName (for MCP, the server ID comes from the key under mcpServers in config; not needed for Skill)

Provider parameters (resource=provider):

ParameterRequiredDescription
endpointNoAPI endpoint URL (supports comma-separated multiple URLs)
apiKeyNoAPI key
homepageNoProvider website
modelNoDefault model. Can be left empty for Claude Code when you serve genuine Claude models; required for Pi
apiFormatNoAPI format: anthropic / openai_chat / openai_responses / gemini_native, mapped per app (OpenCode npm, OpenClaw and Pi api, Hermes api_mode; for Claude Code, Codex, and Grok Build a non-native format needs local routing). Defaults to the app's own format; formats the app does not support are rejected
haikuModelNoHaiku model (Claude only)
sonnetModelNoSonnet model (Claude only)
opusModelNoOpus model (Claude only)
notesNoNotes
iconNoIcon
configNoBase64-encoded configuration content. For Codex, use {"auth": {...}, "config": "<config.toml text>"}, or pass the whole config.toml with configFormat=toml. Only the connection and auth fields of the selected [model_providers.*] table (such as wire_api, http_headers, supports_websockets, and a model_catalog_url on the same origin as the endpoint) and the top-level model, reasoning effort, web_search and similar keys are imported, and the route is always renamed to custom. Global settings such as [features], MCP and permissions are skipped. Links whose table uses auth, aws, gateway_oauth or env_http_headers are rejected, and env_key is ignored (the link's own key is used)
configFormatNoConfiguration format: json / toml
configUrlNoNot supported yet; links that carry it are rejected. Pass the config inline with config
enabledNoInitial state of the "switch after import" toggle in the confirmation dialog (for OpenCode, OpenClaw, Hermes, and Pi it is "add to the app config" and defaults to on); the toggle decides on import
usageScriptNoUsage query script
usageEnabledNoWhether to enable usage query. When omitted, it is enabled if usageScript is present and disabled otherwise; pass false to import the script without enabling it (it can be enabled later in the app). The script body is shown in full in the import confirmation dialog
usageApiKeyNoUsage query API Key
usageBaseUrlNoUsage query base URL
usageAccessTokenNoUsage query access token
usageUserIdNoUsage query user ID
usageAutoIntervalNoAuto query interval (minutes)

For Grok Build, config likewise takes {"config": "<config.toml text>"} or the whole config.toml with configFormat=toml. Only the [model."<name>"] table named by [models] default is imported (display name, description, api_backend, context_window, sampling and retry settings, etc.); the endpoint and key always come from the link parameters, and other model tables are skipped. Links whose table uses auth_provider, env_http_headers or mtls_cert_dir are rejected, and env_key is ignored.

Prompt parameters (resource=prompt):

ParameterRequiredDescription
contentYesPrompt content, Base64-encoded (then URL-escaped)
descriptionNoDescription
enabledNoInitial state of the "enable after import" toggle in the confirmation dialog; the toggle decides on import

MCP parameters (resource=mcp):

ParameterRequiredDescription
appsYesApp list (comma-separated, e.g., claude,codex,gemini,grokbuild). Available values: claude / codex / gemini / agy / grokbuild (grok also works) / opencode / hermes / pi / mcode; openclaw does not support MCP and is ignored
configYesMCP configuration JSON in the form {"mcpServers": {"<server ID>": {...}}}, Base64-encoded (then URL-escaped)
enabledNoCurrently has no effect

Skill parameters (resource=skill): a deep link adds a Skill repository and does not install a Skill directly; after adding it, go to the "Skills" page and choose which Skill to install.

ParameterRequiredDescription
repoYesRepository (format: owner/name)
directoryNoDirectory path
branchNoGit branch

Example:

ccswitch://v1/import?resource=provider&app=claude&name=My%20Provider&endpoint=https%3A%2F%2Fapi.example.com&apiKey=sk-xxx

Import Type Examples

Import Provider

ccswitch://v1/import?resource=provider&app=claude&name=My%20Provider&endpoint=https%3A%2F%2Fapi.example.com&apiKey=sk-xxx

Import MCP Server

ccswitch://v1/import?resource=mcp&apps=claude,codex&config=eyJtY3BTZXJ2ZXJzIjp7Im1jcC1mZXRjaCI6eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyJtY3Atc2VydmVyLWZldGNoIl19fX0%3D

Here config is the Base64 encoding of {"mcpServers":{"mcp-fetch":{"command":"uvx","args":["mcp-server-fetch"]}}} (the trailing = is escaped as %3D).

Import Prompt Preset

ccswitch://v1/import?resource=prompt&app=claude&name=%E4%BB%A3%E7%A0%81%E5%AE%A1%E6%9F%A5&content=IyDop5LoibIK5L2g5piv5LiA5Liq5LiT5Lia55qE5Luj56CB5a6h5p%2Bl5LiT5a62

Here content is the Base64 encoding of a sample Chinese prompt: a heading meaning "Role", followed by a line telling the model it is a professional code review expert (+ is escaped as %2B).

Import Skill

ccswitch://v1/import?resource=skill&repo=owner/repo&directory=skills/my-skill&branch=main

Manual Generation

  1. Prepare parameters
  2. Assemble the URL following V1 protocol format
  3. URL-encode special characters

Example:

const params = new URLSearchParams({
  resource: 'provider',
  app: 'claude',
  name: 'My Provider',
  endpoint: 'https://api.example.com',
  apiKey: 'sk-xxx'
});

const url = `ccswitch://v1/import?${params.toString()}`;

Online Tool

Using CC Switch's official online deep link generator tool is more convenient.

Click a deep link in a browser or other application:

  1. The system asks whether to open CC Switch
  2. After confirming, CC Switch opens
  3. An import confirmation dialog is displayed
  4. Confirm the import

Import Confirmation

A confirmation dialog is shown before import, containing:

What confirming does depends on the type: a provider appears in the provider list of the matching app, and a toggle in the dialog decides whether to switch to it right away (for OpenCode, OpenClaw, Hermes, and Pi, whether to add it to the app config); an MCP server is written immediately to the configuration files of all specified apps; for a prompt, a toggle in the dialog decides whether to enable it right away, which disables the other prompts in the same app. If the configuration contains suspicious content (addresses pointing to this machine or an internal network, environment variables that can change how a process loads, running an entire command through a shell, usage-query scripts, and so on), the dialog shows a risk warning, so check each item carefully.

Security tip: Only import configurations from trusted sources.

Protocol Registration

Automatic Registration

CC Switch automatically registers the ccswitch:// protocol during installation.

Manual Registration

If the protocol is not registered correctly:

macOS:

Reinstall the app (put CC Switch in the Applications folder and open it at least once).

Windows:

Reinstall the app, or check the registry:

HKEY_CLASSES_ROOT\ccswitch

Linux:

Check the MimeType configuration in the .desktop file.

Security Considerations

Sensitive Information

Deep links may contain sensitive information (e.g., API Keys):

Source Verification

Before import, CC Switch will:

  1. Validate the data format
  2. Display a configuration preview
  3. Require user confirmation

CC Switch checks:

Example: Import Claude Provider

ccswitch://v1/import?resource=provider&app=claude&name=Test%20Provider&apiKey=sk-xxx&endpoint=https%3A%2F%2Fapi.example.com

Example: Import MCP Server

ccswitch://v1/import?resource=mcp&apps=claude,codex,gemini&config=eyJtY3BTZXJ2ZXJzIjp7Im1jcC1mZXRjaCI6eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyJtY3Atc2VydmVyLWZldGNoIl19fX0%3D

Troubleshooting

Check:

  1. Is CC Switch installed
  2. Is the protocol registered correctly
  3. Is the link format correct

Import Failed

Possible causes:

Solutions:

  1. Check the original JSON format
  2. Re-encode in Base64
  3. Ensure all required fields are present