Repository navigation
Launch Claude, Codex, OpenCode, and Pi through a LiteLLM gateway (lite CLI) #31253
hyrmedia-hector
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
Many companies give engineers model access only through a LiteLLM gateway with SSO. Those users cannot use their direct Claude, Codex, OpenCode, or Pi subscriptions in T3 Code. Today they must configure each harness's gateway settings by hand, manage keys that expire, and they get no per-project spend tracking.
Proposal
Add an optional Launch through LiteLLM toggle to the Claude, Codex, OpenCode, and Pi provider instances. When it is on, T3 Code starts the harness through the LiteLLM CLI (
lite <harness>, 1.102.0+) instead of directly.liteowns SSO sign-in, the key, its renewal, the gateway URL (LITELLM_PROXY_URL), and the harness gateway config. T3 Code stores no LiteLLM secret.binaryPathpoints at a per-instance shim thatexecslite <harness>. This keeps the change at the adapter boundary.lite login --pkce), with a paste-the-URL fallback for remote clients.repo:,project:,jira:,tool:) for spend tracking on the gateway.Prior work
We built and use this in our fork, HYRMedia-LLC/t3code, kept in sync with upstream
main:docs/user/providers-litellm.mdpackages/provider-core/src/server/litellm.tsapps/server/src/provider/liteLLMLaunchers.tsapps/server/src/orchestration-v2/ProviderAuthRetry.tsHard parts we solved, which a maintainer would want to judge:
launchGeneration(key expiry + gateway models) lets the session manager replace an idle process before its next turn and resume the thread. LiteLLM instances use per-thread sessions, also for Codex and OpenCode.liteprints a routing line before protocol output, so parsers tolerate leading text, and--versionprobes bypasslite.-coverrides when a-cfollows a subcommand ([Bug]: lite codex silently bypasses the proxy when -c is passed after a Codex subcommand (exec/resume/review) BerriAI/litellm#40651), so LiteLLM Codex rejects-c/--configin launch args. OpenCode with Server URL is rejected for the same reason (it would bypass the gateway).Known limits: not on Windows yet; Pi does not send request tags yet.
Scope question
We can split this into small PRs if you approve the direction, for example:
Is this a direction you would accept, and in which scope? We will open no PR without your approval.
Related: #30930 (per-thread cost for Claude behind a LiteLLM proxy).
Drafted by Claude Opus 5.5 in Claude Code.
All reactions