# Ollama "Provider Authentication Error" Fix

## Symptom

After configuring a local provider (Ollama, vLLM, etc.), the agent reports "Provider authentication failed" on the next request. Gateway logs show: `Unknown provider 'custom:<name>'`.

## Root Cause

**Wrong provider name.** The Hermes custom endpoint provider is registered as **`custom`** (bare), not `custom:ollama`, `custom:vllm`, or any `custom:<name>` variant. The suffix format is not recognized — `custom:ollama` and `openai` are both rejected as unknown providers.

Secondary cause: `hermes config set` for `model.*` keys can silently fail to persist (reports "✓ Set" but file shows old values). Always verify with `grep -A5 '^model:' ~/.hermes/config.yaml`.

## Fix

1. Set the provider to `custom` (no suffix):
   ```bash
   hermes config set model.provider custom
   hermes config set model.base_url http://localhost:11434/v1
   hermes config set model.api_key ollama
   hermes config set model.default qwen2.5:14b
   ```

2. **Verify the file**:
   ```bash
   grep -A6 '^model:' ~/.hermes/config.yaml
   ```
   Must show `provider: custom`.

3. Test the Ollama API directly:
   ```bash
   curl -s http://localhost:11434/v1/chat/completions -H "Content-Type: application/json" \
     -d '{"model":"qwen2.5:14b","messages":[{"role":"user","content":"hi"}],"stream":false}'
   ```

4. Restart gateway (from OUTSIDE the gateway process — cannot restart from within):
   ```bash
   hermes gateway restart
   ```

## Notes

- The provider `custom` is a reserved Hermes provider that reads `model.base_url` and `model.api_key` directly. It uses `transport="openai_chat"` (OpenAI-compatible API).
- If you set `custom` and still get the error, check with `grep` — the `config set` may have silently failed. Re-run the commands.
- Gateway restart must be done from a separate shell (SSH, desktop terminal) — not from within a gateway session.
