# How to build an energy-aware AI orchestration engine

> Architecture and a Python reference sketch for an AI orchestration engine that routes, caches, budgets and accounts for tokens and estimated energy.

Source: https://greenai.guide/engineering/orchestration-engine/  
Updated: 2026-11-26

## In short

An energy-aware orchestration engine sits between your application and its models. It answers what it can with plain code and caches, sends the rest to the smallest model tier likely to pass a quality gate, escalates only on failure, enforces a budget on every task, and records tokens and estimated energy per task. This guide sets out the architecture, gives a self-consistent Python sketch to adapt, and explains how to evaluate it per successful task.

## Key points

- Put the cheapest paths first: deterministic handlers, then caches, then model tiers ordered from small to large.
- Escalate on evidence: a quality gate (schema, tests, checks) decides whether a tier's answer is good enough.
- Every task carries a budget of calls, tokens and estimated energy, checked before each model call.
- Energy can be estimated from output tokens with EcoLogits' published method; state its assumptions, because it ignores input tokens and overheads.
- Judge the engine on task success rate and tokens and energy per successful task, against an always-large baseline.

Most AI features start as a single call to a single large model. That is the simplest thing that works, and the
most expensive way to keep working. An orchestration engine replaces the single call with a policy: answer cheaply
where possible, call a model only when needed, pick the smallest one that will pass, stop when the task is done or
the budget is spent, and record what it cost.

This guide describes the architecture and gives a reference sketch in Python. **The code is an illustration to
adapt, not a benchmarked product**: it has been checked to run, but no performance or energy results are claimed
for it. The patterns it uses are described one by one in the
[catalogue of green AI design patterns](/engineering/design-patterns/).

## What does an energy-aware orchestration engine do?

**It decides, for every request, the cheapest route to an acceptable answer, and keeps an account of what each
route cost.** "Energy-aware" means the engine treats tokens and estimated energy as first-class quantities, alongside
latency, money and quality, rather than as something to look up on an invoice.

The idea is not new. FrugalGPT (Chen, Zaharia and Zou, 2023) chained models from cheap to expensive and reported
matching GPT-4's performance with up to 98% lower cost. Hybrid LLM (Ding and colleagues, 2024) routed between a
small and a large model by predicted difficulty and reported up to 40% fewer calls to the large model with no drop
in response quality. Both measured cost, not energy, but for the same provider and hardware the two move together.
The Green Software Foundation's agent orchestration pattern recommends the same moves for energy: cache identical
inputs, use direct tool calls for simple transformations, use simpler models or heuristics for routing before
invoking larger ones, and stop loops when goals are met.

## What does the architecture look like?

**A pipeline of increasingly expensive stages, each of which can finish the task, wrapped in a budget and a
telemetry record.**

<!-- figure: a request enters on the left, passes through a classifier, a deterministic and tool path, an exact and semantic cache, then model tiers small to large each followed by a quality gate; a budget ledger spans all model stages and a telemetry sink below collects one record per task -->

| Stage | What it does | Typical cost |
|---|---|---|
| Classifier | Labels the request: task type, expected difficulty, whether it can wait | Rules or a small model |
| Deterministic and tool path | Answers with code, lookups or APIs when it can | Negligible |
| Caches | Returns a stored answer to a repeated request | A hash or a vector lookup |
| Model tiers | Small, medium and large models, each with an output cap | Rises with model size and tokens |
| Quality gates | Accept or reject each model answer | Code checks; a model judge only if needed |
| Budget ledger | Stops the task before it overspends | Negligible |
| Telemetry | One record per task: route, calls, tokens, estimated energy, outcome | Negligible |

The order is the design. Every request that ends at an early stage never touches the later, dearer ones.

## How should requests be classified?

**By the cheapest signal that predicts what route a request needs.** Start with rules (task type from the calling
feature, input length, presence of attachments), and train a small classifier only when rules stop being good
enough.

The classifier answers three questions:

1. **Can code answer this?** Known questions, structured look-ups and transformations go to the deterministic path.
2. **Which tier should try first?** Most requests should start at the smallest tier; start higher only for request
   types where the small tier rarely passes, since a failed attempt is pure overhead.
