refactor: remove VISION_API_KEY/BASE env overrides, all credentials from client config only
register-skill-release / register (push) Successful in 21s Details

This commit is contained in:
ywkj 2026-04-20 12:21:44 +08:00
parent 9d6a15f010
commit 9f381f9bab
3 changed files with 6 additions and 19 deletions

View File

@ -5,22 +5,11 @@
# 只需在 ~/.openclaw/.env 中配置 CLIENT_KEY # 只需在 ~/.openclaw/.env 中配置 CLIENT_KEY
# CLIENT_KEY=sk_xxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx # CLIENT_KEY=sk_xxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx
# #
# Vision API key、图搜接口等均通过 auth-rt client-config 自动获取, # 所有配置vision API key、接口地址等均通过 auth-rt client-config 自动获取。
# 无需在此手动填写。
# ============================================================================= # =============================================================================
# ----------------------------------------------------------------------------- # 覆盖 Vision 模型(默认来自 client configfallback 为 aliyun-cp-multimodal
# 可选覆盖(通常不需要) # VISION_MODEL=aliyun-cp-multimodal
# -----------------------------------------------------------------------------
# 覆盖 Vision 模型(默认来自 client configfallback 为 gpt-4o-mini
# VISION_MODEL=gpt-4o-mini
# 覆盖 Vision API base URL默认来自 client config metadata.provider.base_url
# VISION_API_BASE=https://your-llm-endpoint/v1
# 覆盖 Vision API key默认来自 client config metadata.provider.api_key
# VISION_API_KEY=sk-...
# 覆盖 auth-rt 二进制路径 # 覆盖 auth-rt 二进制路径
# AUTH_RT_BIN=/custom/path/to/auth-rt # AUTH_RT_BIN=/custom/path/to/auth-rt

View File

@ -85,15 +85,13 @@ The only required configuration is `CLIENT_KEY` in `~/.openclaw/.env`:
CLIENT_KEY=sk_xxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx CLIENT_KEY=sk_xxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxx
``` ```
Everything else — vision API key, image search endpoints — is fetched automatically from the client config via `auth-rt`. No per-skill env vars needed. All credentials and endpoints are fetched automatically from the client config via `auth-rt`. No per-skill env vars needed.
### Optional overrides ### Optional overrides
| Variable | Description | | Variable | Description |
|----------|-------------| |----------|-------------|
| `VISION_MODEL` | Override model name (default: `aliyun-cp-multimodal`) | | `VISION_MODEL` | Override model name (default: `aliyun-cp-multimodal`) |
| `VISION_API_BASE` | Override vision API base URL |
| `VISION_API_KEY` | Override vision API key |
| `AUTH_RT_BIN` | Override path to the `auth-rt` binary | | `AUTH_RT_BIN` | Override path to the `auth-rt` binary |
| `TELEMETRY_ENDPOINT` | POST execution results to a telemetry endpoint | | `TELEMETRY_ENDPOINT` | POST execution results to a telemetry endpoint |

View File

@ -16,11 +16,11 @@ export interface VisionConfig {
async function loadVisionConfig(client: ReturnType<typeof createSkillClient>): Promise<VisionConfig> { async function loadVisionConfig(client: ReturnType<typeof createSkillClient>): Promise<VisionConfig> {
const cfg = await client.clientConfig(); const cfg = await client.clientConfig();
const apiKey = cfg.metadata?.provider?.api_key ?? process.env.VISION_API_KEY; const apiKey = cfg.metadata?.provider?.api_key;
if (!apiKey) throw new Error('Vision API key not found in client config (metadata.provider.api_key)'); if (!apiKey) throw new Error('Vision API key not found in client config (metadata.provider.api_key)');
return { return {
apiKey, apiKey,
baseURL: cfg.metadata?.provider?.base_url ?? process.env.VISION_API_BASE, baseURL: cfg.metadata?.provider?.base_url,
model: process.env.VISION_MODEL ?? cfg.metadata?.provider?.model ?? 'aliyun-cp-multimodal', model: process.env.VISION_MODEL ?? cfg.metadata?.provider?.model ?? 'aliyun-cp-multimodal',
}; };
} }