User Story
As a developer using AI coding tools in an enterprise environment,
I want ToolHive to automatically configure my tools to authenticate with our OIDC-protected LLM gateway,
So that I don't have to manually manage tokens or deal with silent failures when they expire.
Context
RFC-0070 (stacklok/toolhive-rfcs#70) proposes a thv llm command group with two authentication modes:
- Proxy mode — localhost reverse proxy for static-key-only tools (Cursor, VS Code, Xcode) that injects fresh OIDC tokens
- Token helper mode —
thv llm token prints a fresh JWT for OIDC-capable tools (Claude Code, Gemini CLI)
A single thv llm setup command detects installed tools, configures them, starts the proxy, and handles OIDC login.
Acceptance Criteria
Setup & teardown lifecycle
Proxy mode (static-key tools)
Token helper mode (OIDC-capable tools)
Token lifecycle
Configuration management
Tool support
References
User Story
As a developer using AI coding tools in an enterprise environment,
I want ToolHive to automatically configure my tools to authenticate with our OIDC-protected LLM gateway,
So that I don't have to manually manage tokens or deal with silent failures when they expire.
Context
RFC-0070 (stacklok/toolhive-rfcs#70) proposes a
thv llmcommand group with two authentication modes:thv llm tokenprints a fresh JWT for OIDC-capable tools (Claude Code, Gemini CLI)A single
thv llm setupcommand detects installed tools, configures them, starts the proxy, and handles OIDC login.Acceptance Criteria
Setup & teardown lifecycle
thv llm setup --gateway-url <url> --issuer <issuer> --client-id <id>detects installed AI tools, configures each for the gateway, starts the background proxy if any proxy-mode tool is detected, and triggers the OIDC browser loginthv llm teardownremoves gateway configuration from all tool config files, stops the background proxy, and optionally purges cached OIDC tokens with--purge-tokensthv llm teardown <tool-name>targets a single tool without affecting othersProxy mode (static-key tools)
http://localhost:<port>/v1, strips the incomingAuthorizationheader, injects a fresh OIDC bearer token, and forwards to the upstream gateway — preserving the original request path, query string, headers, and bodyToken helper mode (OIDC-capable tools)
thv llm tokenprints a fresh JWT to stdout (all other output on stderr) suitable for use as a tool'sapiKeyHelperorauth.commandthv llm tokenexits with an error in non-interactive mode when no cached or refreshable token exists — it never launches a browser flow. No AT because this is a flag-gated code path tested without external dependencies.Token lifecycle
Configuration management
thv llm config setpersists gateway URL, OIDC settings, and proxy port toconfig.yamlunder thellm:keythv llm config showdisplays current LLM config;--output jsonproduces valid JSONthv llm config resetclears all LLM config and deletes cached tokens from the secrets providerthv llm proxy startruns the proxy in the foreground with full log output (debugging aid)Tool support
apiKeyHelperand base URL in~/.claude/settings.jsonReferences