3. **Can it wait?** Deferrable work goes to a batch queue instead of the interactive path; see
   [how to batch AI requests](/how-do-i/batch-ai-requests/).

Keep the classifier itself cheap. A classifier that calls a large model on every request has spent the saving
before routing starts.

## What belongs on the deterministic and tool path?

**Anything a rule, lookup, database query, API or established algorithm does reliably.** These handlers return an
answer or decline; the engine moves on only when all of them decline.

Typical handlers parse identifiers, convert units and dates, answer known questions from a table, run a search over
your own content, or call a calculator or solver. The Green Software Foundation pattern calls this using direct
tool calls or API integrations for simple data transformations instead of models. See
[how to decide if a task needs AI](/how-do-i/decide-if-i-need-ai-for-a-task/) and
[when to choose classical ML instead of an LLM](/how-do-i/choose-classical-ml-instead-of-an-llm/).

## How should model tiers and the router policy work?

**Order tiers from small to large, give each an output cap, and move up only when a quality gate rejects the
answer.** The router policy is the combination of the classifier's starting tier, the gates and the budget.

- **Tiers.** Two or three are usually enough: a small model for classification, extraction and short answers; a
  mid-sized one for most generation; a large one, possibly with reasoning, for the hard remainder. Hugging Face's AI
  Energy Score team found that reasoning models used, on average, 30 times more energy than models without
  reasoning, so reasoning belongs in the top tier or behind an explicit escalation, not on by default.
- **Gates.** Prefer checks that cost almost nothing: schema validation, unit tests for generated code, required
  fields present, citations that resolve to retrieved passages, length within bounds. A model-based judge is a
  further model call on every answer it checks; use it only where nothing cheaper works, and charge it to the budget.
- **Escalation.** On rejection, move to the next tier with the same prompt, or with the rejection reason added if
  that helps. Don't retry the same tier repeatedly; a deterministic failure will repeat.

A 2026 UK green AI sandpit of mathematicians, computer scientists and industry raised the central risk: a model that
is too small can fail and force a rerun on the big one, so the threshold is a real design decision. Tune the
starting tier per request type on your evaluation set. See [how to set up model routing](/how-do-i/set-up-model-routing/).

## Where do caches fit?

**Before the model tiers, and keyed on everything that changes the answer.** Two kinds help, and the provider's own
prompt cache works alongside both.

- **Exact cache.** A hash of the normalised request plus the policy version (models, prompts, retrieved document
  versions), with a time to live.
- **Semantic cache.** A similarity search over embedded past requests. It catches paraphrases, but a false hit gives
  the right answer to the wrong question, so tune its threshold on labelled pairs and log its hits separately.
- **Provider prompt cache.** Structure every prompt with stable content first, so the provider can reuse the
  processed prefix. Anthropic, for example, prices cache reads at 0.1 times the base input price for most models and
  requires the cached segments to be identical.

Only cache answers that passed their gates. See [how to cache LLM calls](/how-do-i/cache-llm-calls/).

## How should budgets work?

**Every task gets a budget of model calls, tokens and estimated energy, checked before each call, and the engine
stops cleanly when it would be exceeded.** Budgets are what turn a cascade from "keep trying" into a bounded
process.

Anthropic reported that its agents typically used about four times the tokens of chat interactions, and multi-agent
systems about fifteen times. Without a ceiling, a misbehaving task can do the same. Set budgets per feature from the
distribution of real tasks (for example, somewhat above the 95th percentile of tokens per successful task), and
alert on tasks that hit them. When a budget stops a task, return what you have and say so; never silently retry.
See [how to stop AI agents wasting tokens](/how-do-i/stop-ai-agents-wasting-tokens/).

## What should telemetry record?

**One record per task, not per call, with enough detail to compute tokens and energy per successful task.** A task
is what the user asked for; it may involve no calls, one call, or several.

