Zero Completion Insurance
Automatic protection against empty or failed generation billing
If a request returns no completion tokens with a null finish reason, or exits with an error finish state, TheRouter.ai applies zero completion protection so you are not charged for unusable output.
activity-protected-example.json
{
"id": "chatcmpl_abc123",
"usage": {
"prompt_tokens": 812,
"completion_tokens": 0,
"total_tokens": 812
},
"choices": [{ "finish_reason": null }],
"billing": {
"charged": false,
"reason": "zero_completion_insurance"
}
}Retry pattern
async function guardedCompletion(payload: unknown) {
const res = await client.chat.completions.create(payload as never);
const usage = res.usage;
const finish = res.choices[0]?.finish_reason;
if ((usage?.completion_tokens ?? 0) === 0 || finish === "error") {
return client.chat.completions.create(payload as never);
}
return res;
}No setup required
Zero completion insurance is enabled by default for every account and provider route. You can still add client-side retries for better UX on transient failures.