## 诊断报告：mycodex 模型不显示的原因

### 问题分析

根据代码追踪，`models.list` 接口在返回模型列表时，会通过 `hasRuntimeAvailableProviderAuth()` 检查每个 provider 是否有可用的认证信息。

对于自定义 provider（如 mycodex），检查流程为：

1. `resolveEnvApiKey()` - 检查环境变量中的 API Key
2. `resolveUsableCustomProviderApiKey()` - 检查配置文件中的 apiKey
3. `resolveManagedSecretRefRuntimeProviderAuth()` - 检查托管的 SecretRef
4. 其他来源...

### 关键发现

`resolveUsableCustomProviderApiKey()` 函数的逻辑：

```javascript
function resolveUsableCustomProviderApiKey(params) {
  const customProviderConfig = resolveProviderConfig(params.cfg, params.provider);
  const apiKeyRef = coerceSecretRef(customProviderConfig?.apiKey);
  
  if (apiKeyRef) {
    // 如果是 SecretRef，只处理 env 类型
    if (apiKeyRef.source !== "env") return null;
    // ... 从环境变量读取
  }
  
  // 否则，作为普通字符串处理
  const customKey = getCustomProviderApiKey(params.cfg, params.provider);
  if (!customKey) return null;
  if (!isNonSecretApiKeyMarker(customKey)) return {
    apiKey: customKey,
    source: "models.json"
  };
  // ...
}
```

### 可能的原因

**mycodex 配置中的 apiKey 可能是以下几种情况之一：**

1. **SecretRef 格式但不是 env 类型** - 被 `if (apiKeyRef.source !== "env") return null;` 拒绝
2. **值为 null 或空** - 被 `if (!customKey) return null;` 拒绝
3. **特殊标记（如 `__OPENCLAW_REDACTED__`）** - 可能被 `isNonSecretApiKeyMarker()` 识别为占位符

### 验证方法

检查实际配置文件中 mycodex.apiKey 的原始值（不是脱敏后的值）：

```bash
# 查看完整配置（包含敏感信息）
openclaw config get models.providers.mycodex.apiKey
```

或者直接查看配置文件：`~/.openclaw/config.json` 中 `models.providers.mycodex.apiKey` 字段

### 预期正常的 apiKey 格式

```json
{
  "mycodex": {
    "apiKey": "sk-actual-key-value",  // 直接字符串
    // 或
    "apiKey": {
      "source": "env",
      "id": "MYCODEX_API_KEY"  // 环境变量名
    }
  }
}
```

### 下一步

需要检查 mycodex 的 apiKey 配置是否符合 OpenClaw 的认证检查逻辑。
