Skip to content

Latest commit

 

History

History
322 lines (257 loc) · 17 KB

t3code.md

File metadata and controls

322 lines (257 loc) · 17 KB

T3 Code

After this page, T3 Code sends its configured providers' requests through your hub, and Usage → Limits shows pooled limits for the accounts its usage reader supports. You need a working hub from the setup guide. Providers lists every subscription and API-key upstream, its login flow and its client API surface.

Subscription proxying may violate provider terms and can lead to suspension or a ban. Never serve other people's traffic with your subscriptions. The hub enforces the first-party client for two of them: Claude subscriptions serve only Claude Code (including the Claude Code instance T3 Code runs), and Google Antigravity logins serve only the standalone Antigravity CLI. The hub recognizes agy by its antigravity/cli/… User-Agent, and its ACP server's generate requests by the google-genai-sdk/… gl-go/… cl/… User-Agent of the Go genai SDK built into it. Other clients neither list nor reach those models unless an API key or another account supplies them.

T3 Code needs no plugin and no change on the hub. Requests go through the clients' own config files, and limits come from the hub's management API.

Where providers run

T3 Code runs a provider on the machine of the environment that owns the thread, with that machine's Claude Code and Codex configuration. Configure the hub on that machine. Phones and other devices that only view the thread do not matter here.

Environments covers the verified t3 serve, t3 connect, service and pairing commands, including Windows and WSL 2 on one PC. Box setup gives an ordered SSH checklist. Once you select a remote environment, its terminals and agents run on that box.

Claude

Pick one of these on the environment's machine:

  • Point that machine's Claude Code at the hub as in the setup guide (ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN in ~/.claude/settings.json). Claude in T3 Code then uses the hub too.
  • Add a separate Claude instance under Settings → Providers with its own config directory that holds the hub settings, such as ~/.claude-hub.
  • Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN as environment variables on a Claude instance in Settings → Providers, and mark the token as sensitive.

T3 Code's Claude model picker has a built-in list. It adds a model it lacks, such as Claude Mythos 5.1 and 5.2, only when Claude Code reports it, and Claude Code behind the hub learns models from the hub only with gateway model discovery. Turn it on next to the hub settings:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://<hub>.<tailnet>.ts.net:8317",
    "ANTHROPIC_AUTH_TOKEN": "<hub access key>",
    "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1"
  }
}

Claude Code then reads GET /v1/models from the hub in the background and keeps the list in ~/.claude/cache/gateway-models.json, so the new models appear from the next Claude Code start. It keeps only IDs that contain claude, and the hub lists only Claude models there, so the Claude picker shows Claude models only. To pick other providers' models in Claude Code as well, set claude-code.disable-cloaking-model-list: false on the hub: its Anthropic model list then also gives them cloaked claude-fable-5-dd-… IDs (never models reserved for another client, such as Antigravity's).

T3 Code never drops a model from its Claude picker once Claude Code has reported it. If the hub ever served cloaked IDs (before disable-cloaking-model-list defaulted to true, or while it was false), the picker keeps listing GPT, Gemini, Grok and Mistral entries after the hub stops serving them. To clear them, stop T3 Code, remove the claude-fable-5-dd-… entries from ~/.t3/caches/claudeAgent.json (or delete the file; T3 Code probes Claude again on start), then start T3 Code.

Codex

Point the machine's Codex at the hub in ~/.codex/config.toml as in the setup guide. In T3 Code, choose Use existing CLI for Codex. That option reads config.toml. Continue with ChatGPT signs in directly and does not go through the hub.

Codex signed in with a hub access key downloads a model list only when its provider names one with model_catalog_url. Without it Codex offers only its built-in list, so models the hub gains later (a new GPT release) never appear. Point model_catalog_url at the hub:

model_provider = "hub"

[model_providers.hub]
name = "t3code-proxy hub"
base_url = "https://<hub>.<tailnet>.ts.net:8317/provider/codex/v1"
model_catalog_url = "https://<hub>.<tailnet>.ts.net:8317/provider/codex/v1/models"
wire_api = "responses"
requires_openai_auth = true
supports_websockets = true

Codex then reads the catalog from the hub with the same access key, keeps it for five minutes and refreshes it on its own, so nothing has to run on a timer. Do not also set model_catalog_json: a fixed catalog file replaces the live one. /provider/codex/v1 lists only the Codex accounts' models and serves everything Codex calls (Responses over HTTP and WebSocket, compaction, search).

Antigravity (Gemini)

The hub can serve a Google account's whole Antigravity catalogue (Gemini, and the Claude and GPT-OSS models Google offers) to T3 Code's Antigravity provider. Two pieces make that work.

  • The Antigravity-only endpoint. The Antigravity CLI's gateway mode takes its model list from the endpoint it is pointed at. https://<hub>/provider/antigravity lists only the hub's Antigravity accounts, so the CLI never offers your Claude or Codex subscription models. For antigravity/cli/ requests it expands each thinking-capable model into its supported effort variants and deduplicates aliased base/suffixed IDs so T3 Code shows one entry per model with its effort levels under Effort.
  • The standalone CLI. T3 Code's bundled Antigravity runtime ignores gateway mode and always offers its own fixed Gemini list. The standalone agy CLI (1.5.9 or later) honours it. deploy/t3code/agy-acp starts agy acp for T3 Code, renames the session modes between the two runtimes (auto_edit and yolo both map to accept-edits for agy, while preserving yolo in responses back to T3 Code so Full access is not downgraded to Accept edits), and clamps out-of-range thought_level updates to the active model's offered levels; everything else passes through unchanged.

