CometAPI fallback: make leaving the primary gateway an explicit application decision

CometAPI’s model and provider fallback guide separates two recovery decisions: changing models inside CometAPI, and leaving CometAPI for a separately configured official-provider account. Treating those as one generic “retry” hides the account and billing boundary.

My recommendation: keep the official-provider route disabled until it has its own tested configuration, budget controls, and acceptable latency allocation. The guide’s Python and Node.js examples describe application-owned routing—not a promise that the gateway automatically performs these steps.

Know which boundary each attempt crosses

The documented order is:

  1. CometAPI primary model. Start with the configured primary model.
  2. CometAPI fallback model. Change the model ID while keeping the same CometAPI API key and base URL.
  3. Matching official provider, if enabled. Use a separate OpenAI or Anthropic client, API key, model ID, account, and billing configuration.

ENABLE_OFFICIAL_FALLBACK defaults to false; the examples append the third route only when it is enabled. With that switch off, exhausting the internal routes does not authorize an official-provider attempt. With it on, the final route still depends on the preceding failures qualifying for fallback.

That is the practical enablement decision: is the application prepared to own a second account and spending path, rather than merely a second model choice within CometAPI?

Keep a stop policy, not just a next-route policy

The guide specifies these boundaries:

Failure Routing decision
Connection error, timeout, 408, 429, or temporary 5xx Try the next configured route.
Model-unavailable, balance, or quota condition Add its exact verified signal to the application classifier before using it as a fallback trigger.
Invalid request, invalid API key, or unsupported parameter Stop and fix the request or configuration.

Do not turn “the primary failed” into blanket permission to try every account. The sample classifiers are implementation starting points, not proof that every provider-specific error is already covered. I would test both the next-route cases and the stop cases against the configured routes before enabling the final hop. When no route remains, surface the failure rather than add an unbounded outer retry loop.

Budget the whole chain

ROUTE_TIMEOUT_MS is a per-attempt timeout, defaulting to 30 seconds. The guide explicitly warns that total fallback time can include all three attempts. Its SDK clients disable automatic retries (max_retries=0 in Python; maxRetries: 0 in Node.js).

Do not read that 30-second setting as an end-to-end response guarantee. My operational recommendation is to allocate attempt timeouts from the application’s overall latency budget and check cumulative behavior in route tests. If the remaining user-facing budget cannot accommodate an official-provider attempt, leave that route out of the policy rather than assume an additional destination makes the response timely. The guide supplies no measured availability or latency improvement.

Enable only after these checks

  • Account readiness: configure and test the separate official client, key, and model ID. Do not assume a working CometAPI account proves the official account is ready.
  • Request compatibility: the OpenAI examples use Chat Completions on both routes; the Claude examples use Anthropic Messages on both. Choose models that support the required format and capabilities, then test each route. Neither shared syntax nor this guide establishes interchangeable outputs. Switching model families requires request conversion, response normalization, and capability verification—not just another model ID.
  • Spend visibility: configure official-provider budgets and alerts before enabling the route. Its billing is separate from CometAPI’s.
  • Route visibility: record the official fallback rate, as the guide recommends, and investigate sustained usage. I would also retain route, model, elapsed time, and classified failure category in operational telemetry so that successful recovery does not conceal recurring primary-route failures; avoid recording request bodies or credentials.

The useful default is therefore explicit: keep the first recovery inside CometAPI, and make leaving it a separately accepted application decision. Enable the final route only when compatibility, account readiness, spending controls, and cumulative latency have been checked—not because a third destination sounds inherently more reliable.

I would add a task-acceptance gate alongside the route-readiness checks. A fallback request returning successfully and a fallback answer remaining useful are different outcomes. The guide requires compatible formats and capabilities, but does not establish output equivalence for any model pair.

My proposed evaluation would run the same representative tasks through each configured route directly, rather than wait for primary-route failures to expose the alternatives. Define the acceptance criteria before comparing outputs: required fields, factual correctness against a reference where available, and whether the answer actually completes the task. Identical wording should not be the target. Report each route’s task pass rate separately from its request-completion rate, with the tested model IDs and configuration attached.

For example, if a response arrives but omits a required field, I would count it as transport recovery and task failure—not simply “successful fallback.” That is a proposed scoring rule, not a result reported by the guide. In live monitoring, I would also keep fallback outcomes separate from primary outcomes: requests reaching the later routes have already been selected by earlier failures, so their aggregate scores alone cannot establish that one model is better.

This could change the enablement decision: an official account can be configured, affordable, and timely while its chosen model still has no demonstrated task-level acceptance. I would leave that route disabled for the affected workload until the evaluation supports it.