Problem
thv llm setup writes ANTHROPIC_BASE_URL=<gateway-url> verbatim. When the gateway is an Envoy AI Gateway, native-Anthropic traffic is served at /anthropic/v1/messages, not /v1/messages. Without the prefix, Claude Code's requests fall through to a catchall route and the user sees:
There's an issue with the selected model (claude-sonnet-4-6). It may not exist or you may not have access to it.
Gateway logs show 404, model: null, with auth headers populated — i.e. auth works, the path doesn't.
Workaround
After running thv llm setup, manually append /anthropic to the gateway URL in the patched tool config (e.g. set ANTHROPIC_BASE_URL=https://<gateway>/anthropic in Claude Code's settings).
What needs to change
thv llm setup should know that some gateways prefix provider APIs. Two pieces:
--anthropic-path-prefix flag (default empty). Users on Envoy AI Gateway pass --anthropic-path-prefix=/anthropic; others leave it.
- Optional auto-probe. HEAD/OPTIONS
<gateway>/anthropic/v1/messages vs /v1/messages and pick the one that returns 401 (auth-reachable) over 404.
Scope is direct-mode tools only (Claude Code, Codex). Proxy-mode tools (Cursor, VS Code) route through thv llm proxy and don't need the prefix in their config.
Acceptance
Problem
thv llm setupwritesANTHROPIC_BASE_URL=<gateway-url>verbatim. When the gateway is an Envoy AI Gateway, native-Anthropic traffic is served at/anthropic/v1/messages, not/v1/messages. Without the prefix, Claude Code's requests fall through to a catchall route and the user sees:Gateway logs show
404,model: null, with auth headers populated — i.e. auth works, the path doesn't.Workaround
After running
thv llm setup, manually append/anthropicto the gateway URL in the patched tool config (e.g. setANTHROPIC_BASE_URL=https://<gateway>/anthropicin Claude Code's settings).What needs to change
thv llm setupshould know that some gateways prefix provider APIs. Two pieces:--anthropic-path-prefixflag (default empty). Users on Envoy AI Gateway pass--anthropic-path-prefix=/anthropic; others leave it.<gateway>/anthropic/v1/messagesvs/v1/messagesand pick the one that returns401(auth-reachable) over404.Scope is direct-mode tools only (Claude Code, Codex). Proxy-mode tools (Cursor, VS Code) route through
thv llm proxyand don't need the prefix in their config.Acceptance
--anthropic-path-prefixflag exists and is honored when patchingANTHROPIC_BASE_URL.