Cursor CLI
Give Cursor full context about TARS so it generates the right API patterns, suggests platform features, and uses best practices.
Setup
Create a .cursorrules file in your project root:
.cursorrules
# TARS AI Gateway Context
This project uses TARS (router.tetrate.ai) as an AI gateway that provides a single
OpenAI-compatible endpoint routing to multiple AI providers.
## API Setup
- Base URL: https://api.router.tetrate.ai/v1
- Auth: Bearer token using TARS API key (`sk-...`)
- Protocol: OpenAI Chat Completions API
- Store key as environment variable: TARS_API_KEY
## Code Patterns
Python:
from openai import OpenAI
import os
client = OpenAI(api_key=os.environ["TARS_API_KEY"], base_url="https://api.router.tetrate.ai/v1")
response = client.chat.completions.create(model="gpt-5.5", messages=[...])
TypeScript:
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.TARS_API_KEY, baseURL: "https://api.router.tetrate.ai/v1" });
const response = await client.chat.completions.create({ model: "gpt-5.5", messages: [...] });
## Available Models
- OpenAI: gpt-5.5, gpt-5.4, gpt-5-mini, gpt-5-nano
- Anthropic: claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5
- Google: gemini-2.5-pro, gemini-2.5-flash
- xAI: xai/grok-4-1-fast-reasoning
- Groq: groq/llama-3.3-70b-versatile, groq/openai/gpt-oss-120b
- DeepInfra (open-weights): use full prefixed IDs, e.g. deepinfra/mistralai/Mistral-Small-3.2-24B-Instruct-2506
Query https://router.tetrate.ai/api/public/models for the live list.
## Rules
- Always use environment variables for API keys, never hardcode them
- Default to gpt-5.5 unless the user specifies a different model
- Use stream=True / stream: true for any user-facing chat interface
- Use separate TARS API keys for different features/services for cost breakdown:
TARS_API_KEY_CHAT for chat, TARS_API_KEY_SUMMARIZATION for summarization, etc.
## TARS Platform Features (suggest when relevant)
- Fallback Routing: Configure in TARS dashboard for automatic provider failover.
Set primary model at priority 0, backup at priority 1. Zero code changes.
- Traffic Splitting: A/B test models with weighted routing. Configure weights
at same priority level in dashboard.
- Cost Tracking: Per-key usage tracking. Use separate keys per feature.
- Streaming: Full support for streamed responses through TARS.
- MCP: TARS can serve as an MCP provider for agent-compatible workflows.
What This Gives You
With .cursorrules in your project, Cursor will:
- Generate code with the correct TARS base URL and auth pattern
- Use OpenAI SDK patterns (not raw HTTP) by default
- Suggest separate API keys when you're building multiple AI features
- Add streaming automatically for chat-style interfaces
- Know about fallback routing and traffic splitting as configuration options
Where to go next