Join the AI Security Webinar with Palo Alto. Register here

Cline Integration with TrueFoundry AI Gateway

October 1, 2025
|
9:30
min read
SHARE

If you use VS Code and AI while you code, Cline is a great fit. When you run Cline through TrueFoundry’s AI Gateway, you get the same coding experience with enterprise guardrails, observability, and cost control. This guide walks you through what Cline is, why routing it through the Gateway helps, and how to set it up in a few minutes. Cline runs inside your editor and can write files, modify code, and help you debug through a natural conversation. It feels like a teammate who knows your repo and can act on it from the editor.  

Why pair Cline with TrueFoundry

  • One key place for access and keys: You give Cline a single TrueFoundry API key and a base URL. The Gateway handles provider keys behind the scenes, so you do not spread raw model keys across laptops and scripts. You can also rotate and expire tokens when needed.  
  • Spend only what you intend. Set hard budgets per user, team, app, or model. If a limit is crossed, calls stop. This prevents surprise bills from loops or heavy usage.  
  • Keep traffic healthy. Apply rate limits per user, team, app, or model.
  • See what is happening. Use dashboards for latency, token usage, cost, errors, and the rules that were triggered. You can group by model, user, team, or your own labels.  
  • Log what you need. Turn request logging on or off with a header when you need a trace and keep it off when you do not.  
  • Tag every call with context. Add metadata like project, environment, tenant, or feature to each request and then filter, chart, and limit with those tags.

What you need

Step-by-step setup

  1. Open VS Code with Cline installed. Open the command palette with Cmd or Ctrl plus Shift plus P. Run “Cline: Open in new tab”. Click the gear icon in the Cline tab.  
  1. Point Cline to the Gateway
  2. In Cline’s API settings, set:
    1. API Provider: OpenAI Compatible
    2. Base URL: your TrueFoundry Gateway URL
    3. API Key: your TrueFoundry API key
    4. Model ID: for example openai-main/gpt-4o, or any model you expose via the Gateway
  3. Save the settings.  

That is it. Cline will now send requests through the Gateway with your chosen model.

Tip: If you prefer to test with a short script, the OpenAI clients can talk to the Gateway by setting the base URL and your TrueFoundry key as shown in the access control guide.  

Try these first prompts in Cline

  • Create: “Create a Python function that returns the first N Fibonacci numbers.”  
  • Modify: “Add input validation and error handling to that function.”  
  • Explain: “Explain what this function does in plain English.”  
  • Debug: “I am getting a ValueError in this file. Help me fix it.”  

Recommended Gateway setup for teams

1) Use the right kind of key

  • Personal Access Tokens work well for individual developers.
  • Virtual Access Tokens work well for apps and shared tools. They are not tied to a person and can be scoped and revoked by an admin.  

2) Add budgets

Create a simple budget config so one person or one tool cannot overspend.

  • Daily or monthly limits are supported.
  • You can scope limits to users, teams, virtual accounts, models, or any mix of these.
  • If any matching rule is over the limit, the call is blocked.  

3) Add rate limits

Protect backends and enforce fair use.

  • Limit by tokens or by requests.
  • Apply per minute, hour, or day.
  • Match by user, team, virtual account, model, or metadata like environment or project.
  • The Gateway uses a sliding window token bucket.  

4) Tag every request

Ask your team to add a small header with tags like customer, project, environment, or feature.

  • Send X-TFY-METADATA with string values.
  • Use these tags to filter logs, build custom charts, and even scope rate or budget rules.  

5) Be deliberate about logging

  • Toggle logging per request using the X-TFY-LOGGING-CONFIG header.
  • For self-hosted Gateway, you can also set a global mode to always log or never log.
  • View logs in the Monitor section of the UI when you need them.  

Observability that helps you ship

Open the Metrics Dashboard to watch latency, time to first token, inter-token latency, cost, token counts, error codes, and more. Group by model to compare performance. Group by user or team to see who uses what. Group by your own metadata to track tenants or features. You can also export raw metrics to CSV for deeper analysis.  

What you gain

  • Speed in the editor with Cline’s autonomous code help.  
  • Control over who can use which models and how.  
  • Safety with budgets and rate limits.  
  • Clarity with logs, analytics, and your own metadata.  

Closing thoughts

Cline makes coding feel lighter. The Gateway makes it safe to roll that power out across a team. Set the URL, pick the model, add a key, and you are ready to code. As you scale, add budgets, rate limits, logging, and metadata, and you will keep speed without losing control.

The fastest way to build, govern and scale your AI

Discover More

July 8, 2025
|
5 min read

What is LLM Observability ? Complete Guide

June 2, 2025
|
5 min read

Load Balancing in AI Gateway: Optimizing Performance

June 2, 2025
|
5 min read

AI Guardrails in Enterprise: Ensuring Safe Innovation

April 4, 2025
|
5 min read

Portkey vs LiteLLM : Which is Best ?

The Complete Guide to AI Gateways and MCP Servers

Simplify orchestration, enforce RBAC, and operationalize agentic AI with battle-tested patterns from TrueFoundry.
Take a quick product tour
Start Product Tour
Product Tour