Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add JarlZhang/claude-presets --skill switch-apigit clone --depth 1 https://github.com/JarlZhang/claude-presetsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/jarlzhang/claude-presets/switch-api)<a href="https://agentmods.dev/skills/jarlzhang/claude-presets/switch-api"><img src="https://agentmods.dev/badge/skills/jarlzhang/claude-presets/switch-api.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00234 | $0.01639 |
| Opus 5 | $0.00117 | $0.00820 |
| Sonnet 5 | $0.00047 | $0.00328 |
| Haiku 4.5 | $0.00023 | $0.00164 |
Grade A, and why
switch-api scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.
切换 API 预设
把预先存好的 API 预设套用到当前项目,让 Claude Code 在这个项目里调用指定的第三方 Anthropic 兼容后端(如公司 cc-api、qwen、deepseek、各类 gpt 转换代理)。
工作原理(先读,避免误导用户)
Claude Code 的 env(含 ANTHROPIC_BASE_URL、ANTHROPIC_AUTH_TOKEN、模型名)是在进程启动那一刻读取的。本技能修改 settings.local.json 后,当前正在运行的会话不会热切换——用户必须退出并重启 claude 才会生效。所以本技能的职责是「写好配置 + 校验连通 + 提醒重启」,不是实时切换。每次套用后都要明确提醒这一点。
预设存放在 ~/.claude/api-presets/,每个是一个 JSON:env 块(必需,要写入项目的键值)+ desc 字段(可选,中文描述,用于列表展示)。写入目标固定为项目的 .claude/settings.local.json(该文件默认被 gitignore,适合放 key)。
新增预设时建议补上 desc(如「apikey.fun 中转·lite 通道」),否则列表里只能看到模型名和地址,相似预设难以区分。
另外:PowerShell 7 里装有 setapi 命令(定义在 pwsh 的 $PROFILE),是脚本 --preset/--reset/--list-json 的薄封装;用户在终端手动切换走的就是它,改脚本行为时两边会同时生效。
使用场景
本技能支持两个方向:
- API → API:从一个第三方 API 切到另一个(如 deepseek → qwen)
- API → 订阅账号:清除所有 API 配置,回退到用户自己的 Claude 订阅
步骤
所有确定性操作都由 scripts/switch_api.py 完成,按下面顺序调用。
切换到 API 预设
1. 列出可用预设
python <skill-dir>/scripts/switch_api.py --list
把列表展示给用户,让其确认要切到哪个。如果用户已经在话里点名了(如「换成 deepseek」),就直接对应到预设名,不必再问。
2. 确认目标项目目录
默认是当前工作目录。如果用户在别的项目里执行、或明确指定了路径,用 --project-dir <路径> 传入。新项目(没有 .claude)也没关系,脚本会自动创建。
3. 套用预设并校验
python <skill-dir>/scripts/switch_api.py --preset <名字> --project-dir <项目路径>
脚本会:
- 读出项目现有的
settings.local.json(不存在则新建),只动env块,保留permissions、mcp、hooks等项目个性化配置; - 清除上一个预设残留的 API 键(如从 deepseek 切到 qwen 时遗留的
CLAUDE_CODE_EFFORT_LEVEL),再写入新预设的 env; - 发一个最小请求校验新 API 的连通性与鉴权。
本地代理预设例外:若预设的 ANTHROPIC_BASE_URL 指向 127.0.0.1/localhost(如 gemini、grok 这类走本地代理的预设),脚本会先 TCP 探测端口,代理不在线就直接退出、不写配置,并提示先启动代理。此时应把"请先启动本地代理"明确转达给用户,不要把配置写进去。
4. 转达结果并提醒重启
把脚本输出的校验结果如实转达给用户,并据此说明:
[ok]:连通正常,告诉用户退出重启claude即可用新 API。[warn]:地址可达、鉴权大概率没问题,但测试用的模型名可能不被该代理支持(常见于没指定模型名的 gpt 代理)。提示用户:要么该代理能自动映射默认 Claude 模型名(那其实能用),要么需要在预设里补ANTHROPIC_DEFAULT_*_MODEL。[error]:地址连不上或鉴权失败,配置虽已写入但用前需先修。把具体错误转达清楚。
无论哪种结果,最后都要重复一句:env 在启动时读取,必须退出并重新启动 claude 才生效。
切回订阅账号
当用户说「切回订阅账号」「不用 API 了」「改用我自己的账号」「reset api」「清除 api 配置」时,使用此流程。
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 7d ago First seen · 100 lines · 234 tokens per session scan A 2aec847c1cbf
switch-api is a skill published in the GitHub repository JarlZhang/claude-presets (2 stars, last pushed 1mo ago), licensed MIT. It adds 234 tokens to every session and 1,639 once invoked, about $0.0012 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
golang
Go coding standards and conventions for this project. Apply when writing, reviewing, or refactoring any Go source file.
ast-grep
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for…
powershell
PowerShell cmdlet conventions for this project. Apply when writing or reviewing any .ps1 or module file.
analyzing-powershell-script-block-logging
Parse Windows PowerShell Script Block Logs (Event ID 4104) from EVTX files to detect obfuscated commands, encoded payloads, and living-off-the-land techniques. Uses python-evtx to extract and reconstruct multi-block scripts, applies entropy analysis and pattern matching for Base64-encoded commands, Invoke-Expression…
conventional-commit
Workflow for generating conventional commit messages following the Conventional Commits specification. MUST be invoked every time a commit is created. Guides construction of standardized commit messages with correct type, scope, description, body, and footer.
segment-create
Full scaffolding workflow for creating a new Oh My Posh segment. Invoke when asked to add a new segment: generates the Go source, registers the type, creates documentation, updates the sidebar and JSON schema.