Skip to content

Claude Code Integration ​

Launch Claude Code with Treasure AI as the backend.

Treasure AI customers can use Claude Code with their existing AI Suite credits — no separate Claude subscription required.

Features ​

  • Use Your Own TD Subscription - Run Claude Code using AI Suite credits
  • Full Claude Code Features - Extended thinking, plan mode, subagents, and Opus model support
  • TD Documentation Search - AI-powered search across Treasure AI documentation
  • TD Skills Integration - Enhanced with td-skills for writing SQL queries, workflows, and building user segments on CDP

Architecture ​

When you run tdx claude:

  1. Starts a local pass-through proxy to Treasure AI
  2. Launches Claude Code with td-skills and td-docs MCP pre-configured
  3. The proxy forwards Claude Code API requests (/v1/messages) to Treasure AI, which provides Anthropic-compatible API access to Claude models

Client identification ​

TD-proxied LLM requests use X-TD-Client: tdx/claude. TD API requests made by child tdx commands inherit the same identity through TDX_CLIENT. The User-Agent retains tdx/<version> and adds client=tdx/claude in its comment; X-TD-Client-Version remains the tdx version.

With --no-proxy, only child TD CLI requests receive this identity; external Claude providers are left unchanged. Parent startup requests and OAuth token refresh requests are outside this attribution. Explicit user settings can override the inherited environment.

Usage ​

bash
tdx claude [options] [-- claude-options]

Options ​

OptionDescription
-c, --continueForwarded to Claude Code to continue the most recent conversation
-r, --resume [session]Forwarded to Claude Code to resume a conversation or open its selector
--no-proxyUse your own Claude Code account (Anthropic/AWS Bedrock/Vertex AI, etc.)
--disable-1h-cacheSkip the one-hour cache default (Claude models only)
--refreshForce a full td-docs MCP and td-skills refresh before launching
--subagent-model <m>Model for Claude Code sub-agents: inherit (default), auto, or a model

Claude Code options are forwarded without reordering. To resume a known session ID, pass it directly after --resume:

bash
tdx claude --model="efficient[1m]" --resume <session-id>

Default model ​

Pass --model <model> to choose the model for a session. Without it, Claude Code uses its own model selection. Resumed sessions (-c/--continue, -r/--resume) keep the model they were started with. No persistent configuration is changed.

Setup ​

tdx claude sets up the td-docs MCP server and td-skills plugins for you, and skips any step that's already done — so the first launch on a machine does the real work and later launches start immediately. The other TD skills refresh whenever tdx is upgraded, and at least every two weeks.

The tdx Skills (tdx-skills) ship inside tdx itself. Each launch installs them into Claude Code's skills folder, so they always match the installed commands. They use plain names such as segment and tdx-basic. To install them for a project or a folder, see tdx skill.

--refresh forces an update, which you shouldn't normally need.

Non-essential traffic ​

Proxy sessions turn off Claude Code's non-essential traffic. tdx sets CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 and CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL=1 in session-scoped settings, which take precedence over your settings files. As a result:

  • Telemetry, error reports, and session-quality surveys are turned off.
  • Claude Code's auto-updater is off. Update Claude Code yourself with claude update.
  • /feedback refuses to submit.
  • Feature-flag fetching is off, so features gated by flags may be unavailable.
  • Official plugin marketplace auto-install is off.

Model requests still go through the TD LLM proxy, and the commands that register td-skills run with the same policy. --no-proxy sessions are unchanged. If you pass your own --settings, the policy reaches Claude Code only through the process environment, so an env entry in a settings file can override it.

Prompt caching ​

In proxy mode, Claude models use a one-hour prompt cache for the main conversation by default. This reduces rewrites after idle gaps, but writes cost 2× base input instead of 1.25× for five minutes.

To skip this default:

bash
tdx claude --disable-1h-cache

The flag leaves prompt caching and explicit TTL settings intact. --no-proxy, sub-agent caching, and non-Claude providers' cache policies are unchanged.

Sub-agent model ​