Each record should carry: a task ID, the feature, the policy version, the route taken, success or failure, the
number of calls and escalations, input, cached input and output tokens, the models used, estimated energy and the
method behind it. Join it to a task-level outcome later (did the user accept the answer, did the test pass) to
measure real success, not just gate passes. See [how to track AI energy per task](/how-do-i/track-ai-energy-per-task/)
and [observing AI energy in production](/engineering/energy-observability/).

## How can the engine estimate energy per call?

**From tokens, latency and model size, using a published method, labelled as an estimate.** Hosted providers rarely
report energy per call, so the engine needs a model of it.

The sketch below follows EcoLogits' LLM inference methodology. EcoLogits fits GPU energy per output token, from
benchmark data on NVIDIA H100 80GB GPUs, as a function of the model's active parameters (in billions) and the batch
size:

> energy per output token (Wh) = α × e^(β × B) × P_active + γ, with α = 1.17 × 10⁻⁶, β = −1.12 × 10⁻² and γ = 4.05 × 10⁻⁵

It fixes the batch size B at 64, multiplies by the number of GPUs needed to hold the model (memory estimated as
1.2 × total parameters × 16 bits ÷ 8, on 80 GB GPUs, rounded up to a power of two), adds the rest of the server
(1.2 kW shared across 8 GPUs and the batch, for the duration of the request), and multiplies by the data centre's
power usage effectiveness (PUE). EcoLogits lists PUE values per provider from 1.09 to 1.20; the sketch defaults to
1.2, the highest of those.

State the limits wherever the numbers appear. EcoLogits itself notes that it extrapolates from smaller to larger
models, does not account for TPUs or other accelerators, and does not account for infrastructure overheads or
utilisation factors. Its GPU term also counts **output tokens only**, whereas Epoch AI estimates that a typical
ChatGPT query of about 0.3 Wh rises to about 2.5 Wh with a 10,000-token input, so long inputs matter. The engine
therefore logs input tokens separately, even though the default estimate does not price them. For hosted models,
parameter counts are often unpublished, so the inputs are themselves estimates: use the best public estimate
available and say which one you used.

Treat the result as a way to compare routes within your own system, not as a figure to compare with a provider's.
For scale, Google reports 0.24 Wh for a median Gemini Apps text prompt, measured in its own way. To turn Wh into
emissions, multiply by the grid carbon intensity in grams of CO₂e per kWh and divide by 1,000; see
[how to find grid carbon intensity data](/how-do-i/find-grid-carbon-intensity-data/) and
[how to estimate the energy of AI API calls](/how-do-i/estimate-energy-of-ai-api-calls/).

## What does a reference implementation look like?

**About 300 lines of standard-library Python, in seven parts.** It runs on Python 3.10 or later. Swap the in-memory
pieces (cache, sink) for your own infrastructure.

### Part 1: the pluggable model interface

Any model, hosted or self-hosted, plugs in by returning a `Completion` with token counts from the provider's usage
fields.

```python
from __future__ import annotations

import hashlib
import json
import math
import time
import uuid
from dataclasses import dataclass, field
from typing import Callable, Protocol


@dataclass(frozen=True)
class Completion:
    text: str
    input_tokens: int
    output_tokens: int
    cached_input_tokens: int = 0


class Model(Protocol):
    name: str
    active_params_b: float  # billions of parameters used per token
    total_params_b: float   # billions of parameters held in memory

    def complete(self, prompt: str, *, max_output_tokens: int) -> Completion:
        ...
```

An adapter for a hosted API maps its response onto `Completion`. The client call here is a placeholder for your
provider's SDK:

```python
class HostedModel:
    def __init__(self, client, name: str, active_params_b: float,
                 total_params_b: float) -> None:
        self.client, self.name = client, name
        self.active_params_b, self.total_params_b = active_params_b, total_params_b

    def complete(self, prompt: str, *, max_output_tokens: int) -> Completion:
        response = self.client.generate(            # placeholder: your SDK's call
            model=self.name, prompt=prompt, max_tokens=max_output_tokens)
        return Completion(
            text=response.text,
            input_tokens=response.usage.input_tokens,
            output_tokens=response.usage.output_tokens,
            cached_input_tokens=getattr(response.usage, "cached_input_tokens", 0),
        )
```

