diff --git a/USAGE.md b/USAGE.md index cc15da2a..18a97586 100644 --- a/USAGE.md +++ b/USAGE.md @@ -225,6 +225,7 @@ export ANTHROPIC_AUTH_TOKEN="anthropic-oauth-or-proxy-bearer-token" | `sk-ant-*` API key | `ANTHROPIC_API_KEY` | `x-api-key: sk-ant-...` | [console.anthropic.com](https://console.anthropic.com) | | OAuth access token (opaque) | `ANTHROPIC_AUTH_TOKEN` | `Authorization: Bearer ...` | an Anthropic-compatible proxy or OAuth flow that mints bearer tokens | | OpenRouter key (`sk-or-v1-*`) | `OPENAI_API_KEY` + `OPENAI_BASE_URL=https://openrouter.ai/api/v1` | `Authorization: Bearer ...` | [openrouter.ai/keys](https://openrouter.ai/keys) | +| Ollama local instance | `OLLAMA_HOST` | no auth header (Ollama requires none) | local Ollama server at `http://127.0.0.1:11434` | **Why this matters:** if you paste an `sk-ant-*` key into `ANTHROPIC_AUTH_TOKEN`, Anthropic's API will return `401 Invalid bearer token` because `sk-ant-*` keys are rejected over the Bearer header. The fix is a one-line env var swap — move the key to `ANTHROPIC_API_KEY`. Recent `claw` builds detect this exact shape (401 + `sk-ant-*` in the Bearer slot) and append a hint to the error message pointing at the fix. diff --git a/docs/local-openai-compatible-providers.md b/docs/local-openai-compatible-providers.md index a0b22a52..189ea7f7 100644 --- a/docs/local-openai-compatible-providers.md +++ b/docs/local-openai-compatible-providers.md @@ -56,6 +56,13 @@ ollama serve In another shell: +```bash +export OLLAMA_HOST="http://127.0.0.1:11434" +claw --model "qwen2.5-coder:7b" prompt "say hello" +``` + +`OLLAMA_HOST` is now the preferred env var for Ollama. The older `OPENAI_BASE_URL` + `OPENAI_API_KEY` workaround is also supported for existing setups that already rely on the OpenAI-compatible path. + ```bash export OPENAI_BASE_URL="http://127.0.0.1:11434/v1" export OPENAI_API_KEY="local-dev-token"