Roo Code is an AI-powered VS Code extension that empowers developers to build better software faster with intelligent coding assistance. TrueFoundry’s AI Gateway integrates seamlessly with Roo Code, providing access to multiple AI models through a unified, secure, and cost-optimized interface. By connecting Roo Code to TrueFoundry’s AI Gateway, you can leverage advanced AI capabilities for code generation, debugging, and development tasks while benefiting from TrueFoundry’s enterprise-grade features including security, compliance, and cost management.

Prerequisites

Before integrating Roo Code with TrueFoundry, ensure you have:
  1. TrueFoundry Account: Create a Truefoundry account with atleast one model provider and generate a Personal Access Token by following the instructions in Generating Tokens
  2. Roo Code Extension: Install Roo Code from the VS Code Marketplace

Integration Guide

Step 1: Install Roo Code Extension

If you haven’t already installed Roo Code:
  1. Open VS Code: Launch Visual Studio Code
  2. Access Extensions: Click the Extensions icon in the Activity Bar (Ctrl+Shift+X)
  3. Search for Roo Code: Type “Roo Code” in the search bar
  4. Install Extension: Click “Install” on the Roo Code extension by RooCode
VS Code Marketplace showing the Roo Code extension installation page

Install Roo Code from VS Code Marketplace

Step 2: Get TrueFoundry Gateway Configuration

Before configuring Roo Code, gather your TrueFoundry Gateway details:
  1. Navigate to AI Gateway Playground: Go to your TrueFoundry AI Gateway playground
  2. Access Unified Code Snippet: Use the unified code snippet
  3. Copy Base URL and Model Name: You will get both the base URL and model name from the unified code snippet (ensure you use the same model name as written)
TrueFoundry unified code snippet showing the base URL and model name to copy

Get Base URL and Model Name from Unified Code Snippet

Step 3: Configure Roo Code with TrueFoundry Gateway

  1. Open Roo Code Sidebar: Click the Roo Code icon (🦘) in the VS Code Activity Bar
  2. Access Configuration: In the welcome screen or settings, look for API provider configuration
  3. Select Custom Provider: Choose “Custom” or “OpenAI Compatible” from the provider dropdown
  4. Configure TrueFoundry Settings:
    • Base URL: Enter your TrueFoundry Gateway URL (e.g., https://your-control-plane.truefoundry.cloud/api/llm)
    • API Key: Paste your TrueFoundry authentication token
    • Model Name: Copy the model name from our Gateway playground”
Roo Code configuration interface with TrueFoundry Gateway settings

TrueFoundry Configuration in Roo Code

Step 4: Complete Configuration

  1. Configure Model: Enter the model name from the unified code snippet you copied in Step 2
  2. Save Configuration: Click “Save” or “Let’s go!” to apply your settings
Recommended Models for Roo Code:
  • openai-main/gpt-4o: Best for complex code generation and reasoning tasks
  • anthropic-main/claude-3-5-sonnet: Excellent for code understanding and following instructions
  • Use the exact model name as shown in your TrueFoundry Gateway unified code snippet

Step 5: Test Your Integration

  1. Test Connection: Open a code file and try asking Roo Code a question
  2. Verify Functionality: Ensure responses are generated through TrueFoundry Gateway
Roo Code in action with a code generation example using TrueFoundry integration

Testing Roo Code with TrueFoundry

Advanced Configuration

Multiple Model Profiles

Configure different profiles for various use cases:
{
  "roocode.apiProfiles": [
    {
      "name": "TrueFoundry GPT-4",
      "baseUrl": "https://your-control-plane.truefoundry.cloud/api/llm",
      "apiKey": "your-truefoundry-token",
      "model": "openai-main/gpt-4o",
      "description": "High-quality code generation"
    },
    {
      "name": "TrueFoundry Fast",
      "baseUrl": "https://your-control-plane.truefoundry.cloud/api/llm", 
      "apiKey": "your-truefoundry-token",
      "model": "openai-main/gpt-3.5-turbo",
      "description": "Quick responses for simple tasks"
    }
  ]
}

Custom Instructions

Enhance Roo Code’s performance with TrueFoundry by setting custom instructions:
You are an expert software developer working with enterprise-grade code.
Prioritize:
- Security best practices
- Performance optimization
- Clean, maintainable code
- Comprehensive error handling
- Detailed documentation

When suggesting code changes, always consider:
- Code review standards
- Testing requirements
- Scalability implications
All your calls from Roo Code will now go through the TrueFoundry Gateway.