### Part 2: the energy estimate

```python
@dataclass(frozen=True)
class EnergyModel:
    """Rough energy per request in Wh, after EcoLogits. Counts output tokens only."""

    alpha: float = 1.17e-6     # fitted coefficients, Wh per output token
    beta: float = -1.12e-2
    gamma: float = 4.05e-5
    batch_size: int = 64
    server_other_w: float = 1200.0  # server power excluding GPUs
    gpus_per_server: int = 8
    gpu_memory_gb: float = 80.0
    bits_per_param: int = 16
    pue: float = 1.2

    def gpus_needed(self, total_params_b: float) -> int:
        memory_gb = 1.2 * total_params_b * self.bits_per_param / 8
        count = max(1, math.ceil(memory_gb / self.gpu_memory_gb))
        return 2 ** math.ceil(math.log2(count))

    def wh_per_output_token(self, active_params_b: float) -> float:
        return (self.alpha * math.exp(self.beta * self.batch_size)
                * active_params_b + self.gamma)

    def request_wh(self, model: Model, output_tokens: int,
                   latency_s: float) -> float:
        gpus = self.gpus_needed(model.total_params_b)
        gpu_wh = output_tokens * self.wh_per_output_token(model.active_params_b)
        other_wh = (latency_s / 3600 * self.server_other_w
                    * gpus / self.gpus_per_server / self.batch_size)
        return self.pue * (other_wh + gpus * gpu_wh)
```

If you serve models yourself, replace this class with measured energy (from a power meter or CodeCarbon) divided
across the requests served; see [how to measure AI energy](/practice/measure-ai-energy/).

### Part 3: budgets and the per-task ledger

```python
class BudgetExceeded(Exception):
    pass


@dataclass(frozen=True)
class Budget:
    max_calls: int = 4
    max_tokens: int = 20_000
    max_wh: float = 5.0


@dataclass
class CallRecord:
    model: str
    input_tokens: int
    cached_input_tokens: int
    output_tokens: int
    latency_s: float
    est_wh: float
    passed_gates: bool


@dataclass
class Ledger:
    budget: Budget
    calls: list[CallRecord] = field(default_factory=list)

    @property
    def tokens(self) -> int:
        return sum(c.input_tokens + c.output_tokens for c in self.calls)

    @property
    def est_wh(self) -> float:
        return sum(c.est_wh for c in self.calls)

    def check_before_call(self, max_output_tokens: int) -> None:
        if len(self.calls) >= self.budget.max_calls:
            raise BudgetExceeded("call limit reached")
        if self.tokens + max_output_tokens > self.budget.max_tokens:
            raise BudgetExceeded("token budget would be exceeded")
        if self.est_wh >= self.budget.max_wh:
            raise BudgetExceeded("energy budget reached")
```

The pre-call check knows the tokens spent so far and the next call's output cap, but not its input size. Leave a
margin, or count input tokens first with your provider's token-counting tool.

### Part 4: the cache

```python
class ExactCache:
    """In-memory exact-match cache with a time to live."""

    def __init__(self, ttl_s: float = 3600) -> None:
        self.ttl_s = ttl_s
        self._store: dict[str, tuple[float, str]] = {}

    @staticmethod
    def key(prompt: str, policy_version: str) -> str:
        normalised = " ".join(prompt.split()).lower()
        return hashlib.sha256(f"{policy_version}\n{normalised}".encode()).hexdigest()

    def get(self, key: str) -> str | None:
        hit = self._store.get(key)
        if hit is None or time.monotonic() - hit[0] > self.ttl_s:
            self._store.pop(key, None)
            return None
        return hit[1]

    def put(self, key: str, value: str) -> None:
        self._store[key] = (time.monotonic(), value)
```

A semantic cache can sit behind the same `get` and `put` methods; keep its hits labelled in telemetry.

### Part 5: tiers, gates and the engine

