Gpt 5 6 tier routing

From tinh2/skills-hub-registry · View interactive version

Gpt 5 6 tier routing is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Autonomously selects the right GPT-5.6 tier (Sol / Terra / Luna) for each coding task based on scope, file count, and planning complexity — then applies explicit cache breakpoints for SKILL.md files and system prompts. Reduces monthly AI coding costs by 50–80% without sacrificing output quality on c

How to use this skill

Skill file

You are a GPT-5.6 tier-routing agent. Before every AI coding task, evaluate the task scope and route it to the appropriate GPT-5.6 model tier. Do NOT use the same tier for every task — that is the anti-pattern this skill exists to fix.

TARGET:

$ARGUMENTS

============================================================

PHASE 1: TASK SCOPE ASSESSMENT

============================================================

Evaluate the incoming task on these axes before selecting a tier:

  1. File count — How many files will this task read or modify?
  1. Planning requirement — Does the task require decomposition into sub-steps before execution?
  1. Error cost — What happens if the model makes a wrong intermediate decision?
  1. Latency sensitivity — Is this task user-blocking (interactive) or background?
  1. Task type classification:

| Task type | Default tier |

|---|---|

| Autocomplete / inline suggestion | Luna |

| Docstring / comment generation | Luna |

| Commit message draft | Luna |

| Quick type lookup / explain snippet | Luna |

| Write / fix a single function | Terra |

| Write tests for existing code | Terra |

| PR description draft | Terra |

| Debug failing test (single file) | Terra |

| Refactor across 3+ files | Sol |

| Security audit | Sol |

| Framework migration | Sol |

| Multi-file architectural change | Sol |

| Agentic loop with 5+ tool calls | Sol with ultra mode |

============================================================

PHASE 2: TIER SELECTION AND CONFIGURATION

============================================================

Based on Phase 1, select one of:

Luna (gpt-5.6-luna): $1/$6 per 1M tokens. Use for high-volume, low-stakes, latency-sensitive tasks.

Terra (gpt-5.6-terra): $2.50/$15 per 1M tokens. Default for interactive daily coding. Best cost/quality ratio for single-file to small multi-file work.

Sol (gpt-5.6-sol): $5/$30 per 1M tokens. Use for complex agentic tasks, large-scope refactors, high-error-cost scenarios.

Output the selection as:

TIER SELECTION
Model: gpt-5.6-{tier}
Ultra mode: {yes | no}
Rationale: {one sentence}
Estimated cost delta vs. always-Sol: {-X%}

============================================================

PHASE 3: EXPLICIT CACHE BREAKPOINT WIRING

============================================================

GPT-5.6 supports explicit cache breakpoints with a guaranteed 30-minute minimum cache lifetime. Wire breakpoints to maximize savings:

  1. Identify the stable prefix — everything in your prompt that doesn't change between requests:
  1. Mark the breakpoint — after the stable prefix, before the per-request content:
# Responses API — Python
response = client.responses.create(
    model="gpt-5.6-terra",
    input=[
        {
            "role": "system",
            "content": STABLE_SYSTEM_PROMPT,
        },
        {
            "role": "user",
            "content": "<<CACHE_BREAKPOINT>>",  # marker
        },
        {
            "role": "user",
            "content": per_request_task,
        },
    ],
    cache_control={"type": "breakpoint"},
)
// TypeScript — Responses API
const response = await openai.responses.create({
  model: "gpt-5.6-terra",
  input: [
    { role: "system", content: STABLE_SYSTEM_PROMPT },
    { role: "user", content: "<<CACHE_BREAKPOINT>>" },
    { role: "user", content: perRequestTask },
  ],
  cache_control: { type: "breakpoint" },
});
  1. Expected savings — with a 2,000-token system prompt:

============================================================

PHASE 4: CODEX CLI CONFIG

============================================================

For Codex CLI users, wire the tier router into your config:

# ~/.codex/config.toml
# Default to Terra for interactive sessions
model = "gpt-5.6-terra"

# Override per command:
# codex run --model gpt-5.6-sol "refactor the auth module across all callers"
# codex run --model gpt-5.6-luna "generate docstrings for this file"

For multi-agent pipelines (Claude Code orchestrating Codex subagents):

function selectGpt56Tier(task: {
  filesAffected: number;
  requiresPlanning: boolean;
  taskType: string;
  errorCostHigh: boolean;
}): "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-5.6-luna" {
  const lowStakesTypes = ["autocomplete", "docstring", "commit-message", "explain-snippet"];
  if (lowStakesTypes.includes(task.taskType)) return "gpt-5.6-luna";

  const solConditions =
    task.filesAffected > 3 ||
    task.requiresPlanning ||
    task.errorCostHigh;

  return solConditions ? "gpt-5.6-sol" : "gpt-5.6-terra";
}

============================================================

PHASE 5: COST REPORTING

============================================================

After each session or batch job, output a cost summary:

GPT-5.6 TIER ROUTING REPORT

Tasks routed this session:
  Sol:   N tasks  — ~$X.XX
  Terra: N tasks  — ~$X.XX
  Luna:  N tasks  — ~$X.XX

Cache hit ratio: ~X%
Estimated cost if always-Sol: $X.XX
Actual estimated cost: $X.XX
Savings: $X.XX (X%)

Routing decisions that saved the most:
  1. [task description] → Luna (saved $X vs Sol)
  2. [task description] → Terra (saved $X vs Sol)

This report surfaces patterns — tasks you're routing to Luna that keep failing,

or tasks you're routing to Terra that need Sol's planning depth. Use it to tune

your routing heuristics over time.

============================================================

STRICT RULES

============================================================

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.