Claude Code often delegates work to sub-agents, for example the built-in Explore agent that searches your codebase, or custom agents defined in .claude/agents/. Each sub-agent can run on a different model from your main conversation, and by default Claude Code picks those models on its own, so a session you started on a cheaper model can still spend Opus-tier AI Suite credits in the background.

What tdx claude does by default ​

  • You picked a model with --model (for example tdx claude --model sonnet): every sub-agent runs on that same model. Your whole session, including Explore and Plan, stays on the model you chose.
  • You didn't pick a model: Claude Code runs the main conversation on its own default model and routes sub-agents the way it always has.

You don't need to do anything to get this behavior.

Changing it ​

Use --subagent-model when you want something else:

bash
# Main conversation on the default model, sub-agents on a cheaper one
tdx claude --subagent-model efficient

# Main conversation on sonnet, sub-agents pinned to a different model
tdx claude --model sonnet --subagent-model haiku

# Let Claude Code choose sub-agent models on its own (no tdx involvement)
tdx claude --subagent-model auto
--subagent-modelSub-agents run on
inherit (default)The model selected with --model. Without a selected model, the default leaves Claude Code's routing as is, while an explicit --subagent-model inherit makes every sub-agent follow the main conversation's model.
autoWhatever Claude Code decides: each agent's own model setting, and its built-in defaults for Explore.
a model nameThat model, for every sub-agent. Any name --model accepts works: haiku, efficient, efficient[1m], claude-sonnet-5.

Details ​

  • tdx claude implements this through Claude Code's CLAUDE_CODE_SUBAGENT_MODEL and CLAUDE_CODE_SUBAGENT_MODEL_FORCE environment variables. If you already export either of them in your shell and don't pass --subagent-model, tdx leaves your values alone.
  • ANTHROPIC_MODEL in your environment counts as a chosen model when no --model argument is present.
  • With --no-proxy, tdx only sets these when you pass --subagent-model explicitly.
  • Applying the model to the built-in Explore and Plan agents needs Claude Code 2.1.257 or later. Older versions still honor it for custom agents.

Examples ​

bash
# Launch Claude Code with Treasure AI
tdx claude

# Continue most recent conversation
tdx claude -c

# Run sub-agents on a cheaper model
tdx claude --subagent-model efficient

# Resume a conversation (shows selector)
tdx claude -r

# Start with an initial prompt
tdx claude -- "Explain this code"

# Use your own Claude Code account with TD skills
tdx claude --no-proxy

# Force a td-docs MCP and td-skills refresh
tdx claude --refresh

Example Conversations ​

Once inside Claude Code, you can ask questions like:

> How to set up data ingestion to TD from Snowflake?

> How to add web access log collector in my web page?

> Analyze mydb.user_events data

> Write a workflow to periodically import data from S3

> Create a SQL query to find top customers by revenue

> Build a user segment for customers who purchased in the last 30 days

Requirements ​

Install Claude Code ​

See the Claude Code Quick Start for installation instructions.

bash
curl -fsSL https://claude.ai/install.sh | bash

Minimum Version

Claude Code 2.0.20 or later is required for td-skills support. Update with:

bash
claude update

Other Requirements ​

  • Valid TD API key with LLM access

For usage across Claude, Codex, and OpenCode, run tdx usage.

Discover models ​

Use tdx ai models to discover model IDs and aliases for --model or --subagent-model. Filter by v1_messages for Claude Code-compatible models:

bash
tdx ai models --feature v1_messages
tdx ai models --feature v1_messages --provider anthropic

Subcommands ​

statusline ​

Output credit usage for Claude Code's status bar. This is automatically configured when running tdx claude. See Claude Code Statusline Documentation for more details.

bash
tdx claude statusline

Reads session info from stdin (JSON with session_id and model) and outputs a formatted statusline.

When using --profile, the statusline shows profile-specific today/month credits:

bash
tdx --profile myprofile claude

Output:

🤖 tdx - Sonnet 4.5 | 🪙 credit: 0.12 session / 1.23 today / 10.45 month | 🧠 22,396 (11%)

The statusline shows:

  • Current model name
  • Session / Today / Month credits (estimates, filtered by profile when specified)
  • Context memory usage

Learn More ​

For generic Claude Code usage, refer to the official documentation: