{"id":51079068,"url":"https://github.com/maxgfr/claude-code-switch","last_synced_at":"2026-06-23T16:33:11.549Z","repository":{"id":348884172,"uuid":"1199967271","full_name":"maxgfr/claude-code-switch","owner":"maxgfr","description":"Minimal, zero-dependency provider switching for Claude Code — switch between Anthropic, OpenRouter, DeepSeek, Z.AI, Kimi, Qwen, MiniMax and custom endpoints","archived":false,"fork":false,"pushed_at":"2026-04-03T12:50:02.000Z","size":49,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T14:09:12.917Z","etag":null,"topics":["ai","anthropic","claude","claude-code","cli","deepseek","glm","homebrew","kimi","llm","minimax","model-switching","openrouter","posix","provider","qwen","shell","zai"],"latest_commit_sha":null,"homepage":"https://github.com/maxgfr/claude-code-switch","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxgfr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-02T22:34:20.000Z","updated_at":"2026-04-03T12:50:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/maxgfr/claude-code-switch","commit_stats":null,"previous_names":["maxgfr/claude-code-switch"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/maxgfr/claude-code-switch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgfr%2Fclaude-code-switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgfr%2Fclaude-code-switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgfr%2Fclaude-code-switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgfr%2Fclaude-code-switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxgfr","download_url":"https://codeload.github.com/maxgfr/claude-code-switch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgfr%2Fclaude-code-switch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34698697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","anthropic","claude","claude-code","cli","deepseek","glm","homebrew","kimi","llm","minimax","model-switching","openrouter","posix","provider","qwen","shell","zai"],"created_at":"2026-06-23T16:33:11.067Z","updated_at":"2026-06-23T16:33:11.541Z","avatar_url":"https://github.com/maxgfr.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# claude-code-switch\n\nMinimal, zero-dependency provider switching for [Claude Code](https://docs.anthropic.com/en/docs/claude-code). One shell script to rule them all.\n\nSwitch between AI providers (Anthropic, OpenRouter, DeepSeek, Z.AI, Kimi, Qwen, MiniMax, Doubao, or any custom endpoint) with a single command. **`claude` always works as-is** — `ccs` is a sidecar that only injects env vars when you explicitly run `ccs`.\n\nInspired by [foreveryh/claude-code-switch](https://github.com/foreveryh/claude-code-switch), stripped down to the essentials: **switch provider, set model, launch claude**.\n\n## Features\n\n- **9 built-in providers**: Anthropic, OpenRouter, DeepSeek, Z.AI, Kimi, Qwen, MiniMax, Doubao, Custom\n- **Default model**: configurable globally and per provider\n- **Zero dependencies**: pure POSIX sh — no jq, no python, no node\n- **Zero interference**: `claude` always works normally — `ccs` never touches your shell or Claude config\n- **Direct launch**: `ccs` starts Claude Code with the right env vars (scoped to that process)\n- **Shell integration** (optional): `eval \"$(ccs env)\"` exports vars to your current session\n- **API key validation**: clear errors when a provider is not configured\n- **Masked secrets**: `ccs status` never leaks your full API key\n\n## Installation\n\n### Homebrew (recommended)\n\n```sh\nbrew install maxgfr/tap/claude-code-switch\n```\n\n### Manual\n\n```sh\n# Download the script\ncurl -fsSL https://raw.githubusercontent.com/maxgfr/claude-code-switch/main/ccs -o /usr/local/bin/ccs\nchmod +x /usr/local/bin/ccs\n\n# First run creates ~/.claude-provider/config — add your API keys\nccs config\n```\n\n## Quick start\n\n```sh\n# 1. Add your API keys\nccs config\n\n# 2. Switch to a provider\nccs use openrouter\n\n# 3. Launch Claude Code\nccs\n```\n\n## Usage\n\n```\nccs [args...]               Launch claude with active provider (default)\nccs \u003ccommand\u003e [arguments]\n\nCOMMANDS\n    use \u003cprovider\u003e [model]      Switch to a provider (saves as default)\n    list                        List configured providers\n    status                      Show active provider and model\n    config                      Open config file in $EDITOR\n    launch [args...]            Launch claude with active provider env vars\n    env                         Print export statements for current shell\n    reset                       Clear active provider (back to vanilla claude)\n    purge                       Remove all ccs data (~/.claude-provider/)\n    help                        Show help\n    version                     Show version\n```\n\n### Examples\n\n```sh\n# Switch provider\nccs use anthropic                     # Use default model (claude-sonnet-4-6)\nccs use anthropic claude-opus-4-6     # Override model\nccs use openrouter openai/gpt-4o     # OpenRouter with specific model\nccs use deepseek deepseek-reasoner   # DeepSeek R1\nccs use zai glm-5.1                  # Z.AI GLM-5.1\nccs use kimi                         # Kimi K2.5\nccs use qwen                         # Qwen 3.5 Plus\nccs use minimax                      # MiniMax M2.7\nccs use doubao                       # Doubao Seed Code (ByteDance)\n\n# Check state\nccs list                              # See all providers and their status\nccs status                            # See active provider, model, masked API key\n\n# Launch Claude Code\nccs                                   # Launch with active provider\nccs --print \"hello world\"             # Pass flags through to claude\n\n# Export to current shell\neval \"$(ccs env)\"                     # Export env vars to current session\n```\n\n## Providers\n\nAll providers expose an Anthropic-compatible Messages API endpoint, confirmed working with Claude Code.\n\n| Provider     | Base URL                                                  | Default Model                    |\n|--------------|-----------------------------------------------------------|----------------------------------|\n| `anthropic`  | *(native — no override)*                                  | `claude-sonnet-4-6`              |\n| `openrouter` | `https://openrouter.ai/api`                               | `anthropic/claude-sonnet-4`      |\n| `deepseek`   | `https://api.deepseek.com/anthropic`                      | `deepseek-chat`                  |\n| `zai`        | `https://api.z.ai/api/anthropic`                          | `glm-5.1`                        |\n| `kimi`       | `https://api.moonshot.ai/anthropic`                       | `kimi-k2.5`                      |\n| `qwen`       | `https://dashscope-intl.aliyuncs.com/apps/anthropic`      | `qwen3.5-plus`                   |\n| `minimax`    | `https://api.minimax.io/anthropic`                        | `MiniMax-M2.7`                   |\n| `doubao`     | `https://ark.cn-beijing.volces.com/api/coding`            | `doubao-seed-code-preview-latest`|\n| `custom`     | *(user-defined)*                                          | *(user-defined)*                 |\n\n### Z.AI Coding Plan\n\n[Z.AI](https://z.ai) offers a **Coding Plan** optimized for AI-powered coding tools like Claude Code:\n\n- **Models**: GLM-5.1, GLM-5, GLM-4.7, GLM-4.6\n- **Plans**: Coding Lite ($6/mo), Standard ($10/mo), Pro ($30/mo)\n- **Get your API key**: [z.ai/manage-apikey](https://z.ai/manage-apikey/apikey-list)\n\n```sh\nccs use zai glm-5.1\nccs\n```\n\n### Doubao (ByteDance/Volcengine)\n\n[Doubao](https://www.volcengine.com/product/doubao) is ByteDance's AI platform with coding-optimized models:\n\n- **Models**: `doubao-seed-code-preview-latest` (256K context)\n- **Free tier**: 50M tokens/day for new users\n- **Get your API key**: [Volcengine ARK Console](https://console.volcengine.com/ark)\n\n```sh\nccs use doubao\nccs\n```\n\n## Configuration\n\nLocated at `~/.claude-provider/config`. Simple INI format, editable by hand:\n\n```ini\n[_defaults]\nprovider=anthropic\nmodel=claude-sonnet-4-6\n\n[anthropic]\nbase_url=\napi_key=sk-ant-your-key-here\nmodel=claude-sonnet-4-6\n\n[openrouter]\nbase_url=https://openrouter.ai/api\napi_key=sk-or-v1-your-key-here\nmodel=anthropic/claude-sonnet-4\n\n[zai]\nbase_url=https://api.z.ai/api/anthropic\napi_key=your-zai-key-here\nmodel=glm-5.1\nopus_model=glm-5.1\nhaiku_model=glm-4.7\n```\n\n- **`[_defaults]`** — global default provider and model\n- **`api_key=`** — empty means not configured\n- **`base_url=`** — empty for `[anthropic]` uses native Anthropic API (no `ANTHROPIC_BASE_URL`)\n- **`model=`** — main model (maps to sonnet/default tier in `/models`)\n- **`opus_model=`** — optional, for `/models` opus tier (falls back to `model`)\n- **`haiku_model=`** — optional, for `/models` haiku tier + fast tasks (falls back to `model`)\n\n## Shell integration\n\nAdd to `~/.zshrc` or `~/.bashrc` so `ccs use` automatically exports env vars to your current shell:\n\n```sh\nccs() {\n    if [ \"${1:-}\" = \"use\" ]; then\n        command ccs \"$@\" \u0026\u0026 eval \"$(command ccs env)\"\n    else\n        command ccs \"$@\"\n    fi\n}\n```\n\n## How it works\n\n`ccs` runs `exec env ... claude` — the env vars only exist in that child process. Your shell and `claude` are never affected.\n\n```\nclaude          → normal Claude Code, no ccs involvement\nccs             → Claude Code with provider env vars (scoped to that process)\n```\n\n| Variable                      | When                                                 |\n|-------------------------------|------------------------------------------------------|\n| `ANTHROPIC_BASE_URL`            | Third-party providers only (unset for native)      |\n| `ANTHROPIC_AUTH_TOKEN`          | Third-party providers only (avoids API key prompt) |\n| `ANTHROPIC_API_KEY`             | Native Anthropic only                              |\n| `ANTHROPIC_MODEL`               | Always                                             |\n| `ANTHROPIC_DEFAULT_OPUS_MODEL`  | Third-party — maps to `opus_model` in config       |\n| `ANTHROPIC_DEFAULT_SONNET_MODEL`| Third-party — maps to `model` in config            |\n| `ANTHROPIC_DEFAULT_HAIKU_MODEL` | Third-party — maps to `haiku_model` in config      |\n| `CLAUDE_CODE_SUBAGENT_MODEL`    | Third-party — uses `model`                         |\n| `ANTHROPIC_SMALL_FAST_MODEL`    | Third-party — uses `haiku_model`                   |\n\nState is persisted in `~/.claude-provider/active` so `ccs` works across shell sessions. Run `ccs reset` to clear it, or `ccs purge` to remove all ccs data.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxgfr%2Fclaude-code-switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxgfr%2Fclaude-code-switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxgfr%2Fclaude-code-switch/lists"}