Repository navigation
Replies: 1 comment
|
+1. A related case without a proxy: a budget that T3 itself enforces. On a plain API key, or when we leave agents running remotely and overnight, nothing stops a thread that loops. We would like an optional cap on estimated cost per thread, with a project default (the same layering Settings already has). When a thread crosses it, the turn stops and the thread shows a budget stop, much like Limited works today: the user sees it, raises the cap or sends a message to continue. Scheduled tasks and delegated children would count toward their parent's cap. That builds on two pieces: the per-thread cost requested in #13073 (PR #34338 is open) for the number, and the existing limit-stop UI for the way out. With a LiteLLM connection as proposed here, the proxy's real spend and budget would replace the estimate. |
Uh oh!
There was an error while loading. Please reload this page.
Context
We run Claude Code through a LiteLLM proxy because of EU requirements: requests go through EU-hosted profiles, and the proxy enforces budgets per user and team. In T3 this is a Claude instance with its own config directory and, in its Environment variables,
ANTHROPIC_BASE_URLset to the proxy and a LiteLLM virtual key inANTHROPIC_AUTH_TOKEN(the same setup as the OpenRouter and router instructions in the Claude provider docs). It sits next to our regular subscription accounts.For this instance every token is real money, billed by the proxy at the proxy's own prices. In our case that is about 10% above public API prices because of the EU setup. Other setups have discounts, internal markups, or models with no public price at all.
What matters: the proxy is the single source of truth, and it exposes everything over its API. A normal virtual key can read prices, spend and budgets. Nothing outside the proxy is needed.
What I'm missing most: cost at every thread
When working against a metered proxy I want to see what this thread has cost so far, right in the thread, without opening Usage. Usage answers a different question (totals over 24hβ90d). It can't tell me whether the conversation in front of me is getting expensive.
In the Claude Code terminal this is commonly solved with a
statusLinescript: it prices the session transcript with the proxy's/model/inforates and shows the remaining budget from/user/info. That script doesn't run inside T3, so this view disappears when you switch to T3.Why Usage doesn't cover it today
claude-opus-5-5. Setting the proxy price also reprices the subscription history.ANTHROPIC_AUTH_TOKENreport no limits, so the budget that actually blocks requests never shows up.Proposal: a LiteLLM proxy connection
Two ways to connect, which complement each other:
ANTHROPIC_BASE_URL/ANTHROPIC_AUTH_TOKENin the instance's Environment variables, with an option to set or override the proxy URL and key. This covers the agent's own threads with no extra setup.Instances linked to a proxy get their data from it:
/usage-limits: spend against max budget, pace, and reset countdown for every level that has a budget (key, user, team, team member, per-model). This works like Cursor's monthly allowance does today.Endpoints
All of these work with a non-admin virtual key (for user-scoped endpoints, with the key's own
user_id):GET /model/infoinput_cost_per_token,output_cost_per_token,cache_read_input_token_cost,cache_creation_input_token_cost, plus context limitsGET /v1/modelsGET /key/infomax_budget,budget_duration,budget_reset_at, per-model budgets (model_max_budget_usage)GET /user/info,GET /v2/user/infoGET /user/daily/activity(/aggregated)Where it shows up
In the thread: a Thread cost row at the bottom of the thread details card, where Context window and Usage limits already show, and turned on the same way under Settings β Appearance β Thread details. It shows the thread's cost so far, with the proxy budget underneath. People read budgets differently, so the budget line should support several formats:
$212.40 / $500.00(month)$287.60 left42% used58% leftIdeally the format can be chosen where the instance (or proxy connection) is configured, or from the card's right-click menu, which already controls which rows the card shows. It appears only for instances priced by a proxy, so subscription threads don't show misleading "API-equivalent" numbers.
Usage: proxy prices, billed history and budgets as described above.
All reactions