When using OpenAI-compatible providers/proxies, treat authentication and endpoint routing as separate concerns:
OPENAI_API_KEY). If the key is missing/unloaded, requests may be sent with no auth and you’ll typically see 401 (e.g., No api key passed in).OPENAI_HOST as the proxy root without a trailing path, and OPENAI_BASE_PATH as the served route such as v1/chat/completions). If the path is wrong, you’ll typically see 404 for the expected operation/route.Example (proxy via OpenAI-compatible settings):
# Proxy root only (no trailing path)
export OPENAI_HOST="https://your-proxy.example.com"
# Path the proxy serves (ensure it matches, e.g., v1/chat/completions)
export OPENAI_BASE_PATH="/v1/chat/completions"
# Auth token used by the client
export OPENAI_API_KEY="$YOUR_KEY"
Practical troubleshooting:
OPENAI_API_KEY is set and loaded.chat/completions → fix OPENAI_BASE_PATH (and verify it matches what the proxy actually exposes).