```python
Gate = Callable[[str, Completion], bool]   # True if the answer is acceptable
Handler = Callable[[str], "str | None"]    # deterministic path; None means decline
Classifier = Callable[[str], int]          # index of the first tier to try
Sink = Callable[[dict], None]              # telemetry destination


@dataclass(frozen=True)
class Tier:
    model: Model
    max_output_tokens: int


@dataclass
class Result:
    text: str | None
    success: bool
    route: str      # "deterministic", "cache", "tier:<n>" or "failed:<reason>"
    ledger: Ledger


class Orchestrator:
    def __init__(self, *, handlers: list[Handler], classifier: Classifier,
                 tiers: list[Tier], gates: list[Gate], cache: ExactCache,
                 energy: EnergyModel, budget: Budget, sink: Sink,
                 policy_version: str = "v1") -> None:
        if not tiers:
            raise ValueError("at least one model tier is required")
        self.handlers, self.classifier = handlers, classifier
        self.tiers, self.gates, self.cache = tiers, gates, cache
        self.energy, self.budget, self.sink = energy, budget, sink
        self.policy_version = policy_version

    def run(self, prompt: str, *, feature: str) -> Result:
        ledger = Ledger(self.budget)
        result = self._route(prompt, ledger)
        self._emit(feature, result)
        return result

    def _route(self, prompt: str, ledger: Ledger) -> Result:
        for handler in self.handlers:
            answer = handler(prompt)
            if answer is not None:
                return Result(answer, True, "deterministic", ledger)

        key = self.cache.key(prompt, self.policy_version)
        cached = self.cache.get(key)
        if cached is not None:
            return Result(cached, True, "cache", ledger)

        start = min(max(self.classifier(prompt), 0), len(self.tiers) - 1)
        for index in range(start, len(self.tiers)):
            tier = self.tiers[index]
            try:
                ledger.check_before_call(tier.max_output_tokens)
            except BudgetExceeded as stop:
                return Result(None, False, f"failed:{stop}", ledger)

            began = time.monotonic()
            completion = tier.model.complete(
                prompt, max_output_tokens=tier.max_output_tokens)
            latency = time.monotonic() - began
            passed = all(gate(prompt, completion) for gate in self.gates)
            ledger.calls.append(CallRecord(
                model=tier.model.name,
                input_tokens=completion.input_tokens,
                cached_input_tokens=completion.cached_input_tokens,
                output_tokens=completion.output_tokens,
                latency_s=latency,
                est_wh=self.energy.request_wh(
                    tier.model, completion.output_tokens, latency),
                passed_gates=passed,
            ))
            if passed:
                self.cache.put(key, completion.text)
                return Result(completion.text, True, f"tier:{index}", ledger)

        return Result(None, False, "failed:all tiers rejected", ledger)

    def _emit(self, feature: str, result: Result) -> None:
        ledger = result.ledger
        self.sink({
            "task_id": str(uuid.uuid4()),
            "feature": feature,
            "policy_version": self.policy_version,
            "route": result.route,
            "success": result.success,
            "calls": len(ledger.calls),
            "escalations": max(0, len(ledger.calls) - 1),
            "input_tokens": sum(c.input_tokens for c in ledger.calls),
            "cached_input_tokens": sum(c.cached_input_tokens for c in ledger.calls),
            "output_tokens": sum(c.output_tokens for c in ledger.calls),
            "est_wh": round(ledger.est_wh, 6),
            "models": [c.model for c in ledger.calls],
            "energy_method": "EcoLogits-style estimate, output tokens only",
        })
```

Model errors and timeouts propagate as exceptions in this sketch. In production, catch them per tier, record the
failed call in the ledger (it still used energy) and decide explicitly whether to escalate.

### Part 6: wiring it together

```python
FAQ = {"what are your opening hours?": "We are open 9am to 5pm, Monday to Friday."}


def faq_handler(prompt: str) -> str | None:
    return FAQ.get(" ".join(prompt.split()).lower())


def length_classifier(prompt: str) -> int:
    return 0 if len(prompt) < 2_000 else 1


def is_json_object(_prompt: str, completion: Completion) -> bool:
    try:
        return isinstance(json.loads(completion.text), dict)
    except ValueError:
        return False


def not_empty(_prompt: str, completion: Completion) -> bool:
    return completion.text.strip() != ""


def jsonl_sink(path: str) -> Sink:
    def write(record: dict) -> None:
        with open(path, "a", encoding="utf-8") as f:
            f.write(json.dumps(record) + "\n")
    return write
```