Setup on the machine running T3 Code:

  1. Install the standalone CLI so ~/.local/bin/agy exists.

  2. Copy deploy/t3code/agy-acp to a folder of its own, for example ~/.local/share/t3-hub/, and link T3 Code's localharness_external next to it (T3 Code checks for it before it accepts a custom runtime):

    ln -s ~/.t3/tools/antigravity-acp/<platform>/versions/<version>/localharness_external \
      ~/.local/share/t3-hub/localharness_external
  3. In Settings → Providers → Antigravity: sign-in method Gemini API key with a hub access key, Binary path set to the copied agy-acp, and these environment variables (mark the key as sensitive):

    AGY_LLM_GATEWAY_URL=https://<hub>/provider/antigravity
    AGY_LLM_GATEWAY_API_KEY=<hub access key>
    GOOGLE_GEMINI_BASE_URL=https://<hub>/provider/antigravity
    
  4. Start one Antigravity thread. T3 Code fills the model picker from the first session.

Clearing the binary path returns to T3 Code's bundled runtime and its fixed Gemini list.

OpenCode

By default, OpenCode takes its model catalog from a models.dev-style URL. The hub serves its own catalog at https://<hub>/opencode/<access key>/api.json: every model the hub serves, under one provider called t3code-proxy, refreshed by OpenCode every few minutes. Claude models use the Anthropic Messages API, Codex models the Responses API, and the rest OpenAI chat completions, all on the hub. The catalog also includes OpenCode's own opencode provider, copied from models.dev every hour, so OpenCode's free models (opencode/big-pickle and the other -free models) still show up. OpenCode sends those requests to opencode.ai itself, under OpenCode's free-usage limits; they do not pass through the hub, and other hub clients cannot use them. OpenCode cannot send a header with that fetch, so the access key is in the path; the hub masks it in its logs.

  1. Enable OpenCode in Settings → Providers on the environment's machine. Its driver is off until you do.

  2. Give the instance these environment variables, the first two marked sensitive:

    OPENCODE_MODELS_URL=https://<hub>.<tailnet>.ts.net:8317/opencode/<access key>
    T3CODE_PROXY_API_KEY=<access key>
    OPENCODE_AUTH_CONTENT={}

    OPENCODE_AUTH_CONTENT={} hides OpenCode's own saved logins from this instance. OpenCode 1.18 fails to load its providers when a saved login names a provider the catalog lacks.

  3. Pick a t3code-proxy/<model> or opencode/<free model> model in the thread. The instance lists only those; your own OpenCode setup outside T3 Code is unchanged.

To give OpenCode just the two Mistral budgets and OpenCode's free models, configure the hub:

client:
  opencode:
    providers:
      mistral: Mistral $15
      mistral-vibe: Mistral $150

The keys match the names in /provider/<name>/v1. The catalog then lists each allowed provider under its own short label (trailing parenthetical notes are stripped) and scoped URL, and includes only explicitly free, zero-priced OpenCode offerings under the OpenCode provider name (which T3 Code displays with no sub-provider label). An empty providers: {} allows only those free offerings. The hub returns HTTP 403 when a recognized OpenCode client uses the general API or another provider. It identifies the client by its OpenCode headers. A shared hub key still grants its normal access to other clients.

For OpenCode profiles with locally configured providers, remove any general hub provider and its provider.use allowance from each active config, including OPENCODE_CONFIG_DIR. Check any scheduled catalog refresh for writes that could recreate it. Keep the two scoped Mistral base URLs, set their provider names to Mistral $15 and Mistral $150 (without parenthetical notes or redundant suffixes on model display names), leave the opencode provider unlabelled, then run opencode reload and check opencode models in the same profile as T3 Code.

The standalone hub reserves its Claude subscription credentials for Claude Code and its Google Antigravity logins for the Antigravity CLI. OpenCode lists a model when an eligible credential supplies it, such as an Anthropic or Gemini API key or an upstream with reserved-for: opencode. Asking for a reserved model by ID returns 403 unless an eligible credential also supplies it. See Mistral.

A fixed model list in ~/.config/opencode/opencode.json is not updated by the hub. Remove Antigravity and Claude subscription models from it by hand, or point OpenCode at the catalog above instead.

Mistral (OpenCode and Vibe)

