Skip to content

Claude Code Integration

Launch Claude Code with TD LLM API as the backend.

Features

  • AI Agent Foundry LLM Credits - Run Claude Code using your Treasure Data LLM credits
  • TD Documentation Search - AI-powered search across Treasure Data documentation
  • TD Skills Integration - Enhanced with td-skills for writing SQL queries, workflows, and building user segments on CDP

EXPERIMENTAL FEATURE

This integration is currently experimental and has the following limitations:

  • No extended thinking/reasoning support
  • No sub-agent support

These features may be added in future releases.

Usage

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

Options

OptionDescriptionDefault
--model <name>Model to use (haiku, sonnet)sonnet
--no-proxyUse your own Claude Code account (Anthropic/AWS Bedrock/Vertex AI, etc.)-

Examples

bash
# Launch Claude Code with default model (sonnet)
tdx claude

# Continue previous session
tdx claude -- -c

# Resume a specific session
tdx claude -- -r

# Pass prompt directly
tdx claude -- -p "Explain this code"

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

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

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

Other Requirements

  • Valid TD API key with LLM access
  • An LLM project configured in Treasure Data

Subcommands

usage

Show AI Suite credit consumption statistics by profile.

bash
tdx claude usage [options]
OptionDescription
--jsonOutput as JSON
--jsonlOutput as JSON Lines

Example:

bash
# Display credit usage by profile
tdx claude usage

# JSON output for programmatic access
tdx claude usage --json

Output:

AI Suite Credit Usage Summary
──────────────────────────────────────────────────
  Today:   0.24 credits
  Month:   2.15 credits
  Total:   10.45 credits

Usage by Profile
────────────────────────────────────────────────────────────
  Profile          Credits    Requests  Last Used
  (default)           8.23         245  today 10:30 AM
  production          2.22          30  yesterday

Note: Credit values are estimates based on token usage.

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 (filtered by profile when specified)
  • Context memory usage

Learn More

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