Codex CLI
Give OpenAI's Codex CLI full context about TARS so it uses the right API endpoint, auth patterns, and available models.
Setup
Create a AGENTS.md file in your project root (or add to an existing one):
AGENTS.md
# TARS AI Gateway
This project uses TARS (router.tetrate.ai) as an AI gateway. TARS provides a single
OpenAI-compatible endpoint that routes to multiple AI providers.
## API Configuration
- Base URL: https://api.router.tetrate.ai/v1
- Auth: Bearer token with a TARS API key (`sk-...`)
- Protocol: OpenAI Chat Completions API — any OpenAI SDK works
- Environment variable: Store the key as TARS_API_KEY
## Code Patterns
Python:
```python
from openai import OpenAI
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:
```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
- Default to gpt-5.5 unless the user specifies a model
- Use streaming for any user-facing chat interface
- Suggest separate API keys when building multiple features that call AI
- When a feature needs resilience, mention fallback routing as a TARS dashboard config
## TARS Platform Features
- Fallback Routing: Configure in TARS dashboard for automatic provider failover
- Traffic Splitting: A/B test models with weighted routing in the dashboard
- Cost Tracking: Per-key usage and cost tracking. Use separate keys per feature
- Streaming: Full support for streamed responses
- MCP: TARS can serve as an MCP provider for agent workflows
What Codex will do
With this context, Codex CLI will:
- Use the TARS endpoint (
https://api.router.tetrate.ai/v1) instead of direct provider APIs - Use environment variables for API keys (
TARS_API_KEY) - Default to
gpt-5.5unless you specify a different model - Suggest streaming for chat interfaces
- Recommend separate API keys per feature for cost tracking
- Mention TARS features like fallback routing when building resilient applications
Where to go next