Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPT-5.6 Model Router

A three-tier model-routing diagram

This started as a small test of a question that kept coming up: should one application use Sol, Terra, or Luna?

After sketching a few workflows, choosing one model for the whole application felt too crude. Classification and extraction have very different failure costs from debugging or final review. This repository keeps that decision in a short Python function so the rule can be inspected, tested, and changed without hiding it inside a prompt.

The goal is to send each task to the least expensive tier that reliably passes its acceptance check, while keeping an explicit escalation path for ambiguous or high-consequence work.

Routing policy

Tier Default role Typical tasks
Luna High-volume work with a clear acceptance test Classification, extraction, normalization, formatting
Terra Balanced production default Drafting, planning, ordinary coding, bounded analysis
Sol Escalation and final judgment Ambiguous debugging, architecture decisions, final review

The router uses task properties rather than prompt length. A long document can contain a simple extraction job, while a short debugging question can hide substantial uncertainty.

Quick start

The routing logic has no third-party dependencies:

python router.py
python cost_calculator.py
python -m unittest discover -s tests -v

Basic usage:

from router import TaskProfile, choose_model

task = TaskProfile(kind="classification")
model = choose_model(task)

print(model)  # gpt-5.6-luna

Escalate work when ambiguity or consequence increases:

task = TaskProfile(
    kind="debugging",
    ambiguity="high",
    consequence="medium",
)

print(choose_model(task))  # gpt-5.6-terra

Cost example

cost_calculator.py keeps prices in configuration instead of burying them in application logic.

With the example prices dated August 28, 2026, a task using 8,000 input tokens and 1,500 output tokens costs approximately:

Tier Cost per task Cost for 100,000 tasks
Sol $0.0620 $6,200
Terra $0.0340 $3,400
Luna $0.0034 $340

Pricing changes. Verify the current provider documentation before using these figures for budgeting.

Using the router with CometAPI

The router itself does not depend on an API gateway. I used CometAPI for the integration example because switching models through one OpenAI-compatible client kept the surrounding code easier to inspect.

That convenience does not make model-specific evaluation optional. Sol, Terra, and Luna still need to be tested on representative tasks. The shared client simply keeps model selection, usage tracking, retries, and fallback behavior from being scattered across several integrations.

Install the OpenAI-compatible client and set a server-side key:

pip install openai

# PowerShell
$env:COMETAPI_API_KEY="your-key"

# macOS or Linux
export COMETAPI_API_KEY="your-key"

Then run:

python example_cometapi.py

The example keeps model identifiers configurable through environment variables because availability and naming can change:

GPT56_SOL_MODEL=gpt-5.6-sol
GPT56_TERRA_MODEL=gpt-5.6-terra
GPT56_LUNA_MODEL=gpt-5.6-luna

Check the CometAPI documentation and current model catalog before sending production traffic.

What to measure

Do not optimize for token price alone. Track:

  • acceptance without editing;
  • retry count;
  • validation failures;
  • latency;
  • token usage;
  • human review time.

The useful metric is:

cost per accepted task = total model cost / outputs that pass review

Start with 30 to 50 representative tasks per route. Assign each route to the least expensive tier that consistently clears the real quality bar.

Files

  • router.py — explicit, testable routing policy
  • cost_calculator.py — configurable token-cost estimates
  • example_cometapi.py — OpenAI-compatible CometAPI example
  • tests/test_router.py — routing-policy tests

Sources

Disclosure

This repository was prepared as part of CometAPI content work. The routing policy is intentionally provider-neutral, and the example pricing should be checked against current public documentation before use.

About

A practical Python router for GPT-5.6 Sol, Terra, and Luna, with cost estimates and a CometAPI example.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages