Claude Code is Anthropic’s agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster through natural language commands.Benefits of Using Truefoundry with Claude Code.

With Portkey integration, you can enhance Claude Code with enterprise features:

  • Unified AI Gateway - Route Claude Code through multiple providers (Anthropic, Bedrock, Vertex AI)
  • Centralized Logs - Track all Claude Code interactions

Prerequisites

  1. Configure provider accounts for one or more of:
    • Anthropic
    • AWS Bedrock
    • Google Vertex AI
  2. Configure models in Truefoundry for each provider you want to use

Integrate Truefoundry with Claude Code

Claude Code uses a settings.json file for configuration. You’ll need to modify the environment variables to route requests through Truefoundry.

Claude Code can be configured either globally or per project by editing the settings file:

  • Global: ~/.claude/settings.json
  • Project-specific: .claude/settings.json in your project directory
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://{controlPlaneUrl}/api/llm/v1",
    "ANTHROPIC_CUSTOM_HEADERS": "Authorization: Bearer your-truefoundry-api-key\nx-tfy-provider-name: <tfy-provider-name>",
    "ANTHROPIC_MODEL": "anthropic/claude-3-5"
  }
}

Replace:

  • your-truefoundry-api-key with your TrueFoundry API key
  • tfy-provider-name with the TrueFoundry Provider name
  • controlPlaneUrl with your Control Plane URL
  • projectId with your Google Project Id
  • region with Region of the Model
  • Update the model name if using a different Claude model

Using Claude Code

After configuring the settings file, you can use Claude Code as normal. The Truefoundry AI Gateway will handle routing your requests to the appropriate provider based on your configuration.

Example Commands

# Get help with a coding problem
claude "How do I implement a binary search tree in Python?"

# Generate a script
claude "Create a script that processes CSV files and extracts specific columns"

# Debug code
claude "Debug this function: def factorial(n): if n == 0: return 1 else: return n * factorial(n)"