spediacn

spediacn

V2EX member #325771, joined on 2018-06-30 00:43:28 +08:00
Per spediacn's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
spediacn's recent replies
各个模型计费系数不同,不同就不同吧也没啥意见,但官方不公布系数,问了只说这是商业秘密。自己粗算了算,GLM-5.2 大约是 9x
包括 lts 下的 windows/linux
核心问题是:各个平台授权各算各的还是一个平台获得授权,全栈可用?
linux 和 windows 也支持我就愿意下手了
我是这么做的:
配置:~/.config/env.d/文件夹,在里头放入:
claude.sh
codex.sh
antigraivity.sh


claude.sh 里也是和楼上一样的思路,通过 shell 函数实现。多个 Coding Plan ,就每一份写一个。如我同时有 Claude Pro 订阅和 MiniMax 、智谱订阅,可以这么写:

```
#!/bin/bash
# Claude CLI Configuration Manager

# The proxy address is defined here once and used globally.
export GLOBAL_PROXY_URL="http://127.0.0.1:65210"

# Wrap a command with proxy environment variables
with_proxy() {
env \
http_proxy="$GLOBAL_PROXY_URL" \
https_proxy="$GLOBAL_PROXY_URL" \
HTTP_PROXY="$GLOBAL_PROXY_URL" \
HTTPS_PROXY="$GLOBAL_PROXY_URL" \
ALL_PROXY="$GLOBAL_PROXY_URL" \
all_proxy="$GLOBAL_PROXY_URL" \
"$@"
}

# Wrap a command without proxy environment variables
without_proxy() {
env \
-u http_proxy \
-u https_proxy \
-u HTTP_PROXY \
-u HTTPS_PROXY \
-u ALL_PROXY \
-u all_proxy \
"$@"
}


if command -v claude &>/dev/null; then

# Core runner to ensure environment isolation
# Usage: _run_claude_cli <config_dir> [VAR=VAL ...]
_run_claude_cli() {
local config_dir="$1"
shift
(
# Clear existing Anthropic variables to ensure no leakage from the host shell
unset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL \
ANTHROPIC_MODEL ANTHROPIC_DEFAULT_OPUS_MODEL \
ANTHROPIC_DEFAULT_SONNET_MODEL ANTHROPIC_DEFAULT_HAIKU_MODEL

# Set the configuration directory
export CLAUDE_CONFIG_DIR="$config_dir"

# Default settings for API-based usage
if [[ "$config_dir" != "$HOME/.claude" ]]; then
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
export DISABLE_TELEMETRY="true"
export ANTHROPIC_DISABLE_TELEMETRY="true"
fi

# Apply specific environment variables passed as arguments before the command
while [[ "$1" == *"="* ]]; do
export "$1"
shift
done

# Execute claude with proxy
with_proxy claude "$@"
)
}

# --- Claude Pro (Direct Subscription) ---
# Uses ~/.claude/
claude-pro() {
_run_claude_cli "$HOME/.claude" "$@"
}

# --- Third-party Provider Configurations (using dedicated directories) ---

# MiniMax
claude-minimax() {
_run_claude_cli "$HOME/.claude-minimax" \
ANTHROPIC_BASE_URL="https://api.minimaxi.com/anthropic" \
ANTHROPIC_AUTH_TOKEN="MiniMax API KEY" \
ANTHROPIC_MODEL="MiniMax-M3" \
ANTHROPIC_DEFAULT_OPUS_MODEL="MiniMax-M3" \
ANTHROPIC_DEFAULT_SONNET_MODEL="MiniMax-M3" \
ANTHROPIC_DEFAULT_HAIKU_MODEL="MiniMax-M2.7" \
"$@"
}

# 智谱 AI (Zhipu)
claude-zhipu() {
_run_claude_cli "$HOME/.claude-zhipu" \
ANTHROPIC_BASE_URL="https://open.bigmodel.cn/api/anthropic" \
ANTHROPIC_AUTH_TOKEN="Zhipu API KEY" \
ANTHROPIC_MODEL="glm-5.2" \
ANTHROPIC_DEFAULT_OPUS_MODEL="glm-5.2" \
ANTHROPIC_DEFAULT_SONNET_MODEL="glm-5.1" \
ANTHROPIC_DEFAULT_HAIKU_MODEL="glm-4.7" \
"$@"
}

fi
```
为了保证 Claude-Pro ,Claude (智谱),Claude ( MiniMax )各自会话隔离,我建立了
.claude-zhipu
.claude-minimax
这几个文件夹。


使用时很简单,执行 claude-zhipu, claude-pro/claude, claude-minimax 就行了。如果需要走代理,就修改这里:
"$@"
改为:
with_proxy claude "$@"
这套思路我也用了,没写代码,拿来写政策文件,研究上位法、技术可行性、经费、规范什么的真的好使
这是个大工程啊,望楼主能坚持住
Jun 21
Replied to a topic by qwertooo 信息安全 哪吒监控严重漏洞 CVE-2026-53519
哪吒居然也有 CVE 前缀了
Jun 15
Replied to a topic by aidevs 随想 对待不熟悉的人尽量不要帮忙
内容不完整,主观意识太多,无从判断
Jun 15
Replied to a topic by spediacn 分享创造 我发现这个频道很有意思
@coderfee 肯定会有看不下去的,但不影响看其他的
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5519 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 18ms · UTC 06:00 · PVG 14:00 · LAX 23:00 · JFK 02:00
♥ Do have faith in what you're doing.