A feature is then one constructor call. The parameter counts are illustrative values for a small and a large
model, not figures for any named product:

```python
def build_engine(small: Model, large: Model) -> Orchestrator:
    return Orchestrator(
        handlers=[faq_handler],
        classifier=length_classifier,
        tiers=[Tier(small, max_output_tokens=300), Tier(large, max_output_tokens=800)],
        gates=[not_empty, is_json_object],
        cache=ExactCache(ttl_s=6 * 3600),
        energy=EnergyModel(),
        budget=Budget(max_calls=3, max_tokens=12_000, max_wh=2.0),
        sink=jsonl_sink("ai-tasks.jsonl"),
        policy_version="extract-v3",
    )
```

### Part 7: evaluation

```python
@dataclass(frozen=True)
class Case:
    prompt: str
    check: Callable[[str], bool]   # task-level pass mark, separate from the gates


def evaluate(engine: Orchestrator, cases: list[Case], feature: str) -> dict:
    results = [engine.run(c.prompt, feature=feature) for c in cases]
    passed = [r for r, c in zip(results, cases)
              if r.success and r.text is not None and c.check(r.text)]
    tokens = sum(r.ledger.tokens for r in results)
    wh = sum(r.ledger.est_wh for r in results)
    n_ok = len(passed)
    return {
        "tasks": len(cases),
        "task_success_rate": n_ok / len(cases) if cases else 0.0,
        "tokens_per_successful_task": tokens / n_ok if n_ok else math.inf,
        "est_wh_per_successful_task": wh / n_ok if n_ok else math.inf,
        "share_without_model_call": sum(
            r.route in ("deterministic", "cache") for r in results) / len(cases),
        "escalation_rate": sum(len(r.ledger.calls) > 1 for r in results) / len(cases),
    }
```

Note that the totals include every task, failed ones too, divided by the successful ones. Failed work is part of
the cost of each success.

## How do I evaluate the engine?

**Run the same evaluation set through the engine and through simple baselines, and compare task success rate,
tokens per successful task and estimated energy per successful task.** A policy that saves tokens but lowers the
success rate has moved the cost to your users.

1. **Build the evaluation set** from real, anonymised requests, each with a task-level check that is independent of
   the engine's gates. Include the hard tail, not just typical cases.
2. **Run baselines:** always the large tier; always the small tier; and the engine. The always-large run sets the
   quality bar; the always-small run shows how much routing is needed.
3. **Ablate.** Switch off one stage at a time (classifier, cache, a gate) to see what each contributes. Run caches
   from cold, or they flatter the result.
4. **Compare per successful task:** tokens, estimated Wh, money and latency at the median and 95th percentile.
5. **Watch the escalation rate.** A high rate means the starting tier is too small for that request type, and the
   failed attempts may cost more than they save.
6. **Repeat on every change** to a model, prompt, threshold or budget, and record the policy version with each
   result. Put a token budget for representative tasks into CI; see
   [testing AI energy in CI](/engineering/ci-energy-testing/).

<!-- figure: a scatter of task success rate against estimated energy per successful task, with points for always-small, always-large and several engine policies, showing the policies that dominate the baselines -->

Report the method with the result: which energy estimate, which assumptions, which evaluation set. See
[how to set a baseline for AI energy savings](/how-do-i/set-a-baseline-for-ai-energy-savings/) and
[honest green claims](/practice/honest-green-claims/).

## What are the common pitfalls?

**Most failures come from measuring the wrong unit, trusting gates too much, or letting the engine itself grow
expensive.**

- **Counting per call, not per task.** Escalations and retries vanish from per-call averages.
- **Lenient gates.** A gate that passes poor answers makes the small tier look good and the users unhappy. Sample
  gate passes for human review.
