fix(hub): Claude Code SDK 经 OpenRouter Anthropic Skin,保留 provider-agnostic

我之前判断错了——OpenRouter 有 Anthropic Messages API 兼容端点
(https://openrouter.ai/api),Claude Code SDK 直连不需要代理。
ANTHROPIC_AUTH_TOKEN=OpenRouter key,ANTHROPIC_API_KEY='' 即可。

而且 ANTHROPIC_DEFAULT_SONNET_MODEL 可设 OpenRouter model ID
(z-ai/glm-4.7 等),所以 provider-agnostic 没丢。

ADR-0017 重写:从'Anthropic 专有'改为'Claude Code SDK via OpenRouter,
保留 provider-agnostic'。tsc rc=0。
This commit is contained in:
2026-07-08 01:46:09 +08:00
parent 082562ca08
commit b9f50407be
3 changed files with 55 additions and 40 deletions
+15 -12
View File
@@ -1,28 +1,31 @@
# Hub runtime configuration. Copy to .env and fill in.
#
# For local dev: `cp .env.example .env` then edit.
# For tests: integration tests read from .env via dotenv.
# PostgreSQL connection string.
DATABASE_URL="postgresql://paradigm:paradigm@127.0.0.1:5432/paradigm"
# OpenRouter (or any OpenAI-compatible) API key.
# OpenRouter API key — used as ANTHROPIC_AUTH_TOKEN for Claude Code SDK.
# OpenRouter's "Anthropic Skin" (https://openrouter.ai/api) is Anthropic-API
# compatible, so Claude Code SDK speaks its native protocol directly.
# Get one at https://openrouter.ai/keys
# The agent layer is provider-agnostic (ADR-0017); OpenRouter routes to any model.
OPENROUTER_API_KEY=""
# Optional: override the base URL (e.g. direct vendor API, local gateway).
# OPENROUTER_BASE_URL="https://openrouter.ai/api/v1"
# Claude Code SDK auth — derived from OpenRouter. Do NOT set ANTHROPIC_API_KEY
# to a real value; it must be explicitly empty to avoid auth conflicts.
ANTHROPIC_BASE_URL="https://openrouter.ai/api"
ANTHROPIC_AUTH_TOKEN="" # Set to same value as OPENROUTER_API_KEY
ANTHROPIC_API_KEY=""
# Feishu (lark) bot credentials. Create a self-built app at
# https://open.feishu.cn/app, add the "Bot" capability, subscribe to
# im.message.receive_v1, then fill these in.
# Model override (optional). Defaults to Claude Sonnet. To use GLM:
# ANTHROPIC_DEFAULT_SONNET_MODEL="z-ai/glm-4.7"
# ANTHROPIC_DEFAULT_OPUS_MODEL="z-ai/glm-4.7"
# ANTHROPIC_DEFAULT_HAIKU_MODEL="z-ai/glm-4.6"
# Feishu (lark) bot credentials.
FEISHU_APP_ID=""
FEISHU_APP_SECRET=""
FEISHU_BOT_OPEN_ID=""
# Path to the `cph` binary (the Courseware-side checker, ADR-0016).
# Defaults to `cph` on PATH if unset.
# Path to the `cph` binary (ADR-0016). Defaults to `cph` on PATH.
# CPH_BIN="/usr/local/bin/cph"
# Hub server port. Defaults to 8788.