Pass "policy_reveiw" instead of "policy_review" to the router in CometAPI’s task-routing tutorial, and the example selects the customer-reply tier order. It does not report an unknown task.
That is a small application-policy choice worth making explicit before adopting this CometAPI integration. It does not mean CometAPI rewrites the prompt into a customer reply or sends a message to a customer.
Where the default comes from
The tutorial keeps routing in your application, then calls the selected model through CometAPI’s https://api.cometapi.com/v1 base URL and Chat Completions interface. Its route loop contains:
for tier in ROUTES.get(task, ROUTES["reply"]):
The published reply order is fast → cheap → accurate; policy_review starts with accurate, then falls back to fast → cheap. These are the application’s tier labels, not measured model rankings.
Reading that control flow, an unknown string selects the reply order while leaving the prompt unchanged. This is a consequence of the sample’s dictionary lookup, not evidence of a CometAPI server-side default. Omitting the required task argument entirely is a different error; it is not the same as passing a misspelled value.
Make a closed vocabulary fail before the API call
For an application with exactly three approved tasks, I would reject unknown values rather than silently reinterpret them. Starting from the tutorial’s existing ROUTES dictionary, add this application-side helper:
def approved_tiers(task):
if not isinstance(task, str) or task not in ROUTES:
raise ValueError("Unsupported task; use tag, reply, or policy_review")
return ROUTES[task]
Then replace the original loop header with:
for tier in approved_tiers(task):
Keep the rest of the model-selection and CometAPI call code inside the loop. The guard now runs before that call. This is a proposed patch, not a service-tested replacement router or an official CometAPI requirement.
At the request boundary, handle the validation error as invalid input. Do not catch it and retry through another model: changing models cannot repair a misspelled task label.
Test the boundary, not just the happy path
Use a stub for the CometAPI client when testing the patched router. The expected checks are:
| Input | Expected routing behavior |
|---|---|
"tag" |
Starts with cheap |
"reply" |
Starts with fast |
"policy_review" |
Starts with accurate |
"policy_reveiw", "", or None |
Validation error; zero client calls |
Those are test expectations, not reported execution results. In particular, assert the zero-call condition: merely checking that an error eventually appears would miss a router that makes a request first.
If unknown task labels genuinely belong to a general-assistance path, an explicit default can be reasonable. Document that policy, test its tier order, and record when it is used. For a controlled vocabulary, my preference is to keep reply an intentional task rather than an accidental escape hatch.
This guard only answers which task is allowed to reach the CometAPI model call. Keep the tutorial’s separate task-specific output validation and bounded fallback policy; accepting a task label does not establish output quality or current model compatibility.
Source scope: the official article was published September 1 and captured September 8, 2026. The point here is its application router’s control flow, not current model prices or a live performance comparison.