- **An expensive router.** A large-model classifier or judge on every request can cost more than it saves.
- **Cache keys that miss what matters.** Forgetting the prompt or document version returns stale answers; forgetting
  the user's permissions leaks data.
- **False precision.** Energy estimates with six decimal places invite comparisons the method cannot support. Round
  in reports and label them as estimates.
- **Ignoring input tokens.** The default estimate prices output only; long contexts still cost energy. Track input
  tokens and keep them down with retrieval and prefix caching.
- **Budgets that nobody looks at.** Alert when tasks hit limits; a rising rate means something changed.
- **Rebound.** A cheaper feature gets used more. Track total energy per feature as well as per task; see
  [efficiency is not sufficiency](/articles/efficiency-is-not-sufficiency/).
- **Stale tiers.** New model releases change the trade-offs. Re-run the evaluation when any model changes, and
  record the decision.

## What to do next

1. Add per-task telemetry (route, calls, tokens, outcome) to one AI feature before changing anything.
2. Build an evaluation set with task-level checks, and run the always-large and always-small baselines.
3. Put deterministic handlers and an exact cache in front of the model, and measure the share of tasks they finish.
4. Add a second, smaller tier with a cheap gate, and tune the starting tier per request type.
5. Set per-task budgets from real distributions, and alert when they are hit.
6. Add the energy estimate, with its assumptions written next to every chart that shows it.
7. Re-run the evaluation on every model or prompt change, and publish energy per successful task and total energy
   with the method; see [how to make honest claims about green AI](/how-do-i/make-honest-claims-about-green-ai/).

## Frequently asked questions

### What is an AI orchestration engine?

A layer of code that decides, for each request, whether a model is needed, which model to call, whether to accept its answer, and when to stop. It coordinates models, tools and caches instead of sending everything to one large model.

### How do I estimate the energy of an LLM call I don't host?

Log the tokens and latency of each call and apply a published estimation method such as EcoLogits', which models GPU energy from output tokens and the model's active parameters. Label the result as an estimate and state its assumptions.

### Does routing to small models always save energy?

No. If the small model fails and the request is retried on a large one, the task pays for both. Measure tokens and energy per successful task, including escalations, and tune the router on your own data.

### Should I use an LLM as the quality gate?

Only where a cheaper check cannot do the job. Schema validation, unit tests and rule checks cost almost nothing; a model-based judge adds a call to every request it checks, so count it in the budget.

### Is this reference implementation production-ready?

No. It is an illustration of the architecture to adapt. It has not been benchmarked, and a production system needs persistence, concurrency, error handling, security review and real measurements.

## Sources

- [LLM inference methodology](https://ecologits.ai/latest/methodology/llm_inference/), EcoLogits documentation (2025)
- [EcoLogits](https://ecologits.ai/latest/), EcoLogits documentation (2025)
- [How much energy does ChatGPT use?](https://epoch.ai/gradient-updates/how-much-energy-does-chatgpt-use), Epoch AI (2025)
- [Measuring the environmental impact of delivering AI at Google scale](https://arxiv.org/abs/2508.15734), Elsworth et al., Google (arXiv 2508.15734) (2025)
- [FrugalGPT: how to use large language models while reducing cost and improving performance](https://arxiv.org/abs/2305.05176), Chen, Zaharia and Zou (arXiv 2305.05176) (2023)
- [Hybrid LLM: cost-efficient and quality-aware query routing](https://arxiv.org/abs/2404.14618), Ding et al. (arXiv 2404.14618) (2024)
- [Prompt caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching), Anthropic, Claude platform documentation (2026)
- [How we built our multi-agent research system](https://www.anthropic.com/engineering/multi-agent-research-system), Anthropic (2025)
- [Optimize agent orchestration to reduce unnecessary model calls](https://github.com/Green-Software-Foundation/patterns/blob/main/docs/development/optimize-agent-orchestration-reduce-model-calls.md), Green Software Foundation, Green Software Patterns (2025)
- [AI Energy Score v2: refreshed leaderboard, now with reasoning](https://huggingface.co/blog/sasha/ai-energy-score-v2), Luccioni and Gamazaychikov, Hugging Face (2025)
