# Hermes OpenCode Provider Diagnostics (Go + Zen)

Diagnostic trace for when `opencode-go` or `opencode-zen` doesn't appear in the Hermes `/model` picker.

## Symptom

Provider configured in `config.yaml` but **no models shown** in `/model` picker. Provider entry entirely absent from the OpenCode group.

## Root Cause

The `/model` picker calls `list_authenticated_providers()` (in `hermes_cli/model_switch.py`) which **only includes providers that have API keys set**. Without the `OPENCODE_*_API_KEY` in `~/.hermes/.env`:

```python
get_api_key_provider_status("opencode-go")
# Returns: {"configured": False}
```

Key is empty → `configured: False` → provider filtered out from the picker display.

## Code Trace

```
list_authenticated_providers()                # hermes_cli/model_switch.py:1202
  └─ get_api_key_provider_status()            # hermes_cli/auth.py:5843
       └─ _resolve_api_key_provider_secret()  # checks OPENCODE_GO_API_KEY or OPENCODE_ZEN_API_KEY
            └─ env var missing → api_key="" → {"configured": False}
```

Even though the model catalog endpoints work without auth:
```bash
curl -s https://opencode.ai/zen/go/v1/models   # 19 Go models, no auth needed
curl -s https://opencode.ai/zen/v1/models      # 48 Zen models, no auth needed
```

...the picker still gates on the env var.

## Fix

Add to `~/.hermes/.env`:

```bash
OPENCODE_GO_API_KEY=sk-......y...
# OPENCODE_ZEN_API_KEY=sk-......            # Only needed for paid Zen models; free-tier works without
```

## Verification

```bash
grep OPENCODE_API_KEY ~/.hermes/.env
hermes doctor | grep opencode
```

On next `/model` picker open (or after `/reset`), both providers appear under the **OpenCode** group.

## Config.yaml model definitions

Both providers benefit from having a `models:` section in `config.yaml`:

```yaml
providers:
  opencode-go:
    api_key_env: OPENCODE_GO_API_KEY
    base_url: https://opencode.ai/zen/go/v1
    models:
      minimax-m3:
        max_input_tokens: 131072
        max_output_tokens: 65536
      # ... 19 models total
  opencode-zen:
    api_key_env: OPENCODE_ZEN_API_KEY
    base_url: https://opencode.ai/zen/v1
    models:
      claude-sonnet-4-6:
        max_input_tokens: 200000
        max_output_tokens: 16384
      # ... 48 models total
```

Without explicit model definitions, Hermes falls back to the in-repo `_PROVIDER_MODELS` hardcoded list (13 Go models). For the full 19 Go / 48 Zen catalogs, fetch live:

```bash
curl -s https://opencode.ai/zen/go/v1/models | python3 -c "import sys,json; [print(m['id']) for m in json.load(sys.stdin)['data']]"
curl -s https://opencode.ai/zen/v1/models | python3 -c "import sys,json; [print(m['id']) for m in json.load(sys.stdin)['data']]"
```

## Curated Models (hardcoded in `_PROVIDER_MODELS`)

### opencode-go (`hermes_cli/models.py:406`)
```
kimi-k2.6, kimi-k2.5, glm-5.1, glm-5, mimo-v2.5-pro, mimo-v2.5,
mimo-v2-pro, mimo-v2-omni, minimax-m2.7, minimax-m2.5,
qwen3.7-max, qwen3.6-plus, qwen3.5-plus
```

### opencode-zen
No hardcoded curated list — Zen models come entirely from the live API or config.

## Live Model Catalogs

### opencode-go — 19 models
```
minimax-m3      → 128K/64K
minimax-m2.7    → 128K/64K
minimax-m2.5    → 128K/64K
kimi-k2.7-code  → 128K/64K
kimi-k2.6       → 128K/64K
kimi-k2.5       → 128K/64K
glm-5.1         → 128K/64K
glm-5           → 128K/64K
deepseek-v4-pro → 64K/8K
deepseek-v4-flash → 1M/16K
qwen3.7-max     → 128K/64K
qwen3.7-plus    → 128K/64K
qwen3.6-plus    → 128K/64K
qwen3.5-plus    → 128K/64K
mimo-v2-pro     → 128K/64K
mimo-v2-omni    → 128K/64K
mimo-v2.5-pro   → 128K/128K
mimo-v2.5       → 128K/64K
hy3-preview     → 128K/64K
```

### opencode-zen — 48 models
**Claude 4.x** (200K ctx): fable-5, opus-4-8/7/6/5/1, sonnet-4-6/5/4, haiku-4-5

**Gemini 3.x** (1M ctx): 3.5-flash, 3.1-pro, 3-flash

**GPT-5.x** (128K ctx): 5.5/pro, 5.4/pro/mini/nano, 5.3-codex/spark, 5.2/codex, 5.1-codex-max/codex/codex-mini, 5/codex/nano

**Grok**: grok-build-0.1 (128K)

**Open source on Zen**: deepseek-v4-pro/flash, glm-5.1/5, minimax-m2.7/2.5, kimi-k2.6/2.5, qwen3.6-plus/3.5-plus

**Free-tier** (no key needed): big-pickle, deepseek-v4-flash-free, mimo-v2.5-free, qwen3.6-plus-free, minimax-m3-free, nemotron-3-ultra-free, north-mini-code-free