Mistral has two monthly budgets on one account: API usage and Vibe Code. Which one a request draws on depends on the key that sends it: a key made in the Mistral console draws on the API budget, and the key Mistral Vibe gets when you sign in with Mistral draws on the Vibe Code budget. To run both through the hub, give the hub both keys as two upstreams.

  1. Keep the console key as the mistral upstream (api-keys.openai-compatibility, base URL https://api.mistral.ai/v1). OpenCode and other clients use it as <model>.
  2. Add the Vibe key as a second upstream with the same base URL and models and prefix: vibe, and set force-model-prefix: true. Its models are then reachable only as vibe/<model>, so nothing else spends the Vibe budget by accident. On macOS, Vibe keeps its key in the keychain under the service ai.mistral.vibe.
  3. Declare the reasoning levels Mistral accepts on models that have them, for example thinking: {levels: [none, high], zero-allowed: true} on mistral-vibe-cli-latest. Without it the hub turns "thinking off" into reasoning_effort: low, which Mistral rejects.
  4. Choose the client that spends the Vibe budget:
    • OpenCode. Set reserved-for: opencode on the Vibe upstream. Only OpenCode lists and uses the vibe/<model> models, in its catalog as t3code-proxy/vibe/<model>. Every other client, Mistral Vibe included, neither lists them nor reaches them: asking for one returns 403 ... available only through OpenCode. The hub recognizes OpenCode by its opencode/... User-Agent or its x-opencode-client header. Point Vibe at the console key's models (name = "<model>") if it should keep working on the API budget.
    • Mistral Vibe. Leave reserved-for unset and point Vibe at the hub in ~/.vibe/config.toml: a mistral provider with api_base = "https://<hub>.<tailnet>.ts.net:8317/v1", backend = "mistral", preserve_api_base = true, and api_key_env_var = "MISTRAL_API_KEY", with the hub access key in ~/.vibe/.env. Add each model as [[models]] with name = "vibe/<model>" and the alias Vibe shows, such as mistral-medium-3.5 for vibe/mistral-vibe-cli-latest. T3 Code's Mistral Vibe agent (ACP) reads the same files, so it follows.
routing:
  force-model-prefix: true
api-keys:
  openai-compatibility:
    - name: mistral
      base-url: https://api.mistral.ai/v1
      keys: [{api-key: "<console key>"}]
      models: [{name: mistral-medium-latest}]
    - name: mistral-vibe
      prefix: vibe
      reserved-for: opencode
      base-url: https://api.mistral.ai/v1
      keys: [{api-key: "<Vibe key>"}]
      models:
        - name: mistral-vibe-cli-latest
          thinking: {levels: [none, high], zero-allowed: true}

Mistral Vibe can still spend the Vibe budget directly if it signs in to Mistral outside the hub.

The hub reads both budgets and shows them on the Overview page as money spent of the monthly amount, with the reset date. Two keys of one Mistral customer are recorded as one account, so neither allowance is counted twice. See quota history.

Other upstream providers

The hub also serves Antigravity, Kimi, xAI, Devin, Meta, Google API keys, Vertex and OpenAI-compatible upstreams. Use the client configuration and model selection in providers. For example, a Codex instance pointed at the hub can select an exposed model from another upstream. Check the model's supported tools and modalities before relying on it for a coding task.

Add the hub as a usage provider

A Claude connection that uses ANTHROPIC_AUTH_TOKEN does not report subscription limits by itself. To see the limits of the accounts behind the hub, add the hub:

  1. Open Settings → Providers → Usage providers → Add hub.
  2. Choose the environment that connects to the hub. Its machine must be on your tailnet.
  3. Enter the hub URL, https://<hub>.<tailnet>.ts.net:8317, and the management secret (not the access key).

Remove the hub from the same section when you no longer need it. The usage provider only reads limits; it does not route requests.

What appears under Limits

Usage → Limits pools the accounts per provider. You read one figure per window, such as the 5-hour and weekly windows, with a bar that has one segment per account. Claude's model-scoped weekly limits, such as the Opus weekly limit, keep their own values. An account that is signed in on an environment and also on the hub counts once.

T3 Code reads the hub's Codex, Claude, xAI (shown as Grok) and Antigravity accounts. Accounts for other providers on the hub are not shown.

The hub web panel has its own quota views and plan-aware pool charts. Its Claude and Codex charts let you weight accounts by plan. Configure those weights to match your subscriptions. The capability table gives the panel's coverage, and quota history describes the recorder. T3 Code reads provider usage through the management endpoints below. The panel's chart weights are stored in that browser.

Reset credits

Codex accounts can hold banked reset credits. T3 Code shows the count in each account's details. Select an account and choose Use reset to redeem one; the account's Codex limits are restored right away.

The web panel's Overview page shows the same banked resets and has its own Use reset action.

How T3 Code talks to the hub

T3 Code calls three endpoints under /v0/management, each with Authorization: Bearer <management secret>:

Endpoint Purpose
GET /v0/management/auth-files List the accounts on the hub.
POST /v0/management/api-call Have the hub call a provider endpoint with an account's token. The token stays on the hub.
POST /v0/management/reset-quota Clear an account's cooldown on the hub.

These endpoints are a supported compatibility contract. test/t3code_contract_test.go pins their request and response shapes, so a change that would break T3 Code fails the test suite.

T3 Code reaches them over Tailscale, so management.allow-remote must be true. The installer's config sets it.