You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Per-thread cost and budgets for Claude instances behind a LiteLLM proxy, read from the proxy's API
#30930
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_URL set to the proxy and a LiteLLM virtual key in ANTHROPIC_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 statusLine script: it prices the session transcript with the proxy's /model/info rates 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
Wrong prices. Cost comes from the public LiteLLM rate table on GitHub, not from the proxy. Proxy-specific prices and proxy-only models are wrong or unpriced.
Prices can't be scoped to an account.Model prices applies to a whole environment. A subscription account and a proxy account both use claude-opus-5-5. Setting the proxy price also reprices the subscription history.
No budget in Limits. The docs say proxy connections through ANTHROPIC_AUTH_TOKEN report 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:
On the provider instance: detected automatically from ANTHROPIC_BASE_URL / ANTHROPIC_AUTH_TOKEN in 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.
As a usage provider (like the CLIProxyAPI hub, under Settings → Providers → Usage providers): base URL plus virtual key, for budgets and history even when no instance uses that proxy on this machine, or when several instances share one proxy.
Instances linked to a proxy get their data from it:
Thread cost in the thread details card (see below): tokens of the thread's transcript × the proxy's rates. These are the same rates the proxy bills, so the number should match what the proxy charges. A breakdown by input / cache read / cache write / output fits the existing cost categories.
Budgets in Usage → Limits, the thread details card and /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.
Proxy prices for that instance only in Usage → Cost, so proxy-billed spend is correct and separate from subscription estimates.
Billed history in Usage from the proxy's daily activity, which is authoritative and includes usage from other clients using the same key or user.
Model list for the instance from the proxy, so proxy models don't have to be added one by one with Add custom model.
Endpoints
All of these work with a non-admin virtual key (for user-scoped endpoints, with the key's own user_id):
Endpoint
Gives
GET /model/info
Per-model rates: input_cost_per_token, output_cost_per_token, cache_read_input_token_cost, cache_creation_input_token_cost, plus context limits
User spend and budget, teams with team and team-member budgets and reset times
GET /user/daily/activity (/aggregated)
Daily spend, tokens and requests by model, which keep accumulating and are not reset by budget windows
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:
spent / total for the current period, e.g. $212.40 / $500.00 (month)
remaining amount, e.g. $287.60 left
percentage used, e.g. 42% used
percentage left, e.g. 58% left
Ideally 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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
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