Production Best Practices
Operate Qufas integrations safely and predictably.
Production checklist
Keep keys server-side
Store qf_sk_ values in a secret manager or server environment.
Use timeouts
Bound both non-streaming requests and stream consumption.
Retry selectively
Retry 429, 502, 503, and 504 with jittered exponential backoff.
Use idempotency correctly
Reuse one Idempotency-Key only for the same logical operation.
Log request IDs
Record x-qufas-request-id with application and support events.
Bound output
Set max_tokens to constrain latency and spend.
Handle streams defensively
Expect in-band errors, disconnects, and incomplete streams.
Separate Stop from cancellation
Stopping receipt does not guarantee provider cancellation. Final billable usage may include tokens generated after Stop.
Monitor spend
Track usage, balance, key limits, and dashboard request costs.
Retry boundaries
Do not retry authentication, validation, permission, or unsupported-parameter failures. For retryable transport/provider failures, use a maximum attempt budget and preserve the logical operation's Idempotency-Key. Always record the new canonical request ID for each gateway attempt.
After an interrupted stream, reconcile usage and billing rather than assuming zero cost. Idempotency protects settlement from duplicate charges; it does not guarantee that a retried request avoids another provider execution. Neither a client timeout nor[DONE] alone proves the billing outcome.
Was this